Since the average age is 15 years for 39 students, we have,
(Sum of ages of all Students) / 39 =15
Sum of ages of all students = 39 * 15 = 585 years ......................... (1)
Once the age of the teacher is added, we have the average as
(Sum of ages of students + teacher's age) / (39+1) = 15.4
hence Sum of ages of students + teacher's age = 616 years..........(2)
Solving the above two equations,
Teacher's age = 616 - 585 = 31 years