Let the amount of 40% solution be a and 80% solution b.
so, 0.4a + 0.8b = 0.5(a + b)
Now, a + b = 2
=> 0.4a + 0.8(2 - a) = 0.5(2)
i.e. 1.6 - 0.4a = 1
so, 0.4a = 0.6
=> a = 1.5 and b = 0.5
Hence, 1.5 litres of 40% solution needs mixing with 0.5 litres of 80% solution to give a 2-litre, 50% solution