= Solution
The endpoint <boundary conditions> are
$$
\boxed{y_0=1,\qquad y_N=5.}
$$
The <finite difference> equation can be written $y_{n+1}-2y_n+y_{n-1}=2h^2$. Set $d_n=y_n-y_{n-1}$. Then $d_{n+1}-d_n=2h^2$, so $d_n=d_1+2h^2(n-1)$. Summing from $1$ to $n$ gives
$$
y_n=1+nd_1+h^2n(n-1).
$$
Using $y_N=5$ and $h=2/N$ yields $Nd_1=4-h^2N(N-1)=4/N$, hence $d_1=4/N^2=h^2$. Therefore
$$
\boxed{y_n=1+h^2n^2=1+\left(\frac{2n}{N}\right)^2=y(x_n),\qquad 0\leq n\leq N.}
$$
This also covers $N=1$, where there are no interior equations. Uniqueness follows because the difference of two solutions has zero second <finite difference>, hence is linear in $n$, and vanishes at both endpoints. This is an <exact finite difference solution for constant second derivative>: the method is exact at the nodes here because the centered second <finite difference> differentiates this quadratic <polynomial> exactly.
Back to article page