# Paper 2, Section II, $5 \mathrm{C}$

Consider the problem of solving

$\frac{d^{2} y}{d t^{2}}=t$

subject to the initial conditions $y(0)=\frac{d y}{d t}(0)=0$ using a discrete approach where $y$ is computed at discrete times, $y_{n}=y\left(t_{n}\right)$ where $t_{n}=n h(n=-1,0,1, \ldots, N)$ and $0

(a) By using Taylor expansions around $t_{n}$, derive the centred-difference formula

$\frac{y_{n+1}-2 y_{n}+y_{n-1}}{h^{2}}=\left.\frac{d^{2} y}{d t^{2}}\right|_{t=t_{n}}+O\left(h^{\alpha}\right)$

where the value of $\alpha$ should be found.

(b) Find the general solution of $y_{n+1}-2 y_{n}+y_{n-1}=0$ and show that this is the discrete version of the corresponding general solution to $\frac{d^{2} y}{d t^{2}}=0$.

(c) The fully discretized version of the differential equation (1) is

$\frac{y_{n+1}-2 y_{n}+y_{n-1}}{h^{2}}=n h \quad \text { for } \quad n=0, \ldots, N-1$

By finding a particular solution first, write down the general solution to the difference equation (2). For the solution which satisfies the discretized initial conditions $y_{0}=0$ and $y_{-1}=y_{1}$, find the error in $y_{N}$ in terms of $h$ only.