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;
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;
Now, if we rearrange the second equation, we can express either x as a function of y:
or y as a function of 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):
And then it's simple as solving for y:
And since we know x=35-y, input the new y into this equation to find x:
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:
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.