I don't know how to solve in my statistics homework problem
Sample
In a class of 6 students, their average age is 21. When the teacher joins the class, the avg age becomes 26. What's the age of the teacher ?
Is there a formula to do this or a series of substitutions ?