In normal modes, we often refer the total potential energy of the system to be:
$$V = q^T B q$$
where $V$ is the total potential energy, $q$ is the coordinates of the system and $B$ is just some matrix.
In this problem I am working on, the total potential energy I have come out to is:
$$V =k/4[(-x_1+x_4+y_1-y_4)^2 + (x_2-x_3+y_2-y_3)^2+2(x_1-x_2)^2 + 2(x_3-x_4)^2 + 2(x_3-x_4)^2 + 2(x_3-x_4)^2 + 2(y_1-y_3)^2 + 2(y_2-y_4)^2] \tag{1}$$
Now, I am trying to find the matrix B, and the method I am familiar with is to compute:
$$V = {\begin{pmatrix} x_1 \\ y_1 \\\vdots \\x_4 \\y_4 \end{pmatrix}}^T \begin{pmatrix} B_{11} & B_{22} & \cdots & B_{18} \\\vdots & \vdots & \ &\vdots \\B_{81} & B_{82} & \cdots & B_{88} \end{pmatrix} \begin{pmatrix} x_1 \\ y_1 \\\vdots \\x_4 \\y_4 \end{pmatrix} \tag{2}$$
in algebraic form and then compare the coefficients of $(2)$ and $(1)$ in order to determine the individual elements $B_{ij}$ noting of course, that for $i \neq j$, $B_{ij} = B_{ji}$ (B is symmetric) as the potential energy is a quadratic form. However, this is a very tedious process and i was wondering if there were any alternative methods to find the matrix B? Thank you very much!