Consider the differential equation dy dx = 2x, with initial condition y(0) = 1. (a) Use Euler’s method with two steps to estimate y when x = 1. Now use four steps. (b) What is the formula for the exact value of y? (c) Does the error in Euler’s approximation behave as predicted?
The Correct Answer and Explanation is:
Answer:
Given the differential equation: dydx=2x,y(0)=1\frac{dy}{dx} = 2x, \quad y(0) = 1
(a) Euler’s Method
Euler’s formula: yn+1=yn+hf(xn,yn)y_{n+1} = y_n + h f(x_n, y_n)
Two steps (h = 0.5):
Step size: h=1−02=0.5h = \frac{1 – 0}{2} = 0.5
Initial: x0=0,y0=1x_0 = 0, y_0 = 1
- Step 1:
x1=0.5x_1 = 0.5,
y1=y0+h⋅f(x0,y0)=1+0.5⋅2(0)=1y_1 = y_0 + h \cdot f(x_0, y_0) = 1 + 0.5 \cdot 2(0) = 1 - Step 2:
x2=1x_2 = 1,
y2=y1+0.5⋅f(0.5,y1)=1+0.5⋅2(0.5)=1+0.5=1.5y_2 = y_1 + 0.5 \cdot f(0.5, y_1) = 1 + 0.5 \cdot 2(0.5) = 1 + 0.5 = 1.5
Estimate with 2 steps: y(1)≈1.5y(1) \approx 1.5
Four steps (h = 0.25):
Step size: h=0.25h = 0.25
- Step 1: x1=0.25x_1 = 0.25,
y1=1+0.25⋅2(0)=1y_1 = 1 + 0.25 \cdot 2(0) = 1 - Step 2: x2=0.5x_2 = 0.5,
y2=1+0.25⋅2(0.25)=1+0.125=1.125y_2 = 1 + 0.25 \cdot 2(0.25) = 1 + 0.125 = 1.125 - Step 3: x3=0.75x_3 = 0.75,
y3=1.125+0.25⋅2(0.5)=1.125+0.25=1.375y_3 = 1.125 + 0.25 \cdot 2(0.5) = 1.125 + 0.25 = 1.375 - Step 4: x4=1x_4 = 1,
y4=1.375+0.25⋅2(0.75)=1.375+0.375=1.75y_4 = 1.375 + 0.25 \cdot 2(0.75) = 1.375 + 0.375 = 1.75
Estimate with 4 steps: y(1)≈1.75y(1) \approx 1.75
(b) Exact Solution:
Integrate dydx=2x\frac{dy}{dx} = 2x: y=∫2x dx=x2+Cy = \int 2x \, dx = x^2 + C
Use initial condition y(0)=1y(0) = 1: 1=02+C⇒C=1⇒y=x2+11 = 0^2 + C \Rightarrow C = 1 \Rightarrow y = x^2 + 1
So, y(1)=12+1=2y(1) = 1^2 + 1 = 2
(c) Error Behavior:
Euler’s method is a first-order method, and its global error is proportional to the step size hh.
- 2 steps (h = 0.5): estimate = 1.5 → error = 0.5
- 4 steps (h = 0.25): estimate = 1.75 → error = 0.25
As expected, halving the step size approximately halves the error. This confirms the first-order error behavior: Error∝h\text{Error} \propto h
Explanation (300 words):
Euler’s method is a straightforward numerical technique to approximate solutions of first-order differential equations. In this case, the differential equation dydx=2x\frac{dy}{dx} = 2x with the initial value y(0)=1y(0) = 1 models a curve whose slope at each point depends only on the x-coordinate. To approximate the value of y when x = 1, we use Euler’s method with different step sizes.
With two steps, the interval from 0 to 1 is divided into two subintervals of size 0.5. At each step, we calculate the slope 2x2x and update the y-value accordingly. This gives us an approximate value of y(1)≈1.5y(1) \approx 1.5. Increasing the number of steps to four (reducing step size to 0.25), the approximation improves to y(1)≈1.75y(1) \approx 1.75. This aligns with the expectation that smaller step sizes yield more accurate approximations.
The exact solution, obtained by integrating dydx=2x\frac{dy}{dx} = 2x, is y=x2+1y = x^2 + 1, which gives y(1)=2y(1) = 2. Comparing this with the approximations shows the absolute error decreases as we refine the step size.
Euler’s method is a first-order method, meaning the global error decreases linearly with the step size. This is demonstrated here: halving the step size (from 0.5 to 0.25) approximately halves the error (from 0.5 to 0.25). Thus, the method behaves as theoretically predicted, offering a useful but limited tool for approximating solutions when analytical solutions are difficult or impossible to obtain.
