Let's call the number of gallons of milk containing 7% butterfat "x" and the number of gallons of milk containing 3% butterfat "y".
We know that we need a total of 372 gallons of milk.
So, x + y = 372
We also know that the final mixture must contain 6% butterfat.
To find the amount of butterfat in the final mixture, we can multiply the percentage of butterfat in each milk by the number of gallons of that milk, add the two amounts of butterfat, and divide by the total number of gallons:
0.07x + 0.03y = 0.06(372)
Now we have two equations with two variables:
x + y = 372
0.07x + 0.03y = 22.32
We can solve for one of the variables in terms of the other in the first equation:
y = 372 - x
We can substitute this expression for y into the second equation:
0.07x + 0.03(372 - x) = 22.32
Simplifying and solving for x:
0.07x + 11.16 - 0.03x = 22.32
0.04x = 11.16
x = 279
So we need 279 gallons of milk containing 7% butterfat and 93 gallons of milk containing 3% butterfat to obtain 372 gallons of milk containing 6% butterfat.
Answer: 279 gallons of milk containing 7% butterfat and 93 gallons of milk containing 3% butterfat.