There is two milk with a different fat concentration in this question. First, you need to know the ratio of 2%:7% that will result in 5%. The equation for the fat content would be:
fat content1 + fat content2= fat content3
2% * v1 + 7%*v2= 5%* (v1+v2)
2*v1 + 7*v2= 5*v1 + 5*v2
2*v1 + 7*v2- (5*v1 + 5*v2)
-3*v1 +2*v2=0
2*v2= 3v1
v1:v2= 3/2
Then for 40 quarts,
the number of 2% needed would be:
3/(3+2) * 40 quarts= 24 quarts
the number of 7% needed would be:
2/(3+2) * 40 quarts= 16 quarts