A single loan can be modeled with "principal at period i" **P _{i}**, "interest rate over that 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 series^{2}, we find

With this we can solve for **n** when **P _{i} = 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 **q _{i}'[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 **q _{i}'[0]**. 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 **w _{i}** that we can compare to

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