Suppose I have money ($x$) in a bank account bank with compound interest of $5\%$ annually paid monthly. Bank gives me $20,000$ usd a month and the money $x$ finishes in $20$ years ($240$ months). How to calculate how much was $x$?
For example if $x=1,000,000$, after first month the money will reduce to $x'=1,000,000+1,000,000\times 0.05\times \frac{1}{12}-20,000=984,167$.
I know how to formulate it but it's very long messy equation which I have no idea how to solve it.
Thank you
By the way, $20$ years is $240$ months.
I will continue with your formulation. Let $r=1+\frac{0.05}{12}$.
After $1$ month, the bank has $$xr-20000$$
After $2$ month, the bank has $$(xr-20000)r-20000=xr^2-20000r-20000$$
After $3$ months, the bank has $$xr^3-20000r^2-20000r-20000$$
Following the pattern, after $240$ months, the bank has $$xr^{240}-20000(1+r+r^2+\cdots r^{239})\\ =xr^{240}-20000(\frac{r^{240}-1}{r-1})$$
Can you continue from here?