An amount P invested today at a rate of interest r for n years is equal to `P(1 + r)^n` after n years.
If an amount of 5000000 is required after 2 years and the rate if interest compounded semi-annually is 4% the amount to be invested is P such that:
`P*(1 + 0.04/2)^4 = 5000000`
As the compounding is done semi-annually, the rate has been halved and the period of investment made double.
=> P = `5000000/(1.02)^4`
=> P = 4619227.13
An amount of 4619227.13 needs to be invested.