Solving the marbles Question by Algebra.
This is one way of working this out using Algebra
Let the number of marbles that Andrew has be A
Let the number of marbles that Billy has be B
If Andrew gives away one of his marbles he is left with A - 1 marbles. If Billy is given a marble he has B+1 marbles.
They both have the same number of marbles so A - 1 = B+1
or A = B+2 (equation I)
If Billy gives one of his marbles to Andrew then Billy has B - 1 marbles and Andrew has A+1 marbles
We are told that Andrew then has twice as many marbles as Billy so
A+1 = 2(B - 1)
or A+1 = 2B -2
or A= 2B -3
or 2B - 3 = A (equation II)
If we put equation I and equation II together we have
2B - 3 = A = B+ 2
2B - 3 = B + 2
2B = B + 5
B=5 so Billy starts with 5 marbles.
Now if we look at equation 1 A=B+2
Then A = 5 + 2 = 7 so Andrew starts with 7 marbles.