[net.sources] Bi-Monthly Mortgage Payments

dennis@rlgvax.UUCP (Dennis Bednar) (11/14/85)

Recently there was some discussion in na.consumer about if you paid
a mortgage off with bi-monthly payments, instead of monthly payments,
then you could pay off a 30 year mortgage in something like 12 years,
and on the average, pay about the same amount per month.

I don't believe that the wild claim was valid, and am submitting
a mortgage.c program that I personally use.

Enjoy.

-------------- CUT HERE -------------------
#!/bin/sh
# this is a shell archive file
echo x - mortgage.c
cat << '\SHAR_EOF' >mortgage.c
/*
 * f=mortgage.c
 * author - dennis bednar  aug 1 83
 *	11/13/85 - asks for number of payments per year.  To see if
 *	the following claim from USENET was actually true:
From: marks@yogi.DEC
Newsgroups: net.consumers
Subject: Semi-monthly mortgage repayments
Date: 12 Nov 85 14:02:42 GMT
Organization: Digital Equipment Corporation

I have recently read about a new type of real estate mortgage agreement,
in which the bank gives the buyer a mortgage at the normal insterest
rate for, say, a 30-year, fixed-rate mortgage, but allows the mortgagor
to pay off the loan semi-monthly rather than once a month.  The total
monthly payments are the same, they are just split in half and paid
twice a month.

The incredible part of this is that you manage to reduce your interest
so much by paying the loan semi-monthly, that you end up paying only a
fraction of the total interest you would otherwise have paid, while
expending the same amount of money per month, and you pay off what would
have been a 30 year mortgage in something like 12 years.

Clearly, this system benefits the consumer greatly, but banks are not
exactly rushing to sign people up under this system.  The only advantage
I can see from the bank's point of view is that the bank has the loan
repaid in a much shorter period of time than it otherwise would.  Of course,
it is losing lots of interest money on the deal.

My question is this:  does anyone know of any banks that are doing this?
I live in the Boston area, but the closest bank I have found that does 
this type of mortgage is the Hudson City National Bank in Chatham, N.Y.
(upstate).  Seems like a great deal to me.  Wonder how the banks could
be convinced.

R.M.
 *
 *
 * Theory behind the program:
	We need to find the monthly mortgage payments, given
	the principle, the yearly interest, and the number of years.

	Let
	npy = number of payments per year, usually 12 or monthly
	p = principle (amount borrowed, cost of house minus down payment)
	r = 1 + percent per month (e.g, for 12%yr, r would be 1.01)
	11/13/85 r has been generalized a bit:
[	r = interest rate per payment, obtained by yrly_interest/num_pay_per_year ]
	m = monthly mortgage payment
	n = total number of payments (number of years * npy)

	Then,
	after one month you owe		p*r - m
	since your principle went up by p*r, but you paid m.
	after two months you owe	(p*r - m)*r - m
					=p*(r**2) - m*r - m
	after 3 months you owe		(two months owe)*r - m
					=p*(r**3) - m*(r**2) - m*r - m
					=p*(r**3) -m*(r**2 + r + 1)

	continuing after n months
	you would owe			p*(r**n) - m*[r**(n-1) + ... + r + 1]
								(1)

	But after the nth payment you should owe nothing, so we have the
	following equation to solve for m:

	p*(r**n) - m*(r**(n-1) + ... + r + 1) = 0		(2)

	The usual mathematical trick is to multiple both sides of (2)
	by r, and then subtract one from the other.
	Here (3) is created by multiplying by r, and (4) is
	obtained by subtracting (2) from (3):

	p*(r**(n+1)) - m*(r**n + ... + r**2 + r) = 0		(3)
	p*(r**(n+1)) - p*(r**n) - m*(r**n) + m = 0		(4)

	Solving for m we have (5)

	    p*(r**(n+1)) - p*(r**n)
	m = ------------------------ 		(5)
            (r**n) - 1


	The amount paid of the principle after n payments is

	p - [ p*(r**n) - m*s]			(6)

	where

	s = r**(n-1) + r**(n-2) + ... + r**2 + r + 1	(7)

	since (6) is the principle (p) minus the amount owed after
	n payments (in brackets), and (7) is seen in expression (1)

	Similarly solving for s by multiplying both sides of (7)
	by r and subtracting, we obtain (8):

	s = (1 - r**n) / (1 - r)		(8)
 */

#include <math.h>
#include <stdio.h>

/* forward references */
double mortgage ();		/* compute monthly mortgage */
double power ();		/* raise double to int power */


typedef int BOOLEAN;
#define TRUE 1
#define FALSE 0

/* if should print debug statements */
BOOLEAN debug;

