Tutorials › Calculus II › Second-Order Runge-Kutta Conditions from Taylor Expansions

Taylor Methods in Computation · Tutorial 893 of 998

Second-Order Runge-Kutta Conditions from Taylor Expansions

Learn how Taylor matching determines the coefficient conditions for second-order accuracy and how to check whether a two-stage Runge–Kutta method satisfies them.

Advanced 9 min read

What You'll Learn

  • Write a general explicit two-stage Runge–Kutta update for a scalar initial-value problem.
  • Expand the second stage and the exact solution through terms of degree two in the step size.
  • Derive the necessary and sufficient coefficient conditions for second-order accuracy.
  • Check midpoint, Heun, and other two-stage coefficient choices against those conditions.
  • Diagnose a method that fails a condition by testing it on a suitable differential equation.

Why Match Taylor Expansions?

A Runge–Kutta method advances an approximate solution by evaluating the differential equation’s right-hand side at selected points. Its coefficients determine how those evaluations are combined. To obtain second-order accuracy, the update must reproduce the exact solution’s Taylor expansion through the terms involving the square of the step size.

The comparison is more than a way to check familiar methods. It identifies the coefficient conditions that any explicit two-stage method must satisfy to have second-order accuracy for general smooth differential equations. The analysis also shows why all the conditions matter: different terms in the exact Taylor expansion represent different ways the solution can change.

The General Explicit Two-Stage Update

Consider the initial-value problem \(y'=f(t,y)\), with current value \(y_n\) at time \(t_n\), and step size \(h\). For the general explicit two-stage update considered here, define the stage slopes \(k_1\) and \(k_2\) by

$$ k_1=f(t_n,y_n), \qquad k_2=f(t_n+c h,\;y_n+a h k_1), $$

and set

$$ y_{n+1}=y_n+h(b_1k_1+b_2k_2). $$

The coefficients \(a,c,b_1,b_2\) are fixed numbers. The first stage evaluates the slope at the current point. The second stage evaluates it at a point displaced by \(c h\) in time and \(a h k_1\) in solution value. The update combines the two slopes with weights \(b_1\) and \(b_2\). We allow \(a\) and \(c\) to be independent initially, so the Taylor comparison can determine whether they must be related.

Definition: The method has second-order local accuracy if, when started from the exact value \(y(t_n)\), its one-step result differs from \(y(t_n+h)\) by \(O(h^3)\) as \(h\to0\). Under the usual smoothness and stability assumptions for an initial-value problem, this local accuracy gives global error of order two over a fixed time interval.

Expand the Exact Solution

Along a solution of \(y'=f(t,y)\), the chain rule gives

$$ y''(t)=f_t(t,y(t))+f_y(t,y(t))y'(t) =f_t(t,y(t))+f_y(t,y(t))f(t,y(t)). $$

Here \(f_t\) and \(f_y\) are the partial derivatives of \(f\) with respect to its first and second arguments. If \(f\) is sufficiently smooth, Taylor’s theorem at \(t_n\) therefore gives

$$ y(t_n+h) = y_n+h f +\frac{h^2}{2}\bigl(f_t+f_y f\bigr) +O(h^3), $$

where \(f\), \(f_t\), and \(f_y\) on the right are evaluated at \((t_n,y_n)\). The two degree-two contributions have distinct sources: \(f_t\) accounts for explicit time variation in the equation, while \(f_y f\) accounts for the change in the slope as the solution value changes.

Expand the Runge–Kutta Update

The first stage is \(k_1=f\). For the second stage, expand \(f\) about \((t_n,y_n)\). Its time argument changes by \(c h\), and its solution argument changes by \(a h k_1=a h f\). Thus

$$ \begin{aligned} k_2 &=f(t_n+c h,\;y_n+a h f)\\ &=f+h(c f_t+a f_y f)+O(h^2). \end{aligned} $$

Substitute this expansion into the update. The \(O(h^2)\) remainder in \(k_2\) is multiplied by \(h\), so it contributes \(O(h^3)\) to \(y_{n+1}\):

$$ \begin{aligned} y_{n+1} &=y_n+h\bigl(b_1f+b_2k_2\bigr)\\ &=y_n+h(b_1+b_2)f +h^2\bigl(b_2c f_t+b_2a f_y f\bigr)+O(h^3). \end{aligned} $$

For this expression to agree with the exact Taylor expansion for general smooth \(f\), the coefficients of \(f\), \(f_t\), and \(f_yf\) must match. This gives the second-order conditions.

Theorem: The explicit two-stage update has second-order local accuracy for general sufficiently smooth scalar differential equations if and only if
$$ b_1+b_2=1, \qquad b_2c=\frac12, \qquad b_2a=\frac12. $$

Why These Conditions Are Necessary and Sufficient

The expansions show sufficiency directly: if the three conditions hold, the numerical update becomes

$$ y_{n+1} = y_n+h f+\frac{h^2}{2}(f_t+f_y f)+O(h^3), $$

which agrees with the exact solution through degree two in \(h\). The one-step difference is therefore \(O(h^3)\).

The conditions are also necessary if the method is to work for general equations. The three contributions can be tested separately. For \(f(t,y)=1\), the slope is constant, and matching the coefficient of \(h\) requires \(b_1+b_2=1\). For \(f(t,y)=t\), starting at \(t_n=0\), the exact solution has a nonzero \(f_t\) contribution and \(f_yf=0\); matching the degree-two term requires \(b_2c=1/2\). For \(f(t,y)=y\), starting at \(y_n=1\), \(f_t=0\) and \(f_yf=1\); matching the degree-two term requires \(b_2a=1/2\). Each condition is therefore forced by a suitable test equation.

In the standard explicit Runge–Kutta convention, the second-stage time coefficient equals the sum of the coefficients used to form its solution argument. For this two-stage method, that convention imposes \(c=a\). The conditions above already force \(c=a\) for second-order accuracy, since \(b_2c=b_2a=1/2\) and hence \(b_2\ne0\).

Worked Example: Find Coefficients from a Chosen Weight

Worked Example: Find Coefficients from a Chosen Weight

Suppose \(b_2=2/3\). Find the other coefficients required for second-order accuracy, then check the resulting method on \(y'=t+y\), starting from \(t_n=0\), \(y_n=1\).

The condition \(b_1+b_2=1\) gives

$$ b_1=1-b_2=1-\frac23=\frac13. $$

The other two conditions give

$$ c=\frac{1}{2b_2}=\frac{1}{2(2/3)}=\frac34, \qquad a=\frac{1}{2b_2}=\frac{1}{2(2/3)}=\frac34. $$

Check all three conditions by substitution:

$$ b_1+b_2=\frac13+\frac23=1, \qquad b_2c=\frac23\cdot\frac34=\frac12, \qquad b_2a=\frac23\cdot\frac34=\frac12. $$

Now apply the method to the stated equation. The first slope is

$$ k_1=f(0,1)=0+1=1. $$

The second-stage point is

$$ t_* = 0+\frac34h=\frac34h, \qquad y_* = 1+\frac34h k_1=1+\frac34h. $$

At that point, \(k_2=t_*+y_*=\frac34h+1+\frac34h=1+\frac32h\). The update is

$$ \begin{aligned} y_{n+1} &=1+h\left(\frac13 k_1+\frac23 k_2\right)\\ &=1+h\left(\frac13+\frac23\left(1+\frac32h\right)\right)\\ &=1+h\left(\frac13+\frac23+h\right)\\ &=1+h+h^2. \end{aligned} $$

For a Taylor check, the differential equation gives \(y'(0)=1\). Differentiating \(y'=t+y\) gives \(y''=1+y'\), so \(y''(0)=2\). Hence the exact solution has expansion \(y(h)=1+h+\frac{2}{2}h^2+O(h^3)=1+h+h^2+O(h^3)\). The computed update matches through degree two, as required.

Worked Example: Verify the Midpoint Method

Worked Example: Verify the Midpoint Method

The explicit midpoint method uses \(a=c=1/2\), \(b_1=0\), and \(b_2=1\). Check its second-order conditions, then take one step for \(y'=t\), \(y(0)=0\).

Substitution gives

$$ b_1+b_2=0+1=1, \qquad b_2c=1\cdot\frac12=\frac12, \qquad b_2a=1\cdot\frac12=\frac12. $$

All three conditions are satisfied. In particular, no second-order Taylor contribution fails: the first-order term and both degree-two terms match.

For the one-step check, \(k_1=f(0,0)=0\). The second-stage point has time coordinate \(h/2\) and solution coordinate \(0+(h/2)k_1=0\), so \(k_2=f(h/2,0)=h/2\). Thus the method gives

$$ y_1=0+h\left(0\cdot k_1+1\cdot k_2\right) =h\left(\frac h2\right)=\frac{h^2}{2}. $$

The exact solution is \(y(t)=t^2/2\), since its derivative is \(t\) and it satisfies \(y(0)=0\). Therefore \(y(h)=h^2/2\), exactly the value computed by the method for this equation. This particular test happens to be integrated exactly in one step; the Taylor conditions guarantee second-order accuracy more generally, not exactness for every equation.

Worked Example: Diagnose a Failed Condition

Worked Example: Diagnose a Failed Condition

Consider coefficients \(b_1=1/2\), \(b_2=1/2\), \(a=1\), and \(c=1/2\). Determine whether they give second-order accuracy for general equations. If not, exhibit a test equation where the failure appears.

The first condition holds, and the solution-value condition holds:

$$ b_1+b_2=\frac12+\frac12=1, \qquad b_2a=\frac12\cdot1=\frac12. $$

But the time-shift condition does not hold:

$$ b_2c=\frac12\cdot\frac12=\frac14\ne\frac12. $$

To see the consequence, use \(y'=t\) with \(y(0)=0\). The first stage gives \(k_1=0\). The second stage evaluates at time \(h/2\), so \(k_2=h/2\). The update is

$$ y_1=0+h\left(\frac12\cdot0+\frac12\cdot\frac h2\right) =\frac{h^2}{4}. $$

The exact solution is \(y(t)=t^2/2\), so \(y(h)=h^2/2\). The one-step difference is \(-h^2/4\), which is of order \(h^2\), not \(h^3\). Thus this method does not have second-order local accuracy for general equations.

Common Pitfall: Check Each Product Separately

A frequent error is to verify the weight sum and one of the two product conditions, then assume the remaining condition follows automatically. It does not. The coefficients \(b_2c\) and \(b_2a\) govern different Taylor contributions, so both must be checked.

For example, the midpoint method has \(b_2=1\) and \(a=c=1/2\). Its products are \(b_2a=1\cdot1/2=1/2\) and \(b_2c=1\cdot1/2=1/2\): both conditions are satisfied. By contrast, in the failed method above, \(b_2a=1/2\) is satisfied but \(b_2c=1/4\) is not. Keeping the products in the correct order makes the check transparent.

The Heun method provides another useful check: \(a=c=1\), \(b_1=b_2=1/2\). It satisfies \(b_1+b_2=1\), \(b_2a=1/2\), and \(b_2c=1/2\). Both midpoint and Heun therefore satisfy all the second-order conditions, despite using different stage locations and weights.

What the Conditions Tell Us

Since \(b_2c=b_2a=1/2\), every second-order method in this general family has \(b_2\ne0\), and division by \(b_2\) gives

$$ a=c=\frac{1}{2b_2}, \qquad b_1=1-b_2. $$

Thus choosing any nonzero \(b_2\) determines the other three coefficients through these formulas. The familiar midpoint and Heun methods are two choices within this family. The conditions do not say that every such choice has identical numerical behavior on every problem; they say that the required degree-one and degree-two Taylor terms match.

When applying the conditions, first identify which coefficient controls each part of the update. Then check the weight sum, the time-shift product, and the solution-shift product separately. If a condition fails, a suitable simple test equation can expose the missing Taylor contribution. This is the central value of matching expansions: it turns an accuracy requirement into precise algebraic tests, and it explains what those tests protect.

Check Your Understanding

Use the coefficient conditions and Taylor expansions developed above to answer these questions.

  1. For \(a=c=1/3\), \(b_1=1/4\), and \(b_2=3/4\), check each second-order condition.
  2. If \(b_2=1/4\), what values of \(a\), \(c\), and \(b_1\) are required for second-order accuracy?
  3. Which Taylor contribution is tested by the equation \(y'=t\) at \(t=0\), \(y=0\)?
  4. Why does satisfying \(b_1+b_2=1\) alone not establish second-order accuracy?
  5. For the Heun coefficients \(a=c=1\), \(b_1=b_2=1/2\), verify all three conditions.