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
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.
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
Therefore,
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
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
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)\) |
|---|---|---|
| 0 | 1 | 2 |
| 0.4 | -0.5 | 1 |
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
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
Thus
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
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.
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.
For \(N=1\), the formula gives \(y_1=q_0y_0+r_0\), which is the recurrence itself.
Suppose it gives the stated expression for \(y_N\).
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.
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
The value \(3\) is unchanged by this update, since \(0.5(3)+1.5=3\). Subtracting \(3\) from each side of the recurrence gives
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
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
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.
Write down \(t_n\) and the current approximation \(y_n\).
Use \(h_n=t_{n+1}-t_n\), and evaluate or look up \(a(t_n)\) and \(b(t_n)\).
Compute \(a(t_n)y_n+b(t_n)\), then add \(h_n\) times that slope to \(y_n\).
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.
- For \(y'=a(t)y+b(t)\), write the forward Euler update using step length \(h_n\).
- 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}\)?
- Why must coefficients from a table be taken at \(t_n\) for the forward Euler step from \(t_n\) to \(t_{n+1}\)?
- For \(y_{n+1}=q_ny_n+r_n\), which update factors multiply the forcing contribution \(r_j\) in the formula for \(y_N\)?
- 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?