Module 2 · Financial Arithmetic, Time Value, and Returns Lesson 19 of 120

Arithmetic versus Geometric Average Return

Choosing an average that answers the actual return question.

2:36 clip58:28–1:01:04 in the full courseWatch on YouTube

Transcript

21 sentences · select one to jump there

Check your understanding

Which average reproduces this compounded endpoint when repeated?

Choose one answer

Code lab

Run it yourself

The lesson source in 7 languages. Edit it, run TypeScript and Python right here, and compare with the expected output.

019-arithmetic-versus-geometric-average-return.ts
Start from GitHub
/**
 * Fintech Math Bootcamp · Lesson 019 of 120
 * Arithmetic versus Geometric Average Return
 * Module 02: Financial Arithmetic, Time Value, and Returns
 *
 * Scenario: Choosing an average that answers the actual return question
 * Rule:     AM = mean(R); GM = Π(1+R)^(1/n) − 1
 *
 * Try it:   Which average reproduces this compounded endpoint when repeated?
 *
 * Lesson article: https://thefintechbuilder.com/financial-mathematics-statistics-and-data-foundations/financial-arithmetic-time-value-and-returns/arithmetic-geometric-return/
 * Free course:    https://courses.thefintechbuilder.com
 * Synthetic teaching example, not financial advice or a production library.
 */

export function lesson019() {
  const rs = [0.20, -0.20];
  const arithmetic = rs.reduce((a, r) => a + r, 0) / rs.length;
  const factor = rs.reduce((a, r) => a * (1 + r), 1);
  const geometric = factor ** (1 / rs.length) - 1;
  const result = {arithmetic, geometric};
  return result;
}

export const checkedResult = {"arithmetic":0,"geometric":-0.020204102886728803};

// Run this file directly: npx tsx lessons/02-financial-arithmetic-time-value-and-returns/019-arithmetic-versus-geometric-average-return.ts
if (process.argv[1] && import.meta.url.endsWith(process.argv[1].replace(/\\/g, "/").split("/").pop()!)) {
  console.log(JSON.stringify(lesson019(), null, 2));
}

Your output

Press Run to execute the code in your browser.

Expected output

{
  "arithmetic": 0,
  "geometric": -0.020204102886728803
}

Prefer your own machine? Every file is in the course repository · open it in Codespaces.

Lesson notes

The rule

AM = mean(R); GM = Π(1+R)^(1/n) − 1