At a candy store, Gavin bought 2 kilograms of jelly beans and 2 kilograms of gummy worms for $32. Meanwhile, Dustin bought 2 kilograms of jelly beans and 1 kilogram of gummy worms for $25. How much does each candy cost?
Let x be the cost of a kilogram of jelly beans and y the cost of a kilogram of gummy worms. We form two equations:
2x+2y=32
2x+y=25
We have a system of equations now and we solve for x and y.
Subtracting 2x+y=25 from 2x+2y=32, we get y=7. Then we plug the y value into 2x+y=25 to get the value of x.
2x+y=25
2x+7=25
2x=18
x=9.
Therefore jelly beans cost $9 per kilogram and gummy worms $7 per kilogram.