main (argc, argv)
int argc;
char **argv;
{
double p,	/* principle */
	i,	/* interest per year */
	m;	/* monthly mortage payment */
int	y,		/* number of years */
	npy,		/* number of payments per year */
	j;		/* loop counter */

/* set global debug flag */
if (argc != 1)	/* more than one arg */
	debug = TRUE;

printf ("\nmortgage payments\n\n");

/* get data input */
fprintf (stderr, "borrowed (principle)?");
scanf ("%f", &p);
printf ("borrowed (principle) = %.2f\n", p);

fprintf (stderr, "yearly interest?");
scanf ("%f", &i);
printf ("yearly interest = %f\n", i);

fprintf (stderr, "number of years?");
scanf ("%d", &y);
printf ("number of years = %d\n", y);

fprintf (stderr, "number of payments per year?");
scanf( "%d", &npy);
printf ("number of payments per year = %d\n", npy);


/* compute amount paid for each (usu. monthly) mortgage payment */
m = mortgage (p, i, y, npy);		/* mortage function of prin, int, years, nr payments per year */
printf ("\n\n");
printf ("each payment will be %f (Principle + Interest Only)\n", m);
printf ("avg monthly payment will be %f (Principle + Interest Only)\n", (m*npy)/12);

#if 0
/* print out mortgages for different yearly loans (same prin, int) */
printf ("\n\n");
printf ("payment for different number of years (same interest rate):\n");
printf ("years\tmonthly mortgage\n");
for (j = 10; j <= 30; ++j)
	printf ("%d\t%f\n", j, mortgage (p, i, j));	/* years, amount */



/* print out mortgages for different interest rates */
printf ("\n\n");
printf ("payment for different interest rates (same number of years):\n");
printf ("int\tmortgage\n");
{	double rj;
for (rj = 10; rj <= 20; rj += .25)
	printf ("%.2f\t%f\n", rj, mortgage (p, rj, y));
}	/* done with rj */
#endif

/* print out mortgages in table form, diff years on horizontal,
 * different interest rates on vertical.
 */
{
#define HORIZ (sizeof(yrtbl)/sizeof(yrtbl[0]))
	double ir;	/* interest rate */
	static int yrtbl [] = {1, 5, 10, 15, 20, 25, 30 };
	int yi;		/* index into number of years table */

	printf ("\n\n");
	printf ("Borrow Same Amount, At Different Rates, Different Number of Years\n");
	printf ("\t\t\t\tYears\n");
	printf ("Int. ");
	for (yi = 0; yi < HORIZ; yi++)
		printf (" %9d", yrtbl[yi]);
	printf ("\n");

	for (ir = 4; ir <= 25; ir += .25)
		{
		printf ("%5.2f", ir);		/* formats up to 99.99  */
		for (yi = 0; yi < HORIZ; ++yi)
			printf (" %9.2f", mortgage (p, ir, yrtbl[yi]), npy );
		printf ("\n");
		}
}


/* print out how much is total and % of principle at end of each year */
printf ("\n\n");
printf ("$%.2f for %d years @ %.2f interest\n", p, y, i);
printf ("Future Outlook:\n");
printf ("\t   total\t   percent\n");
printf ("year\tprinciple paid\tprinciple paid\ttotal paid");
printf ("\tinterest this yr\n");
{	double cpp;		/* cum principle paid for prev years */
	double s,		/* makes eval easier*/
		pp,		/* principle paid off */
		r;		/* interest rate per month (1.01 is 12%yr) */
	int	n;		/* total number of payments */

for (j = 1, cpp = 0; j <= y; ++j)
	{
	r = 1 + i / (npy *100);
	n = j * npy;		/* number of payments over this many years */
	s = (1 - power (r,n)) / (1 - r);
	/* principle paid = total principle - amount of prin owe */
	pp =  p - ( p * power (r, n) - m * s);	/* principle paid after n payments */
	printf ("%d\t%f\t%f\t%f\t%f\n", j,	/* years */
		pp,			/* principle paid off */
		pp/(p),			/* percent of principle paid off */
		m * (double) npy * (double) j,	/* total paid */
		m * npy - (pp - cpp));	/* amount of int this year */

	/* update cumulative principle paid after this year */
	cpp = pp;
	}	/* for */
}	/* auto vars */
}	/* main */

double mortgage (p, i, y, npy)
double p,	/* principle */
	i;	/* yearly interest */
int	y;	/* number of years */
int	npy;	/* number of payments per year */
{

double	r;	/* interest rate per payment */
int	n;	/* number of payments */

double num,	/* numerator of expression */
	den;	/* denominator of expression */

/* compute r as 1 + percent per payment per year (usually monthly) */
r = 1 + i/(npy*100);
/* 12 months per year, divide by 100 to get percent */
if (debug)
	printf ("%f\n", r);

/* compute total number of payments */
n = y * npy;
if (debug)
	printf ("%d\n", n);

/* compute monthly mortgage */
/* first the numerator */
num = p * power (r, n+1) - p * power (r, n);
if (debug)
	printf ("num = %f\n");

/* then denominator */
den = power (r, n) - 1;
if (debug)
	printf ("den = %f\n", den);

/* monthly mortgage */
return (num/den);
}




/*
 * raise 1st arg to 2nd power
 * see pg 23 of The C Programming Language
 */
double power (x, n)
double x;
int n;
{
	int i;
	double p;

	p = 1;
	for (i = 1; i <= n; ++i)
		p = p * x;
	return (p);
}
\SHAR_EOF
-- 
Dennis Bednar	Computer Consoles Inc.	Reston VA	703-648-3300
{decvax,ihnp4,harpo,allegra}!seismo!rlgvax!dennis