In a 10 gallon mixture, there are 7 gallons of A and 3 gallons of B.
If we add x gallons of B we will have 7+3+x=10+x gallons of mixture.
In those 10+x gallons there will be x+3 gallons of B so:
(x+3)/(10+x) is the proportion of B in the new mixture. We know this proportion is 42% or 0.42.
Therefore: (x+3)/(10+x)=0.42.
x+3=0.42(10+x)=4.2+0.42x,
x-0.42x=4.2-3=1.2,
0.58x=1.2,
x=1.2/0.58=2.069 gallons approximately.