Tutorials › Calculus I › Euler’s Method for Coupled Differential Equations

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

Euler's Method for Coupled Differential Equations

Advance a coupled system one step at a time by calculating its entire slope vector from the current time and state before updating any component.

Advanced 9 min read

What You'll Learn

  • Write a coupled first-order system and its initial state in component form.
  • Apply the Euler update to every dependent variable using one shared time step.
  • Distinguish a coupled system from an uncoupled one.
  • Compute and verify Euler approximations for two- and three-variable systems.
  • Identify why updating components sequentially with newly changed values is incorrect.

Why Coupled Equations Need a Shared Update

A differential equation system can describe several quantities whose rates of change influence one another. For instance, the rate at which one quantity changes may depend on the current value of a second quantity. Such a system is called coupled when at least one rate depends on another dependent variable.

When an exact solution is unavailable or not needed, Euler's method approximates the system by repeatedly advancing the variables using their current rates. The key rule for a coupled system is that all components of the slope must be evaluated at the same current time and state. Only after those rates have been found do we update the variables.

Writing the System and Its Approximation

Consider two unknown functions \(x(t)\) and \(y(t)\) satisfying a first-order system with initial values at time \(t_0\):

$$ \frac{dx}{dt}=f(t,x,y), \qquad \frac{dy}{dt}=g(t,x,y), \qquad x(t_0)=x_0,\quad y(t_0)=y_0. $$

Here \(f\) gives the rate of change of \(x\), while \(g\) gives the rate of change of \(y\). A system can be coupled even if just one rate depends on the other dependent variable. For example, \(x'=y,\ y'=-x\) is coupled: the rate \(x'\) depends on \(y\), and \(y'\) depends on \(x\).

Definition: For a step from \(t_n\) to \(t_{n+1}=t_n+h_n\), Euler's method for the system computes both rates at the current approximation \((t_n,x_n,y_n)\), then sets $$ x_{n+1}=x_n+h_n f(t_n,x_n,y_n), \qquad y_{n+1}=y_n+h_n g(t_n,x_n,y_n). $$ The values \(x_n\) and \(y_n\) approximate \(x(t_n)\) and \(y(t_n)\), respectively. The step size \(h_n\) is the time increment; it may be constant or may vary between steps.

In vector form, the current slope is \(\bigl(f(t_n,x_n,y_n),g(t_n,x_n,y_n)\bigr)\). Euler's method adds \(h_n\) times that whole slope vector to the current state. Each component uses the same \(h_n\), \(t_n\), \(x_n\), and \(y_n\). This shared evaluation is what makes the system update one coherent step.

Why the Update Uses the Current Slope

The justification comes from the meaning of a derivative. At a point where \(x\) is differentiable, the quotient \(\bigl(x(t+h)-x(t)\bigr)/h\) approaches \(x'(t)\) as \(h\) approaches zero. Thus, for a sufficiently short step, the change in \(x\) is approximated by \(h x'(t)\). The same reasoning applies to \(y\).

$$ x(t+h)-x(t)\approx h f(t,x(t),y(t)), \qquad y(t+h)-y(t)\approx h g(t,x(t),y(t)). $$

In a numerical calculation, the exact state at time \(t_n\) is not generally known. We use the current approximations \(x_n,y_n\) in its place, evaluate both rates there, and apply these approximated changes. This gives the Euler update. The reasoning requires the rates to be defined at the state where they are evaluated; differentiability of a solution is also needed for the derivative-based justification. The approximation is local: it does not assert that the values after a finite step are exact.

Worked Example: A Two-Variable Rotating System

Worked Example: A Two-Variable Rotating System

Use Euler's method with step size \(h=0.1\) to approximate the solution of $$ x'=y,\qquad y'=-x,\qquad x(0)=1,\quad y(0)=0 $$ at \(t=0.3\).

Here \(f(t,x,y)=y\) and \(g(t,x,y)=-x\). Begin with \(t_0=0,\ x_0=1,\ y_0=0\).

