j=john's age now
s=sam's age now
j=3 times s
j=3s
in five years (j+5,s+5)
j+5=2 times (5+s)
j+5=2(s+5)
j+5=2s+10
subtract 5 from both sides
j=2s+5
use other equation
j=3s
j=2s+5
subsitute
3s=2s+5
subtract 2s
s=5
sam=5
j=3s
j=3 times 5
j=15
john=15
sam=5