We are told that 2 gallons cost $8.40. To determine how much a quarter of a gallon costs we need first find the price per gallon. To do that we divide the cost over the number of gallons, like this:

Now we multiply the price by 1/4 gallons:

therefore, a quarter gallon costs $1.05