You need an equation for the solutions and an equation for the acid.
Let x = amount of 20% acid solution
Let y = amount of 50% acid solution.
The equation for the solution:
You want a total of 12 liters, so
x + y = 12
The equation for the acid:
The 20% solution has 20% acid, so in x liters of the 20% solution, you have 0.2x liters of acid.
The 50% solution has 50% acid, so in y liters of the 50% solution, you have 0.5y liters of acid.
The combined solution is 12 liters of 30% acid, so it has 30% * 12 liters of acid = 3.6 liters of acid.
0.2x + 0.5y = 3.6
Now you solve the two equations in a system of equations.
x + y = 12
0.2x + 0.5y = 3.6
Multiply the second equation by 10:
2x + 5y = 36
Multiply the first equation by -2:
-2x - 2y = -24
Add the last two equations:
3y = 12
y = 4
Substitute y = 4 in the first original equation:
x + y = 12
x + 4 = 12
x = 8
Answer: 8 liters of 20% solution and 4 liters of 50% solution.