Tutorials › Calculus I › Detecting Oscillation and Sign Reversal in Euler Output

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

Detecting Oscillation and Sign Reversal in Euler Output

Use Euler’s step multiplier to diagnose alternating signs, artificial oscillations, and growing numerical errors.

Advanced 13 min read

What You'll Learn

  • Derive the Euler multiplier for the scalar test equation.
  • Determine exactly when Euler steps reverse the sign of a nonzero value.
  • Distinguish decaying alternation from constant-amplitude and growing oscillations.
  • Compare Euler output with the exact behavior of exponential decay.
  • Diagnose sign changes in a nonlinear Euler recurrence with a state-dependent multiplier.

Why Sign Changes Need Diagnosis

A table of Euler values can alternate above and below zero even when the differential equation’s exact solution never changes sign. That pattern is important: it may reveal that the step size is producing an artificial oscillation rather than accurately tracking the solution.

But alternation alone does not tell the whole story. The signs may alternate while the values shrink, remain at constant magnitude, or grow. These behaviors have different implications for the computation. The first diagnostic is the step multiplier: the factor by which one Euler value is multiplied to obtain the next.

We will first analyze this factor for the scalar test equation \(y'=\lambda y\), with a positive step size \(h\). We will then use the same idea carefully in a nonlinear example, where the multiplier can change from step to step.

The Step Multiplier for Exponential Decay

For a differential equation \(y'=f(t,y)\), forward Euler with step size \(h\) computes

$$ t_{n+1}=t_n+h, \qquad y_{n+1}=y_n+h f(t_n,y_n). $$

For the scalar test equation \(y'=\lambda y\), where \(\lambda\) is constant, the update becomes

$$ y_{n+1}=y_n+h\lambda y_n=(1+h\lambda)y_n. $$

Define the step multiplier \(q=1+h\lambda\). The recurrence is \(y_{n+1}=q y_n\), so after \(n\) steps,

$$ y_n=q^n y_0. $$

When \(\lambda<0\), the exact solution is \(y(t)=y_0 e^{\lambda(t-t_0)}\). Since the exponential factor is positive, a nonzero exact solution retains its initial sign and its magnitude decreases as time increases. The Euler output need not reproduce both features unless its multiplier has the appropriate size and sign.

Definition: For the scalar test equation \(y'=\lambda y\), the forward Euler step multiplier is \(q=1+h\lambda\). It determines the relation \(y_{n+1}=q y_n\). For \(y_n\ne 0\), a negative \(q\) reverses the sign at that step; the size \(|q|\) determines whether the magnitude shrinks, stays fixed, or grows.

When Does Euler Reverse the Sign?

Assume \(h>0\) and \(\lambda<0\), and write \(a=-\lambda>0\). Then \(q=1-ah\). Its sign and magnitude give three distinct ranges:

Multiplier rangeEuler behavior for a nonzero value
\(0<q<1\), equivalently \(0<h<1/a\)Same sign at each step; magnitude decreases.
\(q=0\), equivalently \(h=1/a\)The next value is zero, and all following values remain zero.
\(-1<q<0\), equivalently \(1/a<h<2/a\)Sign reverses each step; magnitude decreases.
\(q=-1\), equivalently \(h=2/a\)Sign reverses each step; magnitude stays fixed.
\(q<-1\), equivalently \(h>2/a\)Sign reverses each step; magnitude grows.

The endpoint \(q=0\) deserves care: a zero value has no positive or negative sign to reverse. More generally, if \(y_0=0\), then \(y_n=0\) for every \(n\), whatever the multiplier. Thus, for this recurrence, \(q<0\) reverses the sign at every step when the starting value is nonzero; it does not create alternating signs from a zero starting value.

This classification also separates two ideas that are easy to confuse. A sign-alternating sequence is oscillatory in the discrete output, but it is not necessarily growing or unstable. When \(-1<q<0\), its magnitude decays. At \(q=-1\), the values alternate without shrinking. When \(q<-1\), the alternating values grow in magnitude.

Why the Multiplier Classification Works

The claims follow directly from multiplication, but spelling out the argument makes clear which conditions matter.

1
Relate consecutive values.
For every step, \(y_{n+1}=q y_n\). If \(y_n\ne0\), the sign of \(y_{n+1}\) is determined by the sign of \(q\) relative to the sign of \(y_n\).
2
Check sign reversal.
If \(q<0\), multiplication by \(q\) changes the sign of every nonzero \(y_n\). Since \(q\ne0\), a nonzero starting value stays nonzero, so this reversal continues at every step. If \(y_0=0\), the recurrence instead gives \(y_n=0\) throughout.
3
Check the magnitude.
Taking absolute values gives \(|y_{n+1}|=|q|\,|y_n|\). Therefore the magnitude shrinks if \(|q|<1\), is unchanged if \(|q|=1\), and grows if \(|q|>1\).
4
Combine the tests.
For negative \(q\), the signs alternate. Combining this fact with the magnitude test yields decaying alternation for \(-1<q<0\), constant-amplitude alternation for \(q=-1\), and growing alternation for \(q<-1\).

This is a complete diagnosis for the constant-multiplier recurrence. It is consistent with the stability condition for exponential decay: \(|q|<1\) means the Euler values decay in magnitude. Stability in this sense does not guarantee that their signs match the exact solution.

Worked Example: Decay Without Sign Reversal

Worked Example: Decay Without Sign Reversal

Apply forward Euler to \(y'=-2y\), starting from \(y_0=3\), with \(h=0.25\). Find four steps and compare their pattern with the exact solution.

Here \(\lambda=-2\), so

$$ q=1+h\lambda =1+(0.25)(-2) =1-0.5 =0.5. $$

The multiplier is positive and has magnitude less than one. The successive Euler values are

$$ \begin{aligned} y_1&=0.5(3)=1.5,\\ y_2&=0.5(1.5)=0.75,\\ y_3&=0.5(0.75)=0.375,\\ y_4&=0.5(0.375)=0.1875. \end{aligned} $$

At each step, the sign stays positive and the magnitude decreases. Checking the recurrence, \(0.5(0.1875)=0.09375\), which is the next value \(y_5\); the displayed values follow the same multiplier rule.

The exact solution is \(y(t)=3e^{-2t}\), which is also positive and decreasing. At \(t_4=4(0.25)=1\), the exact value is \(3e^{-2}\), approximately \(0.406\) to three decimal places, while Euler gives \(y_4=0.1875\). The qualitative signs agree, although the numerical values differ.

Worked Example: Decaying but Alternating Output

Worked Example: Decaying but Alternating Output

Apply forward Euler to \(y'=-3y\), with \(y_0=8\) and \(h=0.5\). Compute four steps and compare the signs with the exact solution.

The multiplier is

$$ q=1+(0.5)(-3)=1-1.5=-0.5. $$

Since \(-1<q<0\), nonzero values alternate in sign while their magnitudes shrink by a factor of \(0.5\):

$$ \begin{aligned} y_1&=(-0.5)(8)=-4,\\ y_2&=(-0.5)(-4)=2,\\ y_3&=(-0.5)(2)=-1,\\ y_4&=(-0.5)(-1)=0.5. \end{aligned} $$

The recurrence checks directly: each listed value is \(-0.5\) times the one before it. In particular, \(y_5=(-0.5)(0.5)=-0.25\).

The exact solution \(y(t)=8e^{-3t}\) remains positive. At the Euler time points \(t_n=0.5n\), its values for \(n=0,1,2,3,4\) are \(8\), \(8e^{-1.5}\), \(8e^{-3}\), \(8e^{-4.5}\), and \(8e^{-6}\). To three decimal places, these are \(8.000\), \(1.785\), \(0.398\), \(0.089\), and \(0.020\). Euler is stable here in the sense that its values shrink, but the alternating signs are artificial: the exact solution never crosses zero.

Worked Example: Growing Alternation

Worked Example: Growing Alternation

Apply forward Euler to \(y'=-2y\), with \(y_0=2\) and \(h=1.25\). Compute three steps and diagnose the output.

The multiplier is

$$ q=1+(1.25)(-2)=1-2.5=-1.5. $$

Because \(q<-1\), every nonzero value reverses sign and its magnitude grows by a factor of \(1.5\):

$$ \begin{aligned} y_1&=(-1.5)(2)=-3,\\ y_2&=(-1.5)(-3)=4.5,\\ y_3&=(-1.5)(4.5)=-6.75. \end{aligned} $$

Each computed value is exactly \(-1.5\) times the previous value, which checks the arithmetic and confirms the growing alternation. The exact solution is \(y(t)=2e^{-2t}\), positive and decreasing. At \(t_3=3.75\), it is \(2e^{-7.5}\), approximately \(0.001\) to three decimal places, whereas Euler gives \(-6.75\). Here the output is not merely oscillatory: it grows in magnitude and fails badly to reflect the exact behavior.

A Nonlinear Equation Has a State-Dependent Multiplier

For a nonlinear equation, there is generally no single constant multiplier that governs all steps. But if the right-hand side can be written as \(f(y)=y g(y)\), Euler gives

$$ y_{n+1} =y_n+h y_n g(y_n) =\bigl(1+h g(y_n)\bigr)y_n. $$

Thus the step multiplier at the current value is \(q_n=1+h g(y_n)\). When \(y_n\ne0\), a negative \(q_n\) causes a sign reversal at that step. Unlike the linear test equation, the next multiplier may differ because it is evaluated at a new value. One negative multiplier alone does not establish that signs will alternate indefinitely.

Worked Example: A One-Step Sign Reversal in a Nonlinear Problem

Consider \(y'=-y^2\), with \(y_0=2\) and \(h=0.75\). Compare two Euler steps with the exact solution.

The first slope is \(f(2)=-(2)^2=-4\), so

$$ y_1=2+(0.75)(-4)=2-3=-1. $$

In factorized form, \(f(y)=y(-y)\), so \(q_0=1+h(-y_0)=1-(0.75)(2)=-0.5\). This confirms \(y_1=(-0.5)(2)=-1\).

At the next step, \(f(-1)=-(-1)^2=-1\), and therefore

$$ y_2=-1+(0.75)(-1)=-1-0.75=-1.75. $$

The new multiplier is \(q_1=1-(0.75)(-1)=1.75\), so \(q_1y_1=(1.75)(-1)=-1.75\), confirming the second step. The sign does not reverse again: the multiplier has changed from negative to positive.

The exact solution is \(y(t)=\frac{2}{1+2t}\). Substitution gives \(y(0.75)=\frac{2}{2.5}=0.8\) and \(y(1.5)=\frac{2}{4}=0.5\). It remains positive at both times, so the first Euler step crosses zero contrary to the exact behavior. This example shows why nonlinear output must be assessed step by step rather than by assuming one fixed multiplier.

A Common Mistake: Stability Does Not Guarantee Correct Signs

A common error is to treat \(|q|<1\) as proof that an Euler approximation is qualitatively faithful. It only says that repeated multiplication by \(q\) reduces the magnitude. For example, in the decaying alternating example, \(q=-0.5\) satisfies \(|q|<1\), but the numerical values change sign while the exact solution stays positive.

Another error is to say that a negative multiplier always produces sign reversals. If \(y_0=0\), then \(y_{n+1}=q y_n=0\) at every step, even when \(q<0\). The correct claim requires a nonzero current value; for a constant negative multiplier and nonzero starting value, every step reverses the sign.

Diagnostic: First calculate the multiplier and inspect its sign. Then inspect its magnitude. Finally compare the resulting pattern with the expected solution behavior. Stability of the numerical recurrence and qualitative agreement with the differential equation are related, but they are not the same test.

Why This Diagnosis Matters

A computed oscillation can be visually persuasive: alternating values may look like a meaningful physical fluctuation. The multiplier test helps separate that appearance from the behavior the differential equation predicts. For real exponential decay, the exact solution has no sign reversals, so alternating Euler values indicate that the step is too large to preserve this qualitative feature, even when the values decay in magnitude.

In a nonlinear problem, the multiplier can vary at each step, so record or calculate it where the equation permits a factorization. A sign change should then be checked against the slope, the exact behavior if known, and the application’s expected range. This tutorial’s test is a diagnostic, not a claim that every sign-changing numerical sequence is wrong: some differential equations have exact solutions that genuinely oscillate. The comparison must match the equation being solved.

Check Your Understanding

Use the multiplier and the expected solution behavior to answer each question.

  1. For \(y'=-4y\) with \(h=0.1\), calculate \(q\). Do nonzero Euler values reverse sign, and do their magnitudes shrink?
  2. For \(y'=-2y\) with \(h=1\), calculate \(q\) and describe the output from a nonzero initial value.
  3. For a constant negative multiplier, why is a nonzero initial value required to conclude that signs reverse at every step?
  4. Can an Euler sequence alternate in sign and still decrease in magnitude? Give the condition on \(q\).
  5. For a nonlinear recurrence \(y_{n+1}=(1+h g(y_n))y_n\), what must be checked before concluding that the sign will reverse on a particular 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