[Math] Heun’s method: Why is it of second order

numerical methodsordinary differential equationsrunge-kutta-methods

I want to get an intuitive understanding of Heun's method and why it has order of consistency 2, i.e. the error lies is in $O(h^{3})$ if $h$ is the stepwidth., I have read it everywhere, my professor says it without proving it. All the resources I have seen so far on the web either omit the proof as trivial, and the only one that does the proof does it wrong. I am at a loss. Can someone explain it to me in as much detail as possible?

Best Answer

I am assuming you mean the explicit method given by \begin{align} &k_1 = f(t_n, y_n) \\ &k_2 = f(t_n + h, y_n + hk_1) \\ &y_{n + 1} = y_n + \frac{h}{2}\left(k_1 + k_2\right) \end{align} To analyze truncation error, assume $y_n = y(t_n)$. From Euler's method we know $$y_n + hk_1 = y(t_n + h) + O(h^2)$$ Therefore by Taylor expanding the y argument to the first degree $$k_2 = f(t_n + h, y(t_n + h) + O(h^2)) = f(t_n + h, y(t_n + h)) + O(h^2)$$ Hence Heun's method is almost the trapezoid method for integration applied to $f$ to approximate $y(t_n + h) - y_n = \int_{t_n}^{t_n + h}f(t, y(t))\,dt$ except that it differs from it by $\frac{h}{2}O(h^2) = O(h^3)$. The trapezoid method is known to be $O(h^3)$ locally, so the error of Heun's method is $O(h^3)$ since it differs from the trapezoid method by $O(h^3)$.

Alternatively, Taylor expanding Heun's method and comparing it to the Taylor expansion of $y(t_n + h)$ will give you the result. This strategy can give the conditions for a Runge Kutta method to achieve a desired order.

For example for two stage methods of order 2:

Assume a method of the form \begin{align} &k_1 = f(t_n, y_n) \\ &k_2 = f(t_n + c_2h, y_n + ha_{21}k_1) \\ &y_{n + 1} = y_n + h(b_1k_1 + b_2k_2) \\ \end{align} Then Taylor expanding $k_2$ to $O(h^2)$ gives \begin{align} k_2 &= f + f_{t}c_2h + f_{y}ha_{21}k_1 + O(h^2) \\ &= f + (c_{2}f_{t} + a_{21}f_{y}f)h + O(h^2). \end{align} where the arguments $(t_n, y_n)$ are omitted. Hence \begin{align} y_{n + 1} = y_{n} + (b_1 + b_2)fh + (b_{2}c_{2}f_{t} + b_{2}a_{21}f_{y}f)h^2 + O(h^3). \end{align} On the other hand, \begin{align} y(t_n + h) = y_{n} + y'(t_n)h + \frac{y''(t_n)}{2}h^2 + O(h^3). \end{align} Since $y'(t) = f(t, y(t))$, we get \begin{align} &y'(t_n) = f \\ &y''(t_n) = f_t \cdot 1 + f_yy' = f_t + f_{y}f. \end{align} Therefore $$y(t_n + h) = y_n + fh + \frac{f_t + f_yf}{2}h^2 + O(h^3)$$ Matching terms gives \begin{align} &b_1 + b_2 = 1 \\ &b_2c_2 = \frac{1}{2} \\ &b_2a_{21} = \frac{1}{2}. \end{align} Heun's method is $c_2 = 1$, $b_1 = b_2 = \frac{1}{2}$, $a_{21} = 1$.