Tutorials › Calculus II › High-Order Taylor Methods for Initial-Value Problems

Taylor Methods in Computation · Tutorial 894 of 998

High-Order Taylor Methods for Initial-Value Problems

Build higher-order Taylor updates by differentiating the differential equation along its solution, and apply them carefully to scalar initial-value problems.

Advanced 10 min read

What You'll Learn

  • Write third- and fourth-order one-step Taylor updates for a scalar initial-value problem.
  • Compute solution derivatives using the chain rule, including when the equation depends explicitly on time.
  • Explain why the Taylor update approximates the solution at the next time step.
  • Apply third- and fourth-order methods with exact intermediate arithmetic.
  • Recognize the smoothness conditions behind the local truncation error.
  • Avoid confusing partial derivatives of the differential equation with derivatives of its solution.

From a Differential Equation to a One-Step Update

A scalar initial-value problem specifies a differential equation and a starting value, usually written as \(y'=f(t,y)\) and \(y(t_0)=y_0\). The solution is a function of time, but a numerical method advances by discrete steps: from an approximate value \(y_n\) at time \(t_n\), it computes an approximate value \(y_{n+1}\) at \(t_{n+1}=t_n+h\).

Euler’s method uses only the slope at the beginning of the step. A Taylor method uses more information: the curvature and higher derivatives of the solution at that point. Those derivatives are not usually supplied directly. They are obtained by differentiating the differential equation and applying the chain rule.

Definition: A Taylor method of order \(p\) advances an approximation \(y_n\) over a step of length \(h\) by using the degree-\(p\) Taylor polynomial of the solution about \(t_n\). The derivatives in that polynomial are evaluated from the differential equation at \((t_n,y_n)\).

For a third-order method, the update uses the first three derivatives of the solution. For a fourth-order method, it uses the first four. Higher order means more derivative information and more computation per step; it does not mean that every step is automatically accurate regardless of the equation or step size.

Finding Solution Derivatives from \(y'=f(t,y)\)

The equation directly gives \(y'=f(t,y)\). To find \(y''\), differentiate both sides with respect to \(t\). Since \(f\) depends on \(t\) directly and on \(y(t)\), the chain rule gives

$$ y''=\frac{d}{dt}f(t,y(t)) =f_t(t,y)+f_y(t,y)y' =f_t(t,y)+f_y(t,y)f(t,y). $$

Here \(f_t\) and \(f_y\) denote partial derivatives, evaluated at the current \((t,y)\). This is a total derivative of \(f(t,y(t))\), not just its partial derivative with respect to \(t\).

Differentiate once more to obtain the third derivative:

$$ y'''=f_{tt}+2f_{ty}f+f_{yy}f^2+f_y(f_t+f_yf). $$

All terms on the right are evaluated at the same point \((t,y)\). This formula follows by differentiating \(y''=f_t+f_yf\), applying the chain rule to each factor, and using \(y'=f\) and \(y''=f_t+f_yf\). It requires the relevant partial derivatives of \(f\) to exist.

For organizing higher derivatives, it is useful to define an operator \(D\) acting on a differentiable function \(q(t,y)\) by

$$ Dq=q_t+f(t,y)q_y. $$

Along a solution, the chain rule says \(\frac{d}{dt}q(t,y(t))=Dq\). Thus \(y'=f\), \(y''=Df\), \(y'''=D(Df)\), and \(y''''=D(D(Df))\). For a fourth-order update, one can differentiate the already-computed expressions as needed; the point is always to take derivatives along the solution, rather than to treat \(y\) as constant.

Why the Taylor Update Works

Fix a time \(t_n\), and consider the exact solution on the step. Set \(g(s)=y(t_n+s)\). Then \(g(0)=y(t_n)\), \(g'(0)=y'(t_n)\), and, more generally, \(g^{(k)}(0)=y^{(k)}(t_n)\). Taylor’s theorem applied to \(g\) gives the update formula and explains the role of each derivative.

1
Expand the solution over one step.
If the solution has \(p+1\) continuous derivatives between \(t_n\) and \(t_n+h\), Taylor’s theorem gives its degree-\(p\) polynomial plus a remainder.
2
Replace the first derivative with the equation.
Use \(y'=f(t,y)\), then obtain the higher derivatives by differentiating along the solution.
3
Evaluate at the step’s starting point.
For a numerical step, evaluate the derivative expressions at the available pair \((t_n,y_n)\) and use the resulting Taylor polynomial for \(y_{n+1}\).

The exact Taylor expansion through degree \(p\) is

$$ y(t_n+h)=y(t_n)+hy'(t_n)+\frac{h^2}{2!}y''(t_n)+\cdots+\frac{h^p}{p!}y^{(p)}(t_n)+R_{p+1}. $$

If \(\lvert y^{(p+1)}(t)\rvert\le M\) throughout the step, the remainder satisfies \(\lvert R_{p+1}\rvert\le M\lvert h\rvert^{p+1}/(p+1)!\). This is the local truncation error when the step starts from the exact solution value. It describes one step; it does not by itself state the total error after many steps.

Theorem: If the solution has the derivatives required by Taylor’s theorem, a degree-\(p\) Taylor update from an exact starting value differs from the exact solution after one step by a remainder of order \(h^{p+1}\). The bound above holds when the \((p+1)\)st derivative is bounded on the step.

The Third- and Fourth-Order Updates

Using the derivative expressions from the differential equation, the third-order Taylor method is

$$ y_{n+1}=y_n+h f(t_n,y_n) +\frac{h^2}{2}y''(t_n,y_n) +\frac{h^3}{6}y'''(t_n,y_n). $$

The fourth-order method adds one more term:

$$ y_{n+1}=y_n+h f(t_n,y_n) +\frac{h^2}{2}y''(t_n,y_n) +\frac{h^3}{6}y'''(t_n,y_n) +\frac{h^4}{24}y''''(t_n,y_n). $$

In these formulas, \(y''\), \(y'''\), and \(y''''\) mean derivatives of the solution, expressed using \(f\) and its partial derivatives. They are not independent inputs to the problem. The formulas require \(f\) to be differentiable enough for the indicated solution derivatives to exist. To assert a remainder bound of order \(h^{p+1}\), one also needs the corresponding \((p+1)\)st solution derivative to exist and be bounded on the step.

Worked Examples

Worked Example: A Third-Order Step for \(y'=y^2\)

Apply one third-order Taylor step to \(y'=y^2\), \(y(0)=1\), with \(h=0.1\). Here \(f(t,y)=y^2\). The first derivative at the starting point is

$$ y'=y^2,\qquad y'(0)=1^2=1. $$

Differentiate \(y'=y^2\) along the solution:

$$ y''=2yy'=2y(y^2)=2y^3,\qquad y''(0)=2(1)^3=2. $$

Differentiate \(y''=2y^3\) once more:

$$ y'''=6y^2y'=6y^2(y^2)=6y^4,\qquad y'''(0)=6(1)^4=6. $$

Substitute into the third-order update:

$$ y_1=1+(0.1)(1)+\frac{(0.1)^2}{2}(2)+\frac{(0.1)^3}{6}(6) =1+0.1+0.01+0.001=1.111. $$

As a check, the exact solution is \(y(t)=1/(1-t)\), which satisfies \(y(0)=1\) and \(y'=y^2\). At \(t=0.1\), it is \(10/9\), and

$$ \frac{10}{9}-1.111=\frac{10}{9}-\frac{1111}{1000}=\frac{1}{9000}. $$

The computed value is close to the exact value, but is not equal to it; the difference is consistent with omitting terms beyond degree three.

Worked Example: A Fourth-Order Step for \(y'=y\)

Apply one fourth-order step to \(y'=y\), \(y(0)=1\), with \(h=0.2\). Since each derivative of the solution equals \(y\), the starting-point values are

$$ y'(0)=1,\qquad y''(0)=1,\qquad y'''(0)=1,\qquad y''''(0)=1. $$

For example, \(y''=y'=y\), and differentiating this identity gives \(y'''=y\) and \(y''''=y\). Thus the fourth-order update is

$$ \begin{aligned} y_1 &=1+(0.2)(1)+\frac{(0.2)^2}{2}(1) +\frac{(0.2)^3}{6}(1)+\frac{(0.2)^4}{24}(1)\\ &=1+0.2+0.02+\frac{0.008}{6}+\frac{0.0016}{24}\\ &=1+0.2+0.02+0.001333333\ldots+0.000066666\ldots\\ &=1.2214. \end{aligned} $$

The exact solution is \(y(t)=e^t\), so the exact value at \(t=0.2\) is \(e^{0.2}\approx1.221402758\). The Taylor calculation keeps the terms through degree four and gives \(1.2214\); the omitted higher-degree terms account for the small difference.

Worked Example: A Fourth-Order Step with Explicit Time Dependence

Apply one fourth-order step to \(y'=t^2+y\), \(y(0)=1\), with \(h=0.1\). The equation depends explicitly on \(t\), so its time derivative contributes. First,

$$ y'(0)=0^2+1=1. $$

Differentiate the equation along the solution to obtain the next derivatives:

$$ y''=2t+y',\qquad y''(0)=2(0)+1=1, $$ $$ y'''=2+y'',\qquad y'''(0)=2+1=3, $$ $$ y''''=y''',\qquad y''''(0)=3. $$

Now use the fourth-order formula. Each term is evaluated explicitly:

$$ \begin{aligned} y_1 &=1+(0.1)(1)+\frac{(0.1)^2}{2}(1) +\frac{(0.1)^3}{6}(3)+\frac{(0.1)^4}{24}(3)\\ &=1+0.1+0.005+0.0005+0.0000125\\ &=1.1055125. \end{aligned} $$

The derivative values can be checked directly from the differentiated equation: at \((t,y)=(0,1)\), \(y'=1\), then \(y''=0+1=1\), \(y'''=2+1=3\), and \(y''''=3\). This check also confirms that the explicit time dependence has not been dropped.

A Common Pitfall: Treating \(y\) as Constant

A frequent error is to compute \(y''\) by taking only the partial derivative \(f_t\). That omits the change in \(f\) caused by the changing value of \(y(t)\). For \(y'=y^2\), the equation has \(f_t=0\), but concluding that \(y''=0\) is incorrect.

$$ \text{Wrong: }y''=f_t=0. \qquad \text{Correct: }y''=f_t+f_y y'=0+(2y)(y^2)=2y^3. $$

At \(y(0)=1\), the correct value is \(y''(0)=2\), not \(0\). A second-order Taylor step with \(h=0.1\) would therefore be \(1+0.1+\frac{(0.1)^2}{2}(2)=1.11\). The incorrect calculation would give \(1+0.1=1.1\), because it drops the curvature term. The chain rule is essential even when \(f\) has no explicit dependence on \(t\).

Using the Method Carefully

High-order Taylor methods are useful when the differential equation is smooth and its derivatives can be calculated reliably. The method makes the connection between the local shape of the solution and the numerical update explicit: the slope sets the linear term, curvature contributes the quadratic term, and higher derivatives refine the step further.

The main practical cost is finding those higher derivatives. For a complicated \(f\), differentiating repeatedly may produce lengthy expressions, and errors in those expressions directly affect the update. The method also depends on adequate smoothness: if the required derivatives do not exist or are not controlled on the step, the Taylor remainder estimate cannot be used in the stated way.

Before carrying out a step, identify the desired order, compute each solution derivative along the differential equation, evaluate all quantities at the starting pair \((t_n,y_n)\), and then substitute the step size with its factorial coefficient. Keeping these stages separate helps prevent confusion between partial derivatives, total derivatives, and derivatives evaluated at different points.

Check Your Understanding

Use the definitions and formulas in this tutorial to answer the following questions.

  1. For \(y'=f(t,y)\), write the chain-rule expression for \(y''\). Which term would be lost if \(y\) were incorrectly treated as constant?
  2. For \(y'=y^2\), \(y(0)=1\), what are \(y'(0)\), \(y''(0)\), and \(y'''(0)\)?
  3. Write the degree-four Taylor update from \((t_n,y_n)\), including every factorial coefficient.
  4. For \(y'=t^2+y\), \(y(0)=1\), find \(y''(0)\) and \(y'''(0)\).
  5. What smoothness and boundedness condition supports an order-\(h^{p+1}\) one-step remainder bound for a degree-\(p\) Taylor method?