Let
x--------> volume of 50% fertilizer
y--------> volume of 30% fertilizer
we know that
x+y=160-----> x=160-y-----> equation 1
x*0.5+y*0.3=160*0.4-----> equation 2
substitute equation 1 in equation 2
[160-y]*0.5+0.3*y=63.8----> 77-0.35*y+0.25*y=63.8
0.10*y=13.2------> y=13.2/0.10----> y=132 gal
x=220-y----> x=220-132----> x=88 gal
the answer is
88 gal of 50% fertilizer
132 gal 30% fertilizer