We are given: Initial amount of the gas = 30 gallons.
Milage of the Troy’s truck = 21 miles per gallon.
Number of gallons of gas used in 1 miles = 1/21 gallons.
Let us assume, number of miles Troy truck travel = m miles.
Number of gallons of gas used in travelling m miles = m * 1/21 = 1/21 m.
And number of gallons of gas left after travelling m miles = g gallons of gas.
Number of gallons of gas = Total gas present initially - Number of gallons gas used to travel m miles.
Therefore, we can setup an equation.
g = 30 - 1/21 m.