Let
be the inital number of Timmy's marbles, and
be the inital number of Ben's marbles.
At the beginning, "Timmy had 3/4 of what Ben had", which means

(I wrote the equation in an equivalent form to avoid denominators)
Then, Ben gives 36 marbles to Timmy. So, now Ben has
marbles, and Timmy has
marbles. The new ratio is 1 to 3 in Timmy's favour, so we have

(same as before)
So, we have the following linear system:

From the first equation we know that
, so the second equation becomes

Now that we know the value for
, we can simply plug it into the first equation to get
