Solution (source code)

= Solution

The diagram has a connection between every pair of indices $0\leq i<j\leq n$, including the fixed beam $0$. Two parallel strings, each with <spring constant> $k/2$, together have energy $k(X_i-X_j)^2/2$. Thus the printed $E_{ij}$ is the energy of a connecting pair; calling it the energy of one string would introduce a factor-of-two discrepancy.

Take vertical coordinates positive upwards, with $X_0$ fixed. Each bar has <gravitational potential energy> $m_igX_i$ and <kinetic energy> $m_i\dot X_i^2/2$. The <Lagrangian> is
$$
\boxed{L=\frac12\sum_{i=1}^nm_i\dot X_i^2-\sum_{i=1}^nm_igX_i
-\frac k2\sum_{0\leq i<j\leq n}(X_i-X_j)^2.}
$$
Differentiating gives the <Euler-Lagrange equations>
$$
\boxed{m_i\ddot X_i+m_ig+k\sum_{\substack{0\leq j\leq n\\j\ne i}}(X_i-X_j)=0,\qquad i=1,\ldots,n.}
$$
Equivalently, with $S=\sum_{j=1}^nX_j$, the <spring> term is $k[(n+1)X_i-S-X_0]$. Gravity changes the <equilibrium> but not the <stiffness matrix>. Subtracting a static <equilibrium> and writing $\eta_i=X_i-X_i^{\rm eq}$ gives the <normal mode> system
$$
M\ddot{\boldsymbol\eta}+K\boldsymbol\eta=0,\qquad
M=\operatorname{diag}(m_1,\ldots,m_n),\qquad
\boxed{K=k\left[(n+1)I-\mathbf1\mathbf1^T\right].}
$$
This is the <spring> system underlying <normal modes of an anchored complete spring graph>.

\Image[/past-exam-of-the-mathematics-course-of-the-year-2-of-the-natural-sciences-course-of-the-university-of-cambridge/2022/paper-2-q7-couplings-and-modes.png]
{title=All six couplings and the three modes for equal bar masses}
{description=The graph on the left records every connecting pair in the $n=3$ installation, with the beam fixed. Each edge represents the two physical strings acting together with stiffness $k$. The arrows on the right show vertical displacement patterns: one uniform mode and two independent sum-zero modes.}