I would like to check if the last equivalence of the following equivalence chain is actually true:
\begin{equation}\begin{aligned} \sum_i \left(a_1 s_i^4 + a_2 s_i^2 s_{i+1}^2\right) &= \, s^T \text{diag}(s)\,\, A\,\, \text{diag}(s) \,\, s \\ & = s^T \text{diag}(s)\,\, M \,\, D \,\, M^T \,\, \text{diag}(s) \,\, s \\&= z^T \,\, M^T \,\text{diag}(s)\,\, M \,\, D \,\,M^T \,\text{diag}(s) \,\,M\,\,z \\& \overset{?}{=} \,\, z^T\,\text{diag}(z)\,\,D\,\text{diag}(z)\,\,z = \sum_i \Lambda_i z_i^4 \end{aligned} \end{equation} Where $M$ is the orthogonal matrix that transform the matrix $A$ into its diagonal matrix $D=\text{diag}(\Lambda_1,\Lambda_2,...,\Lambda_n)$ and $z=M^T s$.