Solution (source code)

= Solution

The interior grid is $x=1,2,3$, with fixed-end <displacements> $u_0=u_4=0$. Hence
$$
\boxed{A=\begin{pmatrix}-2&1&0\\1&-2&1\\0&1&-2\end{pmatrix}.}
$$
Use the monic <characteristic polynomial> convention $p(\lambda)=\det(\lambda I-A)$, where $I$ is the <identity matrix>. Expansion of the <determinant> along the first row gives
$$
\begin{aligned}
p(\lambda)
&=\det\begin{pmatrix}\lambda+2&-1&0\\-1&\lambda+2&-1\\0&-1&\lambda+2\end{pmatrix}\\
&=(\lambda+2)\bigl((\lambda+2)^2-1\bigr)-(\lambda+2)\\
&=\boxed{(\lambda+2)\bigl((\lambda+2)^2-2\bigr)
=\lambda^3+6\lambda^2+10\lambda+4.}
\end{aligned}
$$
The <eigenvalues> are the <roots of a polynomial> $p(\lambda)=0$. With the alternative <determinant> convention $\det(A-\lambda I)$, the <characteristic polynomial> is $-p(\lambda)$ because the <matrix> has odd size; its <roots of a polynomial> are unchanged.