Current time:0:00Total duration:17:36
What I want to do in this video is go over the math behind a mortgage loan. And this isn't really going to be a finance video. It's actually a lot more mathematical. But it addresses, at least in my mind, one of the most basic questions that's at least been circling in my head for a long time. You know, we take out these loans to buy houses. Let's say you take out a $200,000 mortgage loan. It's secured by your house. You're going to pay it over-- 30 years, or you could say that's 360-- months. Because if you normally pay the payments every month, the interest normally compounds on a monthly basis. And let's say you're paying 6%-- interest. This is annual interest, and they're usually compounding on a monthly basis, so 6% divided by 12. You're talking about 0.5% per month. Now normally when you get a loan like this, your mortgage broker or your banker will look into some type of chart or type in the numbers into some type of computer program. And they'll say oh OK, your payment is going to be $1,200 per month. And if you pay that $1,200 per month over 360 months, at the end of those 360 months you will have paid off the $200,000 plus any interest that might have accrued. But this number it's not that easy to come along. Let's just show an example of how the actual mortgage works. So on day zero, you have a $200,000 loan. You don't pay any mortgage payments. You're going to pay your first mortgage payment a month from today. So this amount is going to be compounded by the 0.5%, and as a decimal that's a 0.005. So in a month, with interest, this will have grown to 200,000 times 1 plus 0.005. Then you're going to pay the $1,200. Just going to be minus 1,200 or maybe I should write 1.2K. But I'm just really just showing you the idea. And then for the next month, whatever is left over is going to be compounded again by the 0.5%, 0.005. And then the next month you're going to come back and you're going to pay this $1,200 again. Minus $1,200. And this is going to happen 360 times. So you're going to keep doing this. And you can imagine if you're actually trying to solve for this number-- at the end of it you're going to have this huge expression that's going to have you know 360 parentheses over here-- and at the end, it's all going to be equal to 0. Because after you've paid your final payment, you're done paying off the house. But in general how did they figure out this payment? Let's call that p. Is there any mathematical way to figure it out? And to do that, let's get a little bit more abstract. Let's say that l is equal to the loan amount. Let's say that i is equal to the monthly interest. Let's say n is equal to the number of months that we're dealing with. And then we're going to set p is equal to your monthly payment, your monthly mortgage payment. Some of which is interest, some of which is principle, but it's the same amount you're going to pay every month to pay down that loan plus interest. So this is your monthly payment. So this same expression I just wrote up there, if I wrote it in abstract terms, you start off with a loan amount l. After 1 month it compounds as 1 plus i. So you multiply it times 1 plus i. i in this situation was 0.005. Then you pay a monthly payment of p, so minus p. So that's at the end of one month. Now you have some amount still left over of your loan. That will now compound over the next month. Then you're going to pay another payment p. And then this process is going to repeat 300 or n times, because I'm staying abstract. You're going to have n parentheses. And after you've done this n times, that is all going to be equal to 0. So my question, the one that I'm essentially setting up in this video, is how do we solve for p? You know if we know the loan amount, if we know the monthly interest rate, if we know the number of months, how do you solve for p? It doesn't look like this is really an easy algebraic equation to solve. Let's see if we can make a little headway. Let's see if we can rearrange this in a general way. So let's start with an example of n being equal to 1. If n is equal to 1, then our situation looks like this: you take out your loan, you compound it for one month, 1 plus i, and then you pay your monthly payment. Now this was a mortgage that gets paid off in 1 month, so after that 1 payment you are now done with their loan, you have nothing left over. Now if we solve for p, you can now swap the sides. You get p is equal to l times 1 plus i. Or if you divide both sides by 1 plus i, you get p over 1 plus i is equal to l. And you might say hey you already solved for p why are you doing this? And I'm doing this, because I want to show you a pattern that'll emerge. Let's see what happens when n is equal to 2. Well then you start with your loan amount. It compounds for one month. You make your payment. Then there's some amount left over. That will compound for one month. Then you make your second payment. Now this mortgage only needs two payments, so now you are done. You have no loan left over. You've paid all the principal and interest. Now let's solve for p. So I'm going to color the p's. I'm going to make this p pink. So let's add p to both sides and swap sides. So this green p will be equal to all of this business over here. Is equal to l times 1 plus i minus that pink p. They're the same p, I just want to show you what's happening algebraically. Minus that pink p times 1 plus i. Now if you divide both sides by 1 plus i, you get p over 1 plus i is equal to l times 1 plus i minus that pink p. Now let's add that pink p to both sides of this equation. You get the pink p plus this p plus p over 1 plus i is equal to l times 1 plus i. Now divide both sides by 1 plus i. You get the pink p over 1 plus i plus the green p, the same p, times-- it already is being divided by 1 plus i, you're going to divide it again by 1 plus i, so it's going to be divided by 1 plus i squared is equal to the loan. Something interesting is emerging. You might want to watch the videos on present value. In this situation, you take your payment, you discount it by your monthly interest rate, you get the loan amount. Here you take each of your payments, you discount it, you divide it by 1 plus your monthly interest rate to the power of the number of months. So you're essentially taking the present value of your payments and once again, you get your loan amount. You might want to verify this for yourself if you want a little bit of algebra practice. If you do this with n is equal to 3. I'm not going to do it just for the sake of time. If you do n is equal to 3, you're going to get that the loan is equal to p over 1 plus i plus p over 1 plus i squared plus p over 1 plus i to the third. If you have some time, I encourage you to prove this for yourself just using the exact same process that we did here. You're going to see it's going to get little bit harry. There's going to be a lot of a manipulating things, but it won't take you too long. But in general, hopefully, I've shown to you that we can write the loan amount as the present value of all of the payments. So we could say in general the loan amount, if we now generalize it to n instead of and n equals a number, we could say that it's equal to-- I'll actually take the p out of the equation, so it's equal to p, times 1 plus 1 over 1 plus i plus 1 over 1 plus i squared plus, and you just keep doing this n times, plus 1 over 1 plus i to the n. Now you might recognize this. This right here is a geometric series. And there are ways to figure out the sums of geometric series for arbitrary ends. As I promised at the beginning of the video this would be an application of a geometric series. It's equal to the sum of 1 over 1 plus i to the, well I'll use some other letter here, to the j from j is equal to 1. This is to the one power you could view this is to the first power to j is equal to n. That's exactly what that sum is. Let's see if there's any simple way to solve for that sum. You don't want to do this 360 times. You could, you'll get a number, and then you could divide l by that number, and you would have solved for p. But there's got to be simpler way to do that, so let's see if we can simplify this. Just to make the math easier, let me make a definition. Let's say that r is equal to 1 over 1 plus i. And let me call this whole sum s. This sum right here is equal to s. Then if we say r is equal to each of these terms then s is going to be equal to this is going to be r to the first power. I'll write r to first this is going to be r squared, because if you square the numerator you just get a 1 again. So this is plus r squared plus r to the third, plus all the way this is r to the n. And I'll show you a little trick. I always forget the formula, so this is a good way to figure out the sum of a geometric series. Actually this could be used to find a sum of an infinite geometric series if you like, but we're dealing with a finite one. Let's multiply s times r. So r times s is going to be equal to what? If you multiply each of these terms by r, you multiply r to the first times r you get r squared. You multiply r squared times r you get r to the third. And then you keep doing that all the way, you multiply r-- see there's an r to the n minus one here-- you multiply that times r, you get r to the n. And then you multiply r to the n times r, you get plus r to the n plus 1. All this is right here is all of these terms multiplied by r, and I just put them under the same exponent. Now what you can do is you could subtract this green line from this purple line. So if we were to say s minus rs, what do we get? I'm just subtracting this line from that line. Well, you get r1 minus 0, so you get r to the first power minus nothing there. But then you have r squared minus r squared cancel out r to the third minus r to the third cancel out. They all cancel out, all the way up to r to the n minus r to the n cancel out, but then you're left with this last term here. And this is why it's a neat trick. So you're left with minus r to the n plus 1. Now factor out an s. You get s times 1 minus r-- all I did is I factored out the s-- is equal to r to the first power minus r to the n plus 1. And now if you divide both sides by 1 minus r, you get your sum. Your sum is equal to r minus r to the n plus 1 over 1 minus r. That's what our sum is equal to, where we defined our r in this way. So now we can rewrite this whole crazy formula. We can say that our loan amount is equal to our monthly payment times this thing. I'll write it in green. Times r minus r to the n plus 1. All of that over 1 minus r. Now if we're trying to solve for p you multiply both sides by the inverse of this, and you get p is equal to your loan amount times the inverse of that. I'm doing it in pink, because it's the inverse. 1 minus r over r minus r to the n plus 1. Where r is this thing right there. And we are done. This is how you can actually solve for your actual mortgage payment. Let's actually apply it. So let's say that your loan is equal to $200,000. Let's say that your interest rate is equal to 6% annually, which is 0.5% monthly which is the same thing as 0.005. This is monthly interest rate. And let's say it's a 30 year loan, so n is going to be equal to 360 months. Let's figure out what we get. So the first thing we want to do is we want to figure out what our r value is. So r is 1 over 1 plus i. So let's take 1 divided by 1 plus i so plus 0.005. That's what our monthly interest is, half a percent. So 0.995 that's what our r is equal to. Let me write that down, 0.995. Now this calculator doesn't store variables, so I'll just write that down here. So r is equal to 0.995. We just used that right there. I'm losing a little bit of precision, but I think it will be OK. The main thing is I want to give you the idea here. So what is our payment amount? Let's multiply our loan amount that's $200,000 times 1 minus r, so 1 minus 0.995 divided by r which is 0.995 minus 0.995 to the of the-- now n is 360 months, so it's going to be 360 plus 1 to the 361 power, something I could definitely not do in my head, and then I close the parentheses, and my final answer is roughly $1,200. Actually if you do it with the full precision you get a little bit lower than that, but this is going to be roughly $1,200. So just like that, we were able to figure out our actual mortgage payment. So p is equal to $1,200. So that was some reasonably fancy math to figure out something that most people deal with everyday, but now you know the actual math behind it. You don't have to play with some table or spreadsheet to kind of experimentally get the number.