I was working on the matrix formulation problem, and I think what I have is right, but I wanted to make sure I have done it correctly and achieved the correct format.
The problem is finding numerical estimates for the equation $u'' = \lambda u$ with $u(0) = u(1) = 0$. The interval is divided into four pieces, leaving four endpoints: $u_0,u_1,u_2,u_3$, and $u_4$. The discretized second derivative equation gives
$$\lambda u_i = \frac{1}{1/4^2}(u_{i+1}-2u_i+u_{i-1}).$$
To write this as a matrix, I started by simply putting these equations into column-vector form:
$$\lambda \left[
\begin{array}{c}
u_1 \\ u_2 \\ u_3
\end{array}
\right]
=
\frac{1}{1/4^2}
\left[
\begin{array}{c}
u_0 -2 u_1 + u_2 \\ u_1 - 2 u_2 + u_3 \\ u_2 - 2 u_3 + u_4
\end{array}
\right].$$
Then, reading off the coefficients of each $u_i$ in each row, I wrote this as a matrix-vector product:
$$\lambda \left[
\begin{array}{c}
u_1 \\ u_2 \\ u_3
\end{array}
\right]
=
16
\left[
\begin{array}{ccccc}
1 && -2 && 1 && 0 && 0\\ 0 && 1 && -2 && 1 && 0 \\ 0 && 0 && 1 && -2 && 1
\end{array}
\right]
\left[
\begin{array}{c}
u_0 \\ u_1 \\ u_2 \\ u_3 \\ u_4
\end{array}
\right].$$
We know $u_0$ and $u_4$ from the boundary conditions, so plugging these in, this becomes the matrix equation
$$
16
\left[
\begin{array}{ccccc}
1 && -2 && 1 && 0 && 0\\ 0 && 1 && -2 && 1 && 0 \\ 0 && 0 && 1 && -2 && 1
\end{array}
\right]
\left[
\begin{array}{c}
0 \\ u_1 \\ u_2 \\ u_3 \\ 0
\end{array}
\right]
=
\lambda \left[
\begin{array}{c}
u_1 \\ u_2 \\ u_3
\end{array}
\right].$$
One thing I wondered is that since the boundary conditions happen to be zero, this matrix equation can be written in $3 \times 3$ form instead of $3 \times 5$. Would we be expected to write it this way, as in
$$
16
\left[
\begin{array}{ccc}
-2 && 1 && 0\\ 1 && -2 && 1\\ 0 && 1 && -2
\end{array}
\right]
\left[
\begin{array}{c}
u_1 \\ u_2 \\ u_3
\end{array}
\right]
=
\lambda \left[
\begin{array}{c}
u_1 \\ u_2 \\ u_3
\end{array}
\right]$$
on the test?
Edit:
After discussing this problem with Dylan Williams, I am convinced that the matrix need never be $5 \times 5$ but can simply be $3 \times 5$ even in the case of nonzero boundary conditions, and have edited my post above to reflect this.