Let us assume Gary's age = g years.
Tom is four less than twice of Gary's age.
We took g for Gary's age, therefore "4 less than twice of g would be" 2g-4.
Therefore, Tom's age = 2g-4.
Rebecca is two less than half Gary’s age after it was increased by three.
After increasing g by 3, we get g+3.
Half of (g+3) = 1/2 (g+3).
Now 2 less than half after it was increased by three = 1/2(g+3)-2.
Therefore, Rebecca's age = 1/2(g+3)-2.
Sam's age = 7 more than Gary's age : 78 less than Gary's age.
Therefore, Sam's age = (g+7)/(g-8).