Posted by Greg on Wednesday, July 24, 2013 at 6:33am.
The amount at period n is the amount at period n-1 plus interest earned on that plus the periodic payment.
x[n] = x[n-1](1 + I) + P
x[n] = x[n-2](1+I)^2 +((1+I)^2 -1)P/I
x[n] = x[n-3](1+I)^3 +((1+I)^3 -1)P/I
...and so on...
x[n] = x[0](1+I)^n + ((1+I)^n -1)P/I