# Determine conditions on parameters (for consistency) on RK method $y_{n+1} = y_n + ha_1f(t_n,y_n) + ha_2f(t_n + b_1h, y_n + b_2hf(t_n,y_n))$

I'm asked to find the conditions on the coefficients $$a_1,a_2,b_1,b_2$$ in the RK method $$y_{n+1} = y_n + ha_1f(t_n,y_n) + ha_2f(t_n + b_1h, y_n + b_2hf(t_n,y_n))$$ such that is consistent of (a) first order and (b) second order.

The first assumption I make is that $$b_1 = b_2 := b$$ otherwise I have no idea how to solve it. I know it should be like this, but why is this reasonable? I know it follows if you look at the butcher tablaeu, but why is a method with $$b_1 \neq b_2$$ "impossible"?

I taylor expand $$y(t_{n+1})$$, $$y(t_{n+1}) = y(t_n) + hy'(t_n) + O(h^2).$$ The order of consistency is $$p$$ if $$l = O(h^{p+1})$$ where $$l$$ is the local residual.

The local residual takes the form $$y(t_n) + hy'(t_n) + O(h^2) - y(t_n) - ha_1f(t_n,y_n) - ha_2f(t_{n+b}, y_{n+b})$$ $$= hy'(t_n) - ha_1y'(t_n) - ha_2y'(t_{n+b}) + O(h^2).$$ So I need to find $$a_1,a_2,b$$ so that every term except the $$O(h^2)$$ remains. I get for (a) $$a_1 + a_2 = 1, b=0.$$

For (b) I expand one term more $$y(t_{n+1}) = y(t_n) + hy'(t_n) + \frac{h^2y''(t_n)}{2} + O(h^3)$$ The local residual becomes $$y(t_n) + hy'(t_n) + \frac{h^2y''(t_n)}{2} + O(h^3) - y(t_n) - ha_1y(t_n) - ha_2y(t_{n+b})$$

But here I am stuck. How am I supposed to choose the coefficients as to remove the $$\frac{h^2y''(t_n)}{2}$$ term?

How do I solve (b)? And is my answer on (a) correct?

Apply the integration method to the cases $$f(t,x)=1$$, $$f(t,x)=2t$$ and $$f(t,x)=x$$ all with initial conditions $$(t_0,x_0)=(0,1)$$. This gets us \begin{align} f(t,x)=1&:& 1+h &= 1+ha_1+ha_2 &\implies& a_1+a_2=1\\ f(t,x)=2t&:& 1+h^2 &= 1+ha_2(2(b_1h)) &\implies& 2a_2b_1=1\\ f(t,x)=x&:& e^h &= 1+ha_1+ha_2(1+b_2h)) + O(h^3)&\implies& a_2b_2=\frac12 \end{align} so necessarily $$a_1=1-a_2 ~~ \text{ and } ~~ b_1=b_2=\frac1{2a_2}.$$ Now insert these conditions into the Taylor expansion to find that they are also sufficient for all continuously differentiable $$f$$.
\begin{align} x_{+1}&=x+(1-a)hf+ah\left(f+f_t\frac{h}{2a}+f_x\frac{h}{2a}f+O(h^2)\right)\\ &=x+hf+\frac{h^2}2(f_t+f_xf)+O(h^3)\\ \text{while }~~ x(t+h)&=x+hf+\frac{h^2}2\frac{d}{dt}f(t,x(t))+O(h^3)\\ &=x+hf+\frac{h^2}2(f_t+f_xf)+O(h^3) \end{align} so that indeed the local error is of size $$O(h^3)$$.
$$y''(t_n)$$ must be expressed in terms of $$y$$ and $$f$$ as $$f'(t_n,y_n)$$, because of the identity $$y'(t)=f(t,y(t))$$. Think about it this way: you want to find the residual using only the available information at time $$t_n$$, and the only available values are $$t_n,y_n,f(t_n,y_n)$$ and all the derivatives of $$f$$ at $$(t_n,y_n)$$. So you can't have terms involving, say, derivatives of $$y$$. Here is another example of how to handle these methods.