Answer: 4 pounds of brand X sugar
====================================================
Reason:
n = number of pounds of brand X sugar
5n = cost of buying those n pounds, at $5 per pound
Brand Y costs $2 per pound, and you buy 8 lbs of it, so that's another 2*8 = 16 dollars.
5n+16 = total cost of brand X and brand Y combined
n+8 = total amount of sugar bought, in pounds
3(n+8) = total cost because we buy n+8 pounds at $3 per pound
The 5n+16 and 3(n+8) represent the same total cost.
Set them equal to each other. Solve for n.
5n+16 = 3(n+8)
5n+16 = 3n+24
5n-3n = 24-16
2n = 8
n = 8/2
n = 4 pounds of brand X sugar are needed
-------------
Check:
n = 4
5n = 5*4 = 20 dollars spent on brand X alone
16 dollars spent on brand Y mentioned earlier
20+16 = 36 dollars spent total
n+8 = 4+8 = 12 pounds of both types of sugar brands combined
3*12 = 36 dollars spent on both types of sugar brands
The answer is confirmed.
--------------
Another way to verify:
5n+16 = 3(n+8)
5*4+16 = 3(4+8)
20+16 = 3(12)
36 = 36