Skip to content

Numerical Methods - Euler's Method

You will learn how to use Euler’s method to numerically approximate solutions to differential equations, understand its limitations, and know when to use it.

Many differential equations cannot be solved exactly. Euler’s method gives a simple way to approximate the solution numerically.

For the initial value problem

dydx=f(x,y),y(x0)=y0\frac{dy}{dx} = f(x, y), \quad y(x_0) = y_0

we start at the known point and take small steps of size hh:

yn+1=yn+hf(xn,yn)y_{n+1} = y_n + h \cdot f(x_n, y_n) xn+1=xn+hx_{n+1} = x_n + h

Each step uses the current slope to move forward a small distance hh. Smaller hh gives better accuracy but requires more computation.

The visual compares the exact solution (blue curve) with Euler’s method using a large step size (orange, visibly drifting) and a small step size (green, hugging the exact curve). The staircase pattern shows how each Euler step uses a straight-line approximation.

Example 1: Basic Euler Approximation

Use Euler’s method with h=0.5h = 0.5 to approximate y(2)y(2) for dydx=y\frac{dy}{dx} = y, y(0)=1y(0) = 1.

Solution: Step 0: x=0x = 0, y=1y = 1 Step 1: y1=1+0.5(1)=1.5y_1 = 1 + 0.5(1) = 1.5 Step 2: y2=1.5+0.5(1.5)=2.25y_2 = 1.5 + 0.5(1.5) = 2.25 Step 3: y3=2.25+0.5(2.25)=3.375y_3 = 2.25 + 0.5(2.25) = 3.375 Step 4: y4=3.375+0.5(3.375)=5.0625y_4 = 3.375 + 0.5(3.375) = 5.0625

Euler gives y(2)5.06y(2) \approx 5.06. Exact: e27.39e^2 \approx 7.39. Large hh causes significant error.

Example 2: Smaller Step Size

With h=0.25h = 0.25 (8 steps to reach x=2x = 2), Euler gives y(2)6.10y(2) \approx 6.10. Much closer to 7.39.

Example 3: Applied Problem

A population satisfies dPdt=0.5P(1P/1000)\frac{dP}{dt} = 0.5P(1 - P/1000), P(0)=100P(0) = 100. Using h=1h = 1 for 5 steps:

Step 1: P1=100+10.5(100)(0.9)=145P_1 = 100 + 1 \cdot 0.5(100)(0.9) = 145 Step 2: P2=145+10.5(145)(0.855)207P_2 = 145 + 1 \cdot 0.5(145)(0.855) \approx 207 …continuing yields the numerical trajectory.

Euler’s method (and its more accurate cousins like Runge-Kutta) is used constantly in computer simulations: video game physics, weather forecasting, pharmacokinetic modeling (drug levels in the body), aircraft flight simulators, and population dynamics. When systems are too complex for exact solutions, numerical methods are the only practical way forward.

Euler's method approximates the solution by:
Smaller step size $h$ in Euler's method generally:
The update formula in Euler's method is:
Euler's method is most useful when:
The main limitation of basic Euler's method is: