To work out averages we add up all of the ages and divide by the number of people in the group.
So that means in the first group, before the new person joined in, all the ages added up and divided by 6 equals 21. So let's just undo that. We times 21 by 6 to get 126. So now we know the total age of the first group, we need to remember that for later.
Now we do the same for the new group. We take the average age, which is 25 and multiply it by 7 (remember there are 7 people in the group now, not 6). When we do this we get 175.
To find the age of the new person in the group we take the old total age away from the new total age: 175 - 126 = 49. That means the new person in the group is 49 years old!