Answer:
Let's denote:
- x as the initial amount of milk in the second container
- 2x as the initial amount of milk in the first container (since it contains twice as much milk as the second)
According to the problem, after John uses 2 gallons of milk from the second container and 3 gallons from the first one, the first container has 4.5 times as much milk as the second. This gives us the following equation:
(2x - 3) = 4.5 * (x - 2)
Let's solve this equation.
Expanding the right side of the equation gives:
2x - 3 = 4.5x - 9
Subtracting 2x from both sides gives:
-3 = 2.5x - 9
Adding 9 to both sides gives:
6 = 2.5x
Finally, dividing both sides by 2.5 gives:
x = 6 / 2.5
x = 2.4 gallons
So the second container originally contained 2.4 gallons of milk.
Since the first container originally contained twice as much milk as the second, it contained 2 * 2.4 = 4.8 gallons of milk.