There exists many automated tools for the calculation of mortage loan such as this website.
However, I believe having a detailed mathematical understanding for the calculation of mortage payments is paramount as undeniably, this formula plays such a key role in the lives of many.
The formula is:
M = P [ i(1 + i) ^n ] / [ (1 + i)^n - 1]
To illustrate the working of this formula.
Say for a $100,000 mortgage at 5% compounded monthly for 15 years, we would first solve for i as
i = 0.05 / 12 = 0.004167 and
n as 12 x 15 = 180 monthly payments
Next we would solve for (1 + i)^n = (1.004167)^180 using the xy key on the calculator, which yields 2.11383
Now our formula reads M = P [ i(2.11383)] / [ 2.11383- 1] which simplifies to
M = P [.004167 x 2.11383] / 1.11383 or
M = $100,000 x 0.00791 = $791.81