let X= toms age
let y = Tim's age
X+y=21
(X+3)=2(y+3)
X+3=2y+6
X-2y=3
2*(X+y=21) multiple the equation by 2
so now you have 2 equations
x-2y=3
2x+2y=3
add the equations (2y cancel out)
3x=9
solve for X and plug back into one of the original equations to get y