So here you have two variables, and two sets of equations that can be created.
The first set deals with the number of gallons each car utilized times their miles per gallon, canceling out gallons and leaving one with the total miles. X is the number of gallons consumed by the first car, and Y is the number consumed by the second car:
(15 miles/gallon * x gallons) + (25 miles/gallon * y gallons)=675 miles;
15x+25y=675
The second equation can be created given the information that the total gallon consumption was 35 gallons, and if X and Y are gallons consumed by the respective cars, then we can create a second equation:
x gallons+y gallons=35 gallons;
x+y=35
Now, if we rearrange the second equation, we can express either x as a function of y:
x=35-y
or y as a function of x:
y=35-x
We then take one of these (doesn't matter which, I'll use the first one) and replace very instance of that given variable in the first equation with what it equals as a function of the other variable.
Hence, here, I have taken the first equation, and each time I encounter x, I replace it with 35-y (which we just saw is equal to x):
15(35-y)+25y=675
And then it's simple as solving for y:
525-15y+25y=675
10y=150
y=150/10
y=15 gallons
And since we know x=35-y, input the new y into this equation to find x:
x=35-15
x=20 gallons
If you want to double check, just to make sure, put the values we got back into the first equation and see if it comes out correct:
15x+25y=675
15(20)+25(15)=675
300+375=675
675=675
And indeed it does! Let me know if anything in here doesn't make sense and I'd be happy to explain it again. Basically, if you need to find 2 variables, you need 2 equations, and you need to change one of the equations into a format that expresses one of the variables as a function of the other, thereafter replacing that variable in the other equation.