본문으로 건너뛰기

레슨 17 · Discrete Dynamical Models

Difference Equations and Their Solutions

Solve linear difference equations x(n+1) = r x(n) + b in closed form, find equilibria and stability, price a loan, and meet Fibonacci and the golden ratio.

When time moves in steps, the language of change is the difference equation: a rule linking each value to the ones before it. In this lesson you will master the most important case, the linear rule, because it is both common and completely solvable. Knowing it well also prepares you for the nonlinear ones in the next lesson.

What you will learn

  • How to solve xₙ₊₁ = r xₙ + b with a closed formula
  • How to find the equilibrium and decide whether it is stable
  • How to build and use a loan model
  • How second-order rules such as Fibonacci lead to the golden ratio

Key terms

Difference equation (recurrence): a rule that expresses xₙ₊₁ using earlier values.

Closed form: a formula for xₙ that needs no earlier values.

Equilibrium (fixed point) x*: a value with f(x*) = x*.

Stable equilibrium: nearby starting values move toward it as n grows.

Amortization: paying off a loan with regular instalments.

The pure growth rule

The simplest rule is xₙ₊₁ = r xₙ. Apply it repeatedly: x₁ = r x₀, x₂ = r² x₀, and so xₙ = x₀ rⁿ. This is geometric growth or decay, depending on r:

  • r > 1: grows without bound
  • r = 1: stays constant
  • 0 < r < 1: decays toward 0
  • −1 < r < 0: decays toward 0 while flipping sign each step
  • r < −1: grows while flipping sign
Three sequences starting at 1 with r = 1.2 growing, r = 1 constant and r = 0.8 decaying, next to the solution x(n) = x0 r^n
The value of r decides the whole story for the linear rule.

Adding a constant: x(n+1) = r x(n) + b

Real systems add or remove a fixed amount each step: a monthly deposit, a loan payment (negative b), immigration, harvesting. The rule becomes xₙ₊₁ = r xₙ + b.

Step 1: find the equilibrium. Set x* = r x* + b, so x* = b / (1 − r) (when r ≠ 1).

Step 2: measure distance from equilibrium. Let dₙ = xₙ − x*. Then

dₙ₊₁ = xₙ₊₁ − x* = (r xₙ + b) − (r x* + b) = r (xₙ − x*) = r dₙ

The distance obeys the pure rule, so dₙ = r^n d₀. Therefore

xₙ = x* + rⁿ (x₀ − x*)

Stability. If |r| < 1, rⁿ → 0 and the sequence converges to x* (stable). If |r| > 1 it runs away (unstable).

Example: xₙ₊₁ = 0.8 xₙ + 4. Here x* = 4/(1 − 0.8) = 20. From x₀ = 100: xₙ = 20 + 80 · 0.8ⁿ. From x₀ = 0: xₙ = 20 − 20 · 0.8ⁿ. Both approach 20.

Python Closed form versus iteration

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Starting at the equilibrium (x₀ = 20) the sequence never moves, which is exactly what "fixed point" means.

Case study: a loan

You borrow B₀ at monthly interest rate i and repay P each month. Interest is added to the balance, then you pay:

Bₙ₊₁ = (1 + i) Bₙ − P

This is our rule with r = 1 + i and b = −P. The "equilibrium" is x* = P/i: the balance at which interest exactly cancels the payment. Because r > 1, it is unstable. If B₀ < P/i, the balance falls to zero (the loan is repaid); if B₀ > P/i, the balance grows forever. Solving for zero balance after N payments gives the standard instalment formula:

P = B₀ i / (1 − (1 + i)^(−N))

With B₀ = 10,000, i = 0.5% per month (6% a year, compounded monthly) and N = 60 months, the payment is about 193.33. Check it with a simulation, and look at how each payment splits into interest and principal. (This is an arithmetic model, not financial advice. Real loans have fees and differences in how interest is quoted.)

Python Loan model: instalment and the interest/principal split

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Second-order rules: Fibonacci

Some rules use the two previous values. The Fibonacci sequence Fₙ₊₁ = Fₙ + Fₙ₋₁ (from Leonardo of Pisa's rabbit puzzle, 1202) is the famous one. Try a solution of the form Fₙ = λⁿ. Substituting gives λ² = λ + 1, the characteristic equation, with roots

λ = (1 ± √5) / 2, i.e. φ ≈ 1.618 (the golden ratio) and ψ ≈ −0.618.

The general solution is Fₙ = A φⁿ + B ψⁿ, and fitting F₀ = 0, F₁ = 1 gives Binet's formula Fₙ = (φⁿ − ψⁿ)/√5. Since |ψ| < 1, the second term fades and Fₙ grows like φⁿ: the ratio of consecutive terms tends to the golden ratio.

Iteration also solves equations. Newton's method for √2 uses the rule xₙ₊₁ = (xₙ + 2/xₙ)/2, whose fixed point is √2. The sequence converges extremely fast, roughly doubling the number of correct digits each step.

Python Fibonacci ratios and Newton's square-root rule

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Common misconceptions

"A closed form is always better." It is great for insight, but when no closed form exists (the logistic map, next lesson) simulation is the honest tool.

"If r is close to 1, nothing much happens." Small differences compound. With r = 1.01 over 100 steps the value grows by a factor of about 2.7; with r = 0.99 it shrinks to about 0.37.

"The loan equilibrium P/i is where the loan ends." It is the unstable balance where interest equals the payment. Below it, you pay off; above it, you fall further behind.

Check your understanding

Quick check · 5 questions

of 5 answered You scored / 5 · perfect!

  1. 1. The closed form of x(n+1) = r x(n) with x(0) = x0 is:

    Each step multiplies by r, so after n steps the factor is r^n.
  2. 2. For x(n+1) = 0.5 x(n) + 3, what is the equilibrium?

    x* = b / (1 - r) = 3 / 0.5 = 6.
  3. 3. An equilibrium of x(n+1) = r x(n) + b with r = -0.5 is:

    |r| = 0.5 < 1, so the distance from equilibrium shrinks, flipping sign each step.
  4. 4. In the loan model B(n+1) = (1 + i) B(n) - P, the 'equilibrium' P/i is:

    Here r = 1 + i > 1, so deviations grow. That is why a loan is either paid off or snowballs.
  5. 5. Which number does F(n+1)/F(n) approach for Fibonacci numbers?

    The dominant root of lambda^2 = lambda + 1 is (1 + sqrt 5)/2, about 1.618.

Summary

  • xₙ₊₁ = r xₙ gives xₙ = x₀ rⁿ; the size of r decides growth, constancy or decay.
  • xₙ₊₁ = r xₙ + b has equilibrium x* = b/(1 − r) and solution xₙ = x* + rⁿ (x₀ − x*); it is stable when |r| < 1.
  • A loan is the same rule with r = 1 + i and b = −P; its instalment formula comes from requiring zero balance after N payments.
  • Second-order rules use a characteristic equation; Fibonacci gives the golden ratio.

Next: The Logistic Map and Chaos

진행 상황 기록

무료 계정을 만들면 레슨을 체크하고, 어떤 기기에서든 하던 곳부터 이어 학습할 수 있어요.