Extending the example in the link.
d is the periodic payment
p is the loan amount
r1 is the periodic rate for the first m periods
r2 is the periodic rate for the next n periods
r3 is the periodic rate for the next o periods
p = 100000
r1 = 0.03
m = 2
r2 = 0.04
n = 3
r3 = 0.05
o = 2
Discounting each payment to net present value:
pv1 = d/(1 + r1)
pv2 = d/((1 + r1) (1 + r1))
pv3 = d/((1 + r1) (1 + r1) (1 + r2))
pv4 = d/((1 + r1) (1 + r1) (1 + r2) (1 + r2))
pv5 = d/((1 + r1) (1 + r1) (1 + r2) (1 + r2) (1 + r2))
pv6 = d/((1 + r1) (1 + r1) (1 + r2) (1 + r2) (1 + r2) (1 + r3))
pv7 = d/((1 + r1) (1 + r1) (1 + r2) (1 + r2) (1 + r2) (1 + r3) (1 + r3))
p = pv1 + pv2 + pv3 + pv4 + pv5 + pv6 + pv7
6.08738 d
So p = 6.08738 d
therefore d = 100000/6.08738 = 16427.43
Expressing the above using summations and formulae:
p = (d - d (1 + r1)^-m)/r1 +
1/(1 + r1)^m (d - d (1 + r2)^-n)/r2 +
1/((1 + r1)^m (1 + r2)^n) (d - d (1 + r3)^-o)/r3
6.08738 d
There is a clear pattern to extend the formula for any number of changes. Here is the mathematical formula, but it does not simplify:
With
z[1] = r1, z[2] = r2, z[3] = r3, etc.
v[1] = m, v[2] = n, v[3] = o, etc.
f[3]
6.08738 d
∴ d = 100000/6.08738 = 16427.43
Returning to the three-rate formula and rearranging for d
:
p = (d - d (1 + r1)^-m)/r1 +
1/(1 + r1)^m (d - d (1 + r2)^-n)/r2 +
1/((1 + r1)^m (1 + r2)^n) (d - d (1 + r3)^-o)/r3
∴ d = (p r1 (1 + r1)^m r2 (1 + r2)^n r3 (1 + r3)^o)/
(-r1 r2 + (1 + r3)^o (r1 (r2 - r3) +
(1 + r2)^n (r1 + (-1 + (1 + r1)^m) r2) r3))
= 16427.43