If you weren't my blogging audience, I might worry that you would make fun of me for being so excited about my refinanced mortgage. Instead, I know that y'all read this for the math (or, at least some of you do!), and are almost as excited for me as I am.

You may be wondering how mortgages really work. You borrow some amount of money for a very long term, often 30 but sometimes 15 years, repaying it on some sort of schedule. In each payment, you pay down part of the principal (the sum that you borrowed), and the rest is interest. Over time, the principal portion of the payment grows, but when you start out, most of the payment goes towards interest. How do they compute the mortgage payment schedule?

You get a mortgage at a certain interest rate, let's say 6% for the sake of argument. If you had a bank account where you were getting an annual 6% return, compounded monthly -- and if you have one, let me know where I can get one too! -- then if you left $100,000 in for 30 years and never took it out, you'd end up with nearly $602,258. On the other hand, if you took out a mortgage for the same amount, you would pay back only $215,838 over the lifetime of the loan. What is the difference?

The savings account accrues interest on the entire sum of money in the account, which grows every month by a factor of 1.005 (that 0.005 is equal to 6% divided by 12 months). So, after the first month, we obtain a balance of $100,000 × 1.005 = $100,500. Every subsequent month, the balance rises by that same factor multiplied by the previous month's balance, so we can compute the balance B after n months as

B = $100,000 × (1.005)

^{n}.

We can generalize this to any principal P and monthly interest rate i to obtain

B = P × (1+i)

^{n}.

With the mortgage, on the other hand, the principal p(t) at time t (upon which the interest is computed) decreases every month. We can express that principal as an equation in terms of the monthly interest rate i, the monthly payment A, and the original principal of the loan:

p(t) = p(t-1) × (1+i) - A,

with

p(0) = P and p(360) = 0.

These conditions represent the fact that at t=0, we owe the entire principal, and after 360 months, we should have paid the whole thing off.

We can plug the condition for p(0) into the equation, do some algebra, and obtain

p(t) = P × (1+i)

^{t}- A × ∑

_{k=0}

^{t-1}(1+i)

^{k}.

There's some algebra we could do to show that ∑

_{k=0}

^{t-1}(1+i)

^{k}= 1 + (1+i) + (1+i)

^{2}+ (1+i)

^{3}+ … + (1+i)

^{t-1}= ((1+i)

^{t}-1)/i. Substituting that in, we obtain

p(t) = P × (1+i)

^{t}- A × ((1+i)

^{t}-1)/i.

We haven't yet incorporated the other condition into the equation:

p(360) = P × (1+i)

^{360}- A × ((1+i)

^{360}-1)/i = 0.

Since we know P and i, we can solve for the monthly payment A and obtain

A = P × i (1+i)

^{360}/((1+i)

^{360}-1).

So if i = 0.005 (6% yearly rate), then our monthly payment is

A = 100,000 × 0.005 (1.005)

^{360}/((1.005)

^{360}-1) = $599.55

and multiplying that by 360 payments, we obtain $215,838.19.

My 30-year mortgage rate was 6.5%, while my new 15-year mortgage rate is 4.5%. How much money am I going to save with this new mortgage?

Let's suppose for a minute that I haven't been paying on my old mortgage for three years, and compare the mortgages from their inception. Let's also suppose that they are for the exact same amount of money -- a convenient, round $100,000 -- and that I never pay anything extra on the mortgage. How much will I pay by the time I'm finished paying off these two mortgages?

The 30-year mortgage has an APR of 6.5%, but an APY of 6.7%. My monthly payment is $632, for 360 months. In the end I would pay more than $227,544 to borrow $100,000.

On the other hand, my 15-year mortgage monthly payment is $765, and I pay only $137,700 to borrow $100,000.

I didn't borrow exactly $100,000, but I did borrow some amount in that ballpark. So how am I paying only $50 more per month?

On my previous mortgage, I committed to paying an extra $100 per month, because I wanted to pay it down faster. In the example case, this means I would be paying an extra $33 per month. But by refinancing, I am able to pay roughly the same payment and pay off the mortgage in about half the time!