Help with a easy math problem

This is probably easy but it has me stumped. I know the answer but can't put it into a good formula for future reference.

If I need a 40% antifreeze mixture and have 20L of solution at 20% how much do I need to drain and add 100% to in order to get the 20L @ 40%?

20 L at 20% implies that there is 20 * .2 = 4 L of pure in your bottle.

You want to have 20 * .4 = 8 L of pure in the bottle to get 40%.

let x = amount of solution to drain and y = amount of pure to add.

20L solution * (.2 pure/solution) - xL solution*(.2 pure/solution) + yL solution(1 pure/solution) = 20L solution * .4 pure/solution.

4 - 1/5x + y = 8

-1/5 x + y = 4

y = 1/5x + 4

This formula does not take into account that we want to have 20L of solution at the end. We need to solve for x and y such that x = y, so that the end volume is the same as the start volume.

y = 1/5x + 4

-y = -x

-----------------

0 = -4/5x + 4

4/5x = 4

x = 5

So drain 5 liters and add 5 liters of pure.
verification:
start with 4 L pure in 20 L solution. Drain 5 liters, resulting in 4 - 5 * .2 = 3 L pure in 15 L of solution. Add 5 L pure resulting in 8 L pure in 20 L solution.

High school algebra in the hizouse!

Thanks man. I am trying to help my kid with this stuff and it has been a long time since I have taken a math class.

6, seriously