Tutorials › Calculus I › Euler Approximation for Linear Scalar Equations

Euler's Method and Numerical Solutions · Tutorial 1429 of 1495

Euler Approximation for Linear Scalar Equations

Learn to compute and check Euler approximations for linear scalar equations, including when the coefficients are supplied in a table.

Advanced 9 min read

What You'll Learn

  • Write the forward Euler update for \(y'=a(t)y+b(t)\).
  • Evaluate time-dependent coefficients at the start of each step.
  • Use tabulated coefficients and nonuniform step sizes to compute approximations.
  • Track how the initial value and forcing terms contribute across several steps.
  • Check computed values and recognize a common error involving the forcing term.

Linear Equations and Euler Updates

A linear scalar differential equation has one dependent variable \(y\), and its derivative depends linearly on \(y\). In this tutorial, we consider equations of the form

$$ y'=a(t)y+b(t), $$

where \(a(t)\) and \(b(t)\) are specified functions of time. The term \(a(t)y\) depends on the current value of the solution; \(b(t)\) is a forcing term that can affect the solution even when \(y=0\). An initial-value problem also specifies a starting value, such as \(y(t_0)=y_0\).

Forward Euler replaces the derivative at the start of each step with the slope given by the differential equation. If the step begins at time \(t_n\), has length \(h_n\), and the current approximation is \(y_n\), evaluate the slope using \(y_n\) and the coefficients at \(t_n\). The next approximation is then obtained by adding the slope times the step length.

Forward Euler update for a linear scalar equation: If \(y'=a(t)y+b(t)\), then $$ y_{n+1}=y_n+h_n\bigl(a(t_n)y_n+b(t_n)\bigr) =\bigl(1+h_n a(t_n)\bigr)y_n+h_n b(t_n). $$ Here \(y_n\) approximates \(y(t_n)\), and \(t_{n+1}=t_n+h_n\). The coefficients are evaluated at the beginning of the step.

The update is explicit: once \(y_n\), \(t_n\), \(h_n\), and the coefficient values are known, it directly gives \(y_{n+1}\). It is useful to calculate in a consistent order: find the slope from the current approximation, multiply by the step size, and add that change to the current approximation.

Worked Example with Constant Coefficients

Worked Example: Three Steps with Constant Coefficients

Approximate the solution of \(y'=0.2y+1\), with \(y(0)=2\), using step size \(h=0.5\) for three steps.

At the first step, \(t_0=0\) and \(y_0=2\). The slope is

$$ a(t_0)y_0+b(t_0)=0.2(2)+1=0.4+1=1.4. $$

Therefore,

$$ y_1=2+0.5(1.4)=2+0.7=2.7. $$

At the second step, \(t_1=0.5\) and the current approximation is \(y_1=2.7\). The slope is \(0.2(2.7)+1=0.54+1=1.54\), so

$$ y_2=2.7+0.5(1.54)=2.7+0.77=3.47. $$

At the third step, \(t_2=1\) and \(y_2=3.47\). The slope is \(0.2(3.47)+1=0.694+1=1.694\), giving

$$ y_3=3.47+0.5(1.694)=3.47+0.847=4.317. $$

Check each update by subtracting the previous approximation and dividing by the step size. The three changes give \(0.7/0.5=1.4\), \(0.77/0.5=1.54\), and \(0.847/0.5=1.694\), exactly the slopes calculated from the differential equation at the respective starting values. Thus the Euler approximations are \(y_1=2.7\), \(y_2=3.47\), and \(y_3=4.317\).

Using Coefficients from a Table

When \(a(t)\) and \(b(t)\) are given in a table, use the entries at the start of each step. The table may provide coefficients only at the grid points, so it is important not to substitute values from the end of a step unless the problem explicitly specifies a different method.

Worked Example: Time-Dependent Coefficients on a Nonuniform Grid

Suppose \(y'=a(t)y+b(t)\), \(y(0)=1\), and the coefficient data are as shown. Use the grid \(t_0=0\), \(t_1=0.4\), and \(t_2=1.0\).

Time \(t\)\(a(t)\)\(b(t)\)
012
0.4-0.51

The first step has length \(h_0=0.4-0=0.4\). At \(t_0=0\), the coefficient values are \(a(t_0)=1\) and \(b(t_0)=2\). With \(y_0=1\), the slope is \(1(1)+2=3\), and hence

$$ y_1=1+0.4(3)=1+1.2=2.2. $$

The second step has length \(h_1=1.0-0.4=0.6\). Use the entries at \(t_1=0.4\), together with \(y_1=2.2\). The slope is

$$ (-0.5)(2.2)+1=-1.1+1=-0.1. $$

Thus

$$ y_2=2.2+0.6(-0.1)=2.2-0.06=2.14. $$

For a check, the first change is \(2.2-1=1.2\), and \(1.2/0.4=3\), the first slope. The second change is \(2.14-2.2=-0.06\), and \(-0.06/0.6=-0.1\), the second slope. Both updates match the table-based Euler rule.

This example also shows why recording the step length matters. The two intervals have different lengths, so each slope is multiplied by its own \(h_n\). The coefficient at \(t=0.4\), not the one at \(t=1.0\), determines the slope used to advance from \(t_1\) to \(t_2\).

How the Recurrence Collects Contributions

The linear form of the equation makes each Euler update an affine recurrence: it multiplies the current approximation by one factor and adds a forcing contribution. To see how those updates combine, write

$$ q_n=1+h_n a(t_n),\qquad r_n=h_n b(t_n). $$

Then \(y_{n+1}=q_ny_n+r_n\). Repeated updates yield the following formula, which separates the contribution of the starting value from the contributions added at each step.

Theorem: For \(N\geq 1\), if \(y_{n+1}=q_ny_n+r_n\) for \(n=0,\ldots,N-1\), then $$ y_N=\left(\prod_{k=0}^{N-1}q_k\right)y_0 +\sum_{j=0}^{N-1}\left(r_j\prod_{k=j+1}^{N-1}q_k\right). $$ A product with no factors is defined to equal \(1\).

The initial value is multiplied by every update factor. A forcing contribution \(r_j\), added at step \(j\), is multiplied only by the factors from later steps. This formula describes the Euler recurrence; it does not assert that the recurrence values are exact values of the differential equation’s solution.

1
Check the first case.
For \(N=1\), the formula gives \(y_1=q_0y_0+r_0\), which is the recurrence itself.
2
Assume the formula for \(N\).
Suppose it gives the stated expression for \(y_N\).
3
Advance one step.
Use \(y_{N+1}=q_Ny_N+r_N\). Multiplying every term in the formula for \(y_N\) by \(q_N\) appends the factor \(q_N\) to each product. The additional term \(r_N\) is the contribution from the last step.
4
Identify the resulting expression.
The initial-value term now contains \(\prod_{k=0}^{N}q_k\); each earlier forcing term contains all factors from its step through step \(N\); and the new term \(r_N\) has an empty product, equal to \(1\). These are exactly the terms in the formula with \(N+1\) in place of \(N\), completing the induction.

A Constant-Coefficient Recurrence

Worked Example: Identifying the Euler Values Relative to Equilibrium

Use forward Euler with \(h=0.25\) for \(y'=-2y+6\), \(y(0)=1\). The update is

$$ y_{n+1}=y_n+0.25(-2y_n+6)=0.5y_n+1.5. $$

The value \(3\) is unchanged by this update, since \(0.5(3)+1.5=3\). Subtracting \(3\) from each side of the recurrence gives

$$ y_{n+1}-3=0.5(y_n-3). $$

Applying this relation repeatedly gives \(y_n-3=0.5^n(y_0-3)\). Since \(y_0=1\), the Euler values are therefore described by

$$ y_n=3+(1-3)0.5^n=3-2(0.5)^n. $$

For the first three steps, this gives \(y_1=3-2(0.5)=2\), \(y_2=3-2(0.25)=2.5\), and \(y_3=3-2(0.125)=2.75\). Check directly with the update: \(y_1=0.5(1)+1.5=2\), \(y_2=0.5(2)+1.5=2.5\), and \(y_3=0.5(2.5)+1.5=2.75\). The recurrence and the formula agree at each step.

A Common Mistake: Dropping the Forcing Term

A frequent error is to use only the factor multiplying \(y_n\), as if every linear equation had the form \(y'=a(t)y\). The term \(b(t)\) must also contribute to the slope and to the update.

Worked Example: Correcting an Omitted Forcing Term

Consider \(y'=2y+3\), \(y(0)=1\), with \(h=0.1\). A mistaken calculation might use \(y_1=(1+0.1(2))(1)=1.2\). This omits the \(+3\) in the differential equation.

The correct starting slope is \(2(1)+3=5\). Therefore the correct Euler update is

$$ y_1=1+0.1(5)=1+0.5=1.5. $$

Check: the change \(1.5-1=0.5\), divided by \(0.1\), is \(5\), which agrees with the equation’s slope at the initial value. The mistaken result has change \(0.2\), corresponding to a slope of \(2\), not the required slope \(2(1)+3=5\).

A Reliable Calculation Process

For a linear scalar equation, the essential task is to apply the equation’s slope at each current grid point without mixing values from different steps. A short calculation table can make that process easier to inspect.

1
Record the current point.
Write down \(t_n\) and the current approximation \(y_n\).
2
Find the step length and coefficients.
Use \(h_n=t_{n+1}-t_n\), and evaluate or look up \(a(t_n)\) and \(b(t_n)\).
3
Calculate the slope and update.
Compute \(a(t_n)y_n+b(t_n)\), then add \(h_n\) times that slope to \(y_n\).
4
Check the step.
Confirm that \((y_{n+1}-y_n)/h_n\) equals the slope used for that step.

Linear equations are especially convenient for studying Euler updates because their discrete steps can be written and analyzed explicitly. The coefficient \(a(t_n)\) determines how the current approximation is scaled, while \(b(t_n)\) adds a separate contribution. Keeping both terms visible prevents sign and omission errors and makes a table of numerical approximations easier to verify.

Check Your Understanding

For each question, distinguish the slope at the current point from the resulting change over a step.

  1. For \(y'=a(t)y+b(t)\), write the forward Euler update using step length \(h_n\).
  2. Suppose \(y_n=2\), \(a(t_n)=-1\), \(b(t_n)=4\), and \(h_n=0.2\). What slope is used, and what is \(y_{n+1}\)?
  3. Why must coefficients from a table be taken at \(t_n\) for the forward Euler step from \(t_n\) to \(t_{n+1}\)?
  4. For \(y_{n+1}=q_ny_n+r_n\), which update factors multiply the forcing contribution \(r_j\) in the formula for \(y_N\)?
  5. If an Euler calculation uses \(y_{n+1}=y_n+h_na(t_n)y_n\) for an equation with nonzero \(b(t_n)\), which part of the equation has been omitted?

Test yourself: Calculus I final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon