John is 3 and Jack is 8.
Let n be John's age and k be Jack's age.
John's age in 5 years would be represented as n+5; this gives us n+5=k.
John's age in 2 years would be n+2 and Jack's age in 2 years would be k+2; this gives us
k+2=2(n+2)
Using the distributive property,
k+2=2*n+2*2
k+2=2n+4
Substituting our value of k from the first equation,
n+5+2=2n+4
Combining like terms,
n+7=2n+4
Subtract n from both sides:
n+7-n=2n+4-n
7=n+4
Subtract 4 from both sides:
7-4=n+4-4
3=n
n+5=k
3+5=k
8=k