J = 40 - G
G + 16 = 3/5 (40 - G)
Solve for G.
G + 16 = 3/5 (40 - G)
Solve for G.
Let's assume Gabriel had x toy cars at first.
According to the problem, James had a total of 40 - x toy cars:
After Gabriel bought another 16 toy cars, his number of toy cars increased to x + 16.
James lost 2/5 of his toy cars, so he had (1 - 2/5) * (40 - x) = 3/5 * (40 - x) toy cars left.
Since Gabriel and James had an equal number of toy cars left, we can set up an equation:
x + 16 = 3/5 * (40 - x)
Now, we can solve this equation to find the value of x:
Multiply both sides of the equation by 5 to get rid of the fraction:
5(x + 16) = 3(40 - x)
Simplifying:
5x + 80 = 120 - 3x
Combining like terms:
5x + 3x = 120 - 80
8x = 40
Divide both sides by 8:
x = 40/8
x = 5
Therefore, Gabriel had 5 toy cars at first.