A sinking fund is the accumulated amount to be realized at some future date (the end of the term) when a fixed number of periodic payments are paid into an account earning interest at the rate of i per period.

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