William + Father + Mary = 51.
W + 6W + (W-5) = 51 (<<<---=== Father = 6*William; Mary = William -5)
8W = 51 + 5 = 56 ====> W = 56/8 = 7.
Answer. William is 7 years old; the father is 6*7 = 42 years old; Mary is 7-5 = 2 years.
Check. 7 + 42 + 2 = 51. ! Correct !