Let H represent the number of gallons of gas used for Highway travel.
Let C represent the number of gallons of gas used for City travel.
15 total gallons of gas are used, so one equation, I'll call the "gallons" equation is:
H gal + C gal = 15 gal or more simply: H + C = 15
We have 2 unknowns, but only one equation so far. So the second equation comes from the MPG information (I will write this equation including the units, so you can see how it "works").
This one I'll call the "miles" equation:
24 mi / gal * H gal + 16 mi / gal * C gal = 280 mi
Notice that for the left side of this equation, in both terms the "gallon" units will "cancel," since one of them is in the denominator (from the MPG part -- miles per gallon, or mi / gal), and the other is in the numerator (from the unknowns H and C, which represent "gallons").
After the "gallon" units cancel, the left side of the equation is only expressed in terms of "miles," which matches the "miles" on the right side of the equation.
Here is the updated "miles" equation:
24 mi * H + 16 mi * C = 280 mi or more simply: 24 H + 16 C = 280
When we combine these 2 equations (the "gallons" equation with the "miles" equation, we get the following system of equations:
H + C = 15 ("gallon" equation)
24 H + 16 C = 280 ("miles" equation)
You can now solve this system in any way you choose, depending on what your teacher requires.
I suspect that the solution method (substitution, elimination, graphing, Cramer's rule, or matrix methods) is not what was giving you trouble; it was setting up the system of equations in the first place.
If you are familiar with matrix methods on the graphing calculator, then that is probably the fastest way to go. You simply enter this system of equations as a 2x3 augmented matrix, and then find the solution using the "rref" (reduced-row echelon form) method.
(feel free to message me if you would like the detailed, step-by-step instructions)
To solve using the substitution method (probably the fastest "by-hand" way)
Solve "gallons" equation for either variable (I'll choose H):
H = 15 - C
Now, substitute (15 - C) for H in the second, "miles" equation of 24 H + 16 C = 280, like so:
24 ( 15 - C ) + 16 C = 280 Now, you have an equation only in terms of one variable, C.
So, simplify and solve this equation:
360 - 24 C + 16 C = 280
- 8 C = 280 - 360
- 8 C = - 80
So C = 10 gallons. But the question is not asking how many gallons were used for City travel; it is asking how much it COST for the City travel. All you do is multiply the cost per gallon from the given information:
Cost of City driving = 10 gal * $3.15 / gal = $31.50 total cost for City driving.
(Note that this problem did NOT ask about the Highway driving, but this is easy enough to get.)
You already know that C = 10, so substitute this back into the "gallons" equation of H + C = 15:
H + 10 = 15 so H = 5 gallons,
and cost of Highway driving = 5 gal * $3.15 / gal = $15.75 total cost for Highway driving.