Mr. Smartypants
Easy. Let's use the variable b for the number of marbles in a bag.
You bought 3 bags, so you have 3b marbles.
Your friend bought one bag but he also has 24 marbles, so he has b + 24 marbles.
Now you both have the same amount So, 3b = b + 24. That's our equation. Now we solve for b.
3b = b + 24
Let's subtract b from both sides.
2b = 24
So now it's simple. Divide both sides by 2.
b = 12
And there ya go.