It would take 20 liters of the 10% solution.
We will let x be the amount of 10% solution in our problem. 10% saline in x liters is 0.1x. 4 liters of a 40% solution would be 4*0.4 = 1.6. We know that there are a total of x+4 liters in the final solution, and that it is 15% saline; that is 0.15(x+4). Our equation is then:
0.1x + 0.4(4) = 0.15(x+4)
0.1x+1.6 = 0.15*x + 0.15*4
0.1x+1.6 = 0.15x+0.6
We cannot have a variable on both sides; we will subtract 0.1x from both sides:
0.1x + 1.6 - 0.1x = 0.15x + 0.6 - 0.1x
1.6 = 0.05x + 0.6
Subtract 0.6 from both sides:
1.6 - 0.6 = 0.05x + 0.6 - 0.6
1 = 0.05x
Divide both sides by 0.05:
1/0.05 = 0.05x/0.05
20 = x
x was the 10% solution, so there are 20 liters of it.