Application Center - Maplesoft

# Amortizing a loan

You can switch back to the summary page by clicking here.

0303.mws

Module 3 : Finite Mathematics

303 : Amortizing A Loan

O B J E C T I V E

We will continue with defining financial functions and show how they can be used to analyze amortization situations numerically and graphically. We will also look at graphs showing how much principal and interest are being at any given time as a loan is being paid off.

S E T U P

In this project we will use the following command packages. Type and execute this line before begining the project below. If you re-enter the worksheet for this project, be sure to re-execute this statement before jumping to any point in the worksheet.

> restart; with(plots):

```Warning, the name changecoords has been redefined
```

___________________________________________________________________________________

A. Amortized Loan Payments

___________________________________________________________________________________

COMPUTING THE PAYMENT

First we define a financial function to give us the monthly payment for an amortized loan.

> Monthly_Payment := (Principal,annual_rate, years) ->
Principal*annual_rate/ (12*(1-(1+annual_rate/12)^(-12*years)));

The inputs to this function are the principal of the loan, the annual percentage interest rate in decimal form and the number of years to pay it off. The result is the amount of the monthly payment.

Here is an example of a loan of \$165,000 @ 7.375% for 30 years.

> Monthly_Payment(165000, .07375 , 30);

___________________________________________________________________________________

B. How Does Interest Rate Affect Payments?

___________________________________________________________________________________

How does the interest rate affect the payment? If we fix a loan amount of \$165,000 and repayment period of 30 years, we can create a graph which will illustrate the relationship.

> plot( [0, Monthly_Payment( 165000, x, 30)],
x = .06..(.09), labels = [`interest rate`, `monthly payment` ]);

We can see that as interest rates increase, payments increase also in an essentially linear relationship.

___________________________________________________________________________________

C. How Big of A Mortgage Can You Afford?

___________________________________________________________________________________

The first question a home buyer needs to ask is How big of a mortgage loan can I afford? We can answer this question knowing the prevailing interest rate, the length of the loan, and a comfortable payment for the buyer. Lets say that a buyer is comfortable paying \$1,000 per month and get a loan at 7.375% for 30 years.

> fsolve( Monthly_Payment(x, .07375, 30) = 1000,x);

___________________________________________________________________________________

D. How Do Interest Rates Affect Payments?

___________________________________________________________________________________

For a given interest rate, plot the mortgage versus the payment amount.

For a given interest rate, plot mortgage vs. payment.

> plot( solve( Monthly_Payment(y, .07375, 30) = x, y), x = 900..1200,
labels = [payment, mortgage]);

Often when interest rates go down, home prices go up. This occurs because lower interest rates mean more people can afford more expensive homes. There is an inverse relationship between interest rate and mortgage amount if payment and repayment period are fixed. For example, let's consider a payment of \$1,200 per month for 30 years.

> array( [ seq( [ evalf(6+k/4,4),fsolve(Monthly_Payment( P, (6+k/4)/100,30)=1200 )], k = 0..12)]);

This gives a table which shows interest rates from 6% to 9% in 1/4% increments and the corresponding mortgage amount.

___________________________________________________________________________________

E. Payoff of A Loan

___________________________________________________________________________________

When you pay off a mortgage loan, part of your payment reduces the principal and part is interest. But how much the payment goes toward each?

The answer will turn out to vary month by month. This is important because when you have a home loan you can get a tax write-off only for the portion of your payment that is interest. The part of the payment which is paying off principal is not a tax deduction.

To answer this question, we will create a special graph function called " payoff ".

> restart;
payoff := proc( principal, annual_interest_rate, years)
local monthly_rate,payment_no,new_princ, payment,n,po,ip, x1,x2, y1,y2, y3,intpaid;
new_princ := principal;
monthly_rate := evalf(annual_interest_rate/1200);
payment := principal*monthly_rate/(1-(1+monthly_rate)^(-12*years));
n := 12*years; x2 := 0;
for payment_no from 1 to n do
intpaid := new_princ*monthly_rate; new_princ := new_princ - payment + intpaid;
x1 := x2; x2 := evalf(payment_no/12,4);
ip[payment_no] := plots[polygonplot]( [[x1,0],[x1,intpaid],[x2, intpaid],[x2,0]],
color = blue, style=patchnogrid );
if (payment_no = round(3*years)) then y1:= intpaid;fi;
if (payment_no = round(6*years)) then y2:= intpaid;fi;
if (payment_no = round(9*years)) then y3:= intpaid;fi;
od;
plots[display]( seq( ip[i], i = 1..n),
plot( {payment, [[n,0],[n,payment]]},x = 0..years, thickness = 2, color = red),
plot( {y1,y2,y3},x = 0..years,thickness = 1, color = green),
plot({ [[years,0],[years,payment]],[[years/4,0], [years/4,payment]],
[[years/2,0],[years/2,payment]],[[3*years/4,0],[3*years/4,payment]]},
x = 0..years, thickness = 1, linestyle = 2, color = coral),
plots[textplot]([evalf(years/4),y1, cat(convert(evalf(100*y1/payment,4) ,string),"%")],
align={ABOVE,RIGHT},font=[HELVETICA,BOLD,12]),
plots[textplot]([evalf(years/2),y2,cat(convert(evalf(100*y2/payment,4) ,string),"%")],
align={ABOVE,RIGHT},font=[HELVETICA,BOLD,12]),
plots[textplot]([evalf(3*years/4),y3, cat(convert( evalf(100*y3/payment,4)
,string),"%")],align={ABOVE,RIGHT},font=[HELVETICA,BOLD,12]) );
end:

Lets see how it works. Lets take a mortgage amount of \$177,00 for 30 years @ 7 5/8%.

> payoff( 177000, 7 + 5/8, 30);

Here is a loan of \$32,000 for 30 years @ 10.25%.

> payoff( 32000, 10.25, 8);

>