Inspectable Arithmetic for the Pay Off Mortgage vs Invest Calculator (Cash-Flow Neutral)

Version 1.2
Last verified: May 2026

Transparent arithmetic is the operating system of this calculator.

This document publishes the full formulae, computational structure, and assumptions used to generate the outputs displayed on the calculator page.

No opinions. No hidden assumptions. Just arithmetic.

Purpose

This calculator compares mortgage paydown versus investing under explicit rules. The user chooses one of two mutually exclusive ways to supply discretionary cash in addition to the regular mortgage payment P:

The calculator reports mortgage balance, investment portfolio value, and net worth over time under constant return assumptions.

For the narrative framing behind the cash-flow-neutral comparison, see Pay Off Your Mortgage Faster or Invest?

Definitions

All accruals below are monthly time steps unless noted.

Inputs

Derived constants

Mortgage monthly rate:

i = (1 + (r/100) / 2)1/6 − 1

Canadian mortgage rates are generally quoted as nominal annual rates compounded semi-annually. The calculator converts the entered mortgage rate to an equivalent monthly rate before applying mortgage interest.

Net annual investment return (after fees):

Rnet = (R − f) / 100

Monthly geometric investment return:

μ = (1 + Rnet)1/12 − 1

(Clamped internally so that Rnet ≥ −0.999.)

Monthly budget used after the mortgage is paid off (same symbol in both modes):

Budget = P + E

In lump mode, E = 0, so Budget = P. In monthly mode, Budget = P + E.

Mode A: Mortgage Payment Computed From Mortgage Inputs

If Use mortgage calculator is enabled (the mode that reuses payment logic from the Canada Mortgage Calculator), the calculator computes the regular mortgage payment P using the standard amortization formula.

Let:

Then:

P = L/n if r = 0
P = L · i / (1 − (1+i)−n) if r > 0

The simulation then proceeds using B0 = L and that computed P.

Mode B: Mortgage Payment Entered Manually

If Use mortgage calculator is disabled, the user supplies: B0 (current mortgage balance), r (Canadian nominal annual mortgage rate), P (monthly payment). The payoff time becomes whatever amortizes under those values.

Fallback: If B0 ≤ 0 in manual mode, the engine estimates a principal from payment using a rough default (25 years, 5% Canadian nominal annual mortgage rate). This is a non-ideal fallback intended to keep the calculator functioning.

Core Simulation (Monthly Recurrence)

The simulation advances month-by-month for t = 1, 2, …, N. State at the end of month t is written Bt, Vt; month 0 records initial B0, V0 = 0.

Lump-sum pre-step (only month t = 1, only if S > 0)

If lump mode is active and S > 0, the engine applies the following before interest due and the scheduled payment for that month. Let B denote the mortgage balance at the start of the iteration (for t = 1, this is B0), and V the portfolio at the start of the iteration (for t = 1, this is V0 = 0).

Split the lump using the same slider a as for recurring extra:

SM = (1 − a/100) S   (portion intended for mortgage principal)
SI = (a/100) S   (portion intended for investing)

Extra principal from the lump cannot exceed the outstanding balance. Any mortgage-intended amount beyond what is needed to prepay the balance is redirected to the portfolio:

LumpPrincipal = min(max(0, SM), B)
Overflow = SM − LumpPrincipal

Update balance and portfolio before the rest of the month:

B′ = max(0, B − LumpPrincipal)
V′ = V + SI + Overflow

For t = 1, the simulation then continues using B′ and V′ as the starting balance and portfolio for that same month’s interest, mortgage payment, contributions, and compounding (below). For t > 1, this pre-step is skipped (S is not applied again).

Home value

Home value is compounded in monthly steps:

Ht = H0 · (1 + g/100)t/12

Equity and net worth (end of month)

Equityt = max(0, Ht − Bt)
NetWortht = Equityt + Vt

where Vt is investment portfolio value.

Case 1: Mortgage Still Outstanding at Start of Month t After Any Lump Pre-step

For t = 1, “Bt−1” in the interest formula below is the balance after the lump pre-step when S > 0 (i.e. B′ above); for t > 1 it is the prior month’s ending balance. The same applies to V when composing contributions.

Step 1 — Mortgage interest due

InterestDuet = Bt−1 · i

Step 2 — Intended mortgage payment

Regular payment always goes to the mortgage, plus the allocated portion of extra cash:

Mtintended = P + EM

But payment cannot exceed what is needed to close the mortgage this month:

Mtactual = min(Mtintended, Bt−1 + InterestDuet)

Step 3 — Principal paid and new balance

PrincipalPaidt = max(0, Mtactual − InterestDuet)
Bt = max(0, Bt−1 − PrincipalPaidt)

If Mtactual > 0, interest paid increments by InterestDuet.

Step 4 — Investment contribution while mortgage exists

The investment contribution has two parts: the allocated investing portion of extra cash EI, and any remainder from an over-large intended mortgage payment in the final payoff month:

Remaindert = Mtintended − Mtactual
Ct = EI + Remaindert

Step 5 — Investment update (contribution first, then compound)

Vt′ = Vt−1 + Ct
InterestEarnedt = Vt′ · μ
Vt = Vt′ · (1 + μ)

Investment value is clamped to never go below zero. For t = 1 with S > 0, Vt−1 is the portfolio already increased by the lump pre-step (SI + Overflow).

Case 2: Mortgage Paid Off (Bt−1 ≤ 0)

Once the mortgage balance reaches zero (including after the lump pre-step), the engine invests the entire monthly budget:

Ct = Budget = P + E

In lump mode, E = 0, so each post-payoff contribution is Ct = P.

Then applies the same “contribution first, then compound” update:

Vt′ = Vt−1 + Ct
InterestEarnedt = Vt′ · μ
Vt = Vt′ · (1 + μ)

Reported Outputs

At the end of the horizon t = N, the calculator reports:

Key facts (extreme allocations)

The “Key facts” section computes two additional full simulations using identical inputs: 100% mortgage allocation (a = 0) and 100% investing allocation (a = 100). In monthly mode, that means all of E to mortgage versus all of E to investing. In lump mode, that means all of S to extra principal versus all of S to the portfolio at the start of month 1. The same recurrence (including the lump pre-step when applicable) is used.

Break-even gross return

The calculator may report a gross return R (before fees) at which the two extreme strategies tie at the horizon: a = 0 versus a = 100, holding all other inputs fixed. In monthly mode, both paths use the same E. In lump mode, both paths use the same S and E = 0. If there is no discretionary cash (E = 0 and S = 0), this quantity is not defined.

Assumptions

  1. All calculations are performed in monthly time steps.
  2. The entered mortgage rate is treated as a Canadian nominal annual mortgage rate compounded semi-annually, then converted to the equivalent monthly rate before interest is applied to the outstanding balance.
  3. Investment returns are modeled as constant and deterministic.
  4. Investment fees are modeled as a constant annual % subtracted from expected return, then converted to a monthly geometric return.
  5. Contributions are applied before investment growth each month (beginning-of-period contributions).
  6. In lump-sum mode, S is applied only once, at the beginning of month 1, before that month’s mortgage interest and scheduled payment; it is not repeated in later months.
  7. Home price growth is modeled as constant compounding at rate g (no volatility).
  8. Taxes, transaction costs, refinancing, prepayment penalties, and behavioral changes are not modeled unless explicitly added elsewhere.

Implementation Notes

Sources and References

If any discrepancy is identified between this documentation and the calculator output, the arithmetic in the engine governs.