suppose there are n people in this family
one parent is age 40, suppose the rest of the family add up to be y years old
the average is (40+y)/n=20 =>40+y=20n
exclude the 40-year-old parent, the sum of age is still y, the number of family is (n-1), the average is y/(n-1)=15 =>y=15n-15
substitute y=15n-15 in the first equation: 40+(15n-15)=20n
solve for n: 5n=25, n=5
there are a total of 5 people in this family, there are 3 kids.