Step 1, from \(t_0=0\) to \(t_1=0.1\): Evaluate both rates at \((0,1,0)\): $$ f(0,1,0)=0,\qquad g(0,1,0)=-1. $$ Then update both components: $$ x_1=1+0.1(0)=1,\qquad y_1=0+0.1(-1)=-0.1. $$

Step 2, from \(t_1=0.1\) to \(t_2=0.2\): Use the current state \((x_1,y_1)=(1,-0.1)\): $$ f(0.1,1,-0.1)=-0.1,\qquad g(0.1,1,-0.1)=-1. $$ Therefore, $$ x_2=1+0.1(-0.1)=0.99,\qquad y_2=-0.1+0.1(-1)=-0.2. $$

Step 3, from \(t_2=0.2\) to \(t_3=0.3\): At \((x_2,y_2)=(0.99,-0.2)\), the rates are $$ f(0.2,0.99,-0.2)=-0.2,\qquad g(0.2,0.99,-0.2)=-0.99. $$ The update is $$ x_3=0.99+0.1(-0.2)=0.97,\qquad y_3=-0.2+0.1(-0.99)=-0.299. $$

The approximation at \(t=0.3\) is \((x_3,y_3)=(0.97,-0.299)\). Check the last step by substituting its starting values and rates into the rule: \(0.99+0.1(-0.2)=0.97\) and \(-0.2+0.1(-0.99)=-0.299\), as computed.

The Simultaneous-Update Principle

The previous example also shows why the order of calculation matters. In each step, first find every slope from the old state. Then use those slopes to produce all the new component values. One may write the two calculations on separate lines, but that does not mean the first new value should be used to calculate the second slope.

1
Record the current data.
Use the current time \(t_n\) and every current component, such as \(x_n\) and \(y_n\).
2
Evaluate the whole slope vector.
Calculate \(f(t_n,x_n,y_n)\) and \(g(t_n,x_n,y_n)\) using that same current state.
3
Update all components.
Use the calculated slopes and the same step size to obtain \(x_{n+1}\) and \(y_{n+1}\).
4
Advance the time.
Set \(t_{n+1}=t_n+h_n\), then repeat from the new state.

This procedure extends directly to a system of \(m\) first-order equations. If the state has \(m\) components, calculate all \(m\) rate functions at the current time and current \(m\)-component state, then add \(h_n\) times each rate to its corresponding component. No component is advanced before the other rates have been evaluated.

Worked Example: A Nonautonomous Coupled System

Worked Example: A Nonautonomous Coupled System

Apply two Euler steps of size \(h=0.2\) to $$ x'=t+y,\qquad y'=x-2y,\qquad x(1)=2,\quad y(1)=1. $$ Both rates depend on at least one other input, and the rates also depend explicitly on time through \(t\) in the first equation.

At \(t_0=1\), the current state is \((x_0,y_0)=(2,1)\). Evaluate both rates at this same point: $$ f(1,2,1)=1+1=2,\qquad g(1,2,1)=2-2(1)=0. $$ Thus $$ x_1=2+0.2(2)=2.4,\qquad y_1=1+0.2(0)=1. $$ The next time is \(t_1=1+0.2=1.2\).

For the second step, use \(t_1=1.2,\ x_1=2.4,\ y_1=1\). The rates are $$ f(1.2,2.4,1)=1.2+1=2.2,\qquad g(1.2,2.4,1)=2.4-2(1)=0.4. $$ Therefore, $$ x_2=2.4+0.2(2.2)=2.4+0.44=2.84, $$ $$ y_2=1+0.2(0.4)=1+0.08=1.08. $$

The two-step approximation is \((x_2,y_2)=(2.84,1.08)\) at \(t_2=1.4\). Check the second update directly: its starting state and rates give \(2.4+0.44=2.84\) and \(1+0.08=1.08\). The time-dependent input in the first rate was evaluated at the current time \(1.2\), not the initial time \(1\).

Worked Example: Checking a Three-Variable Update

Worked Example: Checking a Three-Variable Update

Consider the system $$ x'=-2x+y,\qquad y'=2x-y,\qquad z'=x+z, $$ with initial state \((x_0,y_0,z_0)=(10,0,1)\). Use a step size \(h=0.25\) for one step.

Evaluate all three rates at the initial state: $$ x'_0=-2(10)+0=-20,\qquad y'_0=2(10)-0=20,\qquad z'_0=10+1=11. $$ Now apply one shared Euler step: $$ x_1=10+0.25(-20)=5, $$ $$ y_1=0+0.25(20)=5, $$ $$ z_1=1+0.25(11)=3.75. $$

For a check, the first two differential equations imply \((x+y)'=(-2x+y)+(2x-y)=0\). Their Euler increments should therefore sum to zero: \(0.25(-20)+0.25(20)=0\). The computed values satisfy \(x_1+y_1=5+5=10=x_0+y_0\). The third component also follows its update exactly: \(1+0.25(11)=3.75\). This check verifies the arithmetic and the shared-state calculation for all three components.

A Common Mistake: Updating One Component Too Soon

A tempting but incorrect procedure is to calculate \(x_{n+1}\) and then substitute that new value into the rate used to calculate \(y_{n+1}\). That is no longer the forward Euler rule for the system, because the two slopes have been evaluated at different states.

Worked Example: Spotting a Sequential-Update Error

Use \(x'=y,\ y'=-x\), starting from \((x_0,y_0)=(1,0)\), with \(h=0.1\). The correct slopes at the current state are $$ x'_0=y_0=0,\qquad y'_0=-x_0=-1. $$ So simultaneous Euler gives $$ x_1=1+0.1(0)=1,\qquad y_1=0+0.1(-1)=-0.1. $$

A wrong sequential calculation might first find \(x_1=1\), then use that updated value to calculate \(y_1\). In this particular step that gives the same numerical value, because \(x_1=x_0=1\). To see the error in a step where the first component actually changes, start instead from \((x_0,y_0)=(1,1)\). The correct current slopes are \(x'_0=1\) and \(y'_0=-1\), so simultaneous Euler gives $$ x_1=1+0.1(1)=1.1,\qquad y_1=1+0.1(-1)=0.9. $$ The sequential mistake would use the new \(x_1=1.1\) in the second slope and obtain \(y_1=1+0.1(-1.1)=0.89\). That value uses a slope evaluated at a mixed state, with \(x\) updated but \(y\) not. The correction is to calculate both slopes from \((1,1)\) before updating either variable; the proper result is \((1.1,0.9)\).

Check the correct values in the original update: \(1+0.1y_0=1+0.1=1.1\), and \(1+0.1(-x_0)=1-0.1=0.9\). Both calculations use the same starting state.

Reading and Checking a System Euler Table

A table for a coupled system should keep the time, every component of the state, and every component of the slope visible. A typical row might record \(t_n,x_n,y_n,f(t_n,x_n,y_n)\), and \(g(t_n,x_n,y_n)\). The next row is then determined by the update equations. Keeping both slopes in the row makes it easier to detect whether a rate was mistakenly evaluated using a newly updated variable.

Several basic checks help prevent errors:

  • Confirm that the next time is \(t_n+h_n\).
  • Check that each rate is evaluated using the same current state.
  • Multiply each slope by the step size before adding it to its corresponding component.
  • Retain adequate precision during intermediate steps; round only at the final requested value.
  • When the system has a simple identity, such as a sum with derivative zero, check whether the numerical update respects it.

Euler's method gives an approximation, not an exact solution. A correctly executed update can still differ from the true solution. The purpose of these checks is to verify the arithmetic and the method, not to claim that the numerical error is zero.

Check Your Understanding

For each question, focus on which values are used to calculate the slope vector before a step is taken.

  1. For \(x'=y,\ y'=-x\), with current state \((x_n,y_n)=(2,3)\) and step \(h=0.1\), what are the two current slopes and the next state?
  2. In a coupled system, must every rate depend on every dependent variable for the system to be coupled? Explain briefly.
  3. For \(x'=t+y,\ y'=x\), why must both rates in a step beginning at \(t_n\) use \(t_n\), rather than one using \(t_{n+1}\)?
  4. What is the error in computing a new \(x\) value and then using it immediately to evaluate the slope for \(y\)?
  5. For a system of three first-order equations, what information must be held fixed while all three slopes are evaluated for one Euler step?

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