Answer: Sam had $170 at first
Explanation:
Let's use algebra to solve the problem.
Let J be the amount of money James had at first, and let S be the amount of money Sam had at first. We know from the problem that:
J = S + 240 (James had $240 more than Sam at first)
After their mother gave James $30 and Sam $50, James had twice as much money as Sam:
J + 30 = 2(S + 50)
Now we can substitute the first equation into the second equation to solve for S:
(S + 240) + 30 = 2(S + 50)
S + 270 = 2S + 100
S = 170
Therefore, Sam had $170 at first.