A single loan can be modeled with "principal at period i" Pi, "interest rate over that period" r, and "payment that begins the next period" $.
Note that r is not the same as the nominal interest rate of the loan, but is calculated from it.1 To find the principal at period i+n we do the following:
Taking the standard simplification of such geometric series2, we find
With this we can solve for n when Pi = 0, that is, when the loan is fully paid off.
We can see n as a function of variables P, r, $ and write
If we have a one-time overpayment b we can find the savings in interest from applying it to a single loan with
Now, a plan of action must be laid out to find the most efficient way of paying back loans. For a single loan, the plan is to pay it back as quickly as possible. For multiple loans, however, it may be necessary to split b between them. We should like every increment of payment to go to the loan whose rate of savings is the highest. The rate of savings function is found
For multiple loans we shall use a subscript qi'[b] to denote the variables associated with each loan, writing
We want to know which loan to pay first, then second, and so on, which is found by ordering the loans based on their initial rate of savings qi'. When we know what order to pay, we will next find when to start paying each loan. Imagine you have only two loans, and they are already ordered. You will want to start paying the second loan when the first loan's incremental rate is equal to the second loan's initial rate. For that we will need the inverse function of our rate of savings function.
With only two loans, we plug the second loan's initial rate of savings into the first loan's inverse function, which gives the amount of payment towards the first loan that brings it to the same rate of savings as the second loan. In general, we will plug the nth initial rate of savings into the (n-1)th, (n-2)th, and so on's inverse functions and sum the results.
This gives us a sequence of wi that we can compare to b. The subscript is very imporant here, because it tells us how many loans to take into the next step. Taking w0 = 0, we pay off i loans when wi-1 < b ≤ wi. Specifically we will pay off the first i loans in our ordered list, and no more! If we didn't take this step into consideration our algorithm would try to pay negative values. As much as we would like that, it is sadly impossible. Now we will add up the correct number of inverse functions, set the sum equal to our specific bonus, and then invert this so we know the rate of savings when we pay our specific bonus.
We can then plug this rate of savings into individual inverse functions and we find the answer we were looking for: the amount to be paid toward each loan in order to maximize our savings.
If we want, we can also take these amounts and apply them to our savings function to find out what the maximum savings actually was.
1. Given nominal interest rate R, and its period of compounding f we find the interest rate over d of these periods
For example a school loan with a nominal interest rate of 5% that compounds daily and is on a monthly payment schedule would have
Note that the calculator models each month as having 31 days.
2. The standard simplification of a geometric series is given