Lesson 4: Euler's Method for Numerical Approximation
Estimated time: 30-35 minutes
Learning Objectives
By the end of this lesson, you will be able to:
- Explain the geometric idea behind Euler's method
- Apply the Euler iteration formula to approximate solutions step by step
- Organize computations in a table
- Understand how step size affects accuracy
- Recognize the limitations of Euler's method
Why Numerical Methods?
Most differential equations that arise in practice cannot be solved analytically. Even a simple-looking equation like dy/dx = e-x² + y has no closed-form solution. Numerical methods let us compute approximate values of the solution at discrete points.
Euler's method is the simplest numerical method. While more sophisticated methods (Runge-Kutta, etc.) are used in practice, Euler's method beautifully illustrates the core idea that all numerical ODE solvers share.
The Euler Iteration
Euler's Method: Given the IVP dy/dx = f(x, y), y(x0) = y0, and a step size h:
xn+1 = xn + h
yn+1 = yn + h · f(xn, yn)
Starting from the known point (x0, y0), each step follows the tangent line for a distance h to produce the next approximate point.
Geometric Interpretation
At each step, Euler's method approximates the true solution curve with a straight line (the tangent). You walk along the tangent for a short distance h, arrive at a new point, recalculate the slope, and repeat. Smaller h means shorter tangent segments and a better approximation of the curve.
Worked Examples
Example 1: Euler's Method with h = 0.1
Approximate y(0.3) for the IVP: dy/dx = x + y, y(0) = 1, using h = 0.1.
Solution: We need 3 steps to go from x = 0 to x = 0.3.
| n | xn | yn | f(xn,yn) = xn+yn | h · f |
|---|---|---|---|---|
| 0 | 0 | 1 | 0 + 1 = 1 | 0.1 |
| 1 | 0.1 | 1.1 | 0.1 + 1.1 = 1.2 | 0.12 |
| 2 | 0.2 | 1.22 | 0.2 + 1.22 = 1.42 | 0.142 |
| 3 | 0.3 | 1.362 | -- | -- |
Euler approximation: y(0.3) ≈ 1.362.
The exact solution is y = 2ex - x - 1, giving y(0.3) = 2e0.3 - 0.3 - 1 ≈ 1.3997. The error is about 0.038, or roughly 2.7%.
Example 2: Euler's Method with h = 0.5
Approximate y(1) for the IVP: dy/dx = y, y(0) = 1, using h = 0.5.
Solution: We need 2 steps.
| n | xn | yn | f = yn | h · f |
|---|---|---|---|---|
| 0 | 0 | 1 | 1 | 0.5 |
| 1 | 0.5 | 1.5 | 1.5 | 0.75 |
| 2 | 1.0 | 2.25 | -- | -- |
Exact: y(1) = e1 ≈ 2.7183. Euler gives 2.25. Error ≈ 0.47 (17%). The large step size produces a poor approximation.
With h = 0.1 (10 steps), Euler gives y(1) ≈ 2.5937, much closer. With h = 0.01 (100 steps), y(1) ≈ 2.7048. Smaller h gives better accuracy.
Example 3: More Steps for Better Accuracy
For dy/dx = -2xy, y(0) = 1, approximate y(0.2) using h = 0.1 (2 steps).
Solution:
Step 0: (x0, y0) = (0, 1). f(0, 1) = -2(0)(1) = 0.
y1 = 1 + 0.1(0) = 1. x1 = 0.1.
Step 1: f(0.1, 1) = -2(0.1)(1) = -0.2.
y2 = 1 + 0.1(-0.2) = 1 - 0.02 = 0.98. x2 = 0.2.
Euler approximation: y(0.2) ≈ 0.98.
The exact solution is y = e-x², giving y(0.2) = e-0.04 ≈ 0.9608. The Euler estimate is close.
Error and Step Size
Euler's method has a local truncation error of order O(h²) per step. Over a fixed interval, the accumulated global error is O(h). This means:
- Halving h roughly halves the global error.
- To get one more decimal place of accuracy, you need about 10 times as many steps.
- More sophisticated methods (like the 4th-order Runge-Kutta) achieve O(h4) global error, which is why they are preferred in practice.
Check Your Understanding
1. Use Euler's method with h = 0.1 to take ONE step for dy/dx = 3x², y(1) = 2. Find y1.
2. For dy/dx = y, y(0) = 1, with h = 1 (one step), what is the Euler estimate for y(1)?
3. If you halve the step size in Euler's method, roughly by what factor does the global error decrease?
4. Use Euler with h = 0.5: dy/dx = -y, y(0) = 4. Find y(1) in 2 steps.
5. What is the geometric interpretation of one Euler step?
Key Takeaways
- Euler's method approximates solutions by stepping along tangent lines: yn+1 = yn + h f(xn, yn).
- Smaller step size h gives better accuracy but requires more computation.
- The global error is O(h) -- first-order accurate.
- Organize your work in a table with columns for n, xn, yn, f(xn, yn), and h · f.
- Euler's method illustrates the core idea of all numerical ODE solvers: follow the slope locally, then correct and repeat.
Module 1 Complete!
Practice Problems
Test your skills on all Module 1 topics with 10 practice problems.
Practice Problems