Exercise. Indicate the resonant terms in the system $$ \dot{x}_1 = x_2 + x_{1}^2 + x_1x_2 + x_2^2, \quad \dot{x}_2 = 2 x_1 + x_{1}^2 + x_1x_2 + x_2^2 $$ and write out its normal form up to the terms of the third order.
Let us now derive the general rule for finding resonant terms in the case of two equations \((n=2)\). The resonance conditions in the first and second equations, respectively, are:
$$
\lambda_1 = k_1 \lambda_1 + k_2 \lambda_2, \quad \lambda_2 = k_1 \lambda_1 + k_2 \lambda_2.
$$
Let \(\lambda_2 \neq 0\). For the new variable \(\lambda = \lambda_1 / \lambda_2\) we obtain the equivalent conditions:
$$
k_2 = \lambda \left(1 - k_1\right), \quad k_2 = 1-\lambda k_1.
$$
These equations define two straight lines on the plane \(k_1, k_2\), passing through the points \(\left(1,0\right)\) and \(\left(0,1\right)\) respectively. The slope of the lines is determined by the ratio \(\lambda\). Let us depic on the \(k_1,k_2\) plane an integer grid, with nodes satisfying the conditions \(k_1, k_2 \geqslant 0\), \(k_1+k_2 \geqslant 2\)
Here \(a\), \(b\), \(c\), \(d\), \(e\), \(f\) are constant coefficients. The terms in this formula are grouped so that the Hamiltonian \(\hat{H}\) has the most general form in real numbers.
It is important to note that the Hamiltonian \(\hat{H}\), besides the momenta \(I_1, I_2\), depends only on the difference of angles \( \varphi_1 - \varphi_2\), the so-called resonance phase. This allows us to reduce the order of the system to one degree of freedom by performing another canonical transformation \( \varphi_1, \varphi_2, I_1, I_2 \rightarrow \psi_1, \psi_2, J_1, J_2\): $$ \psi_1 = \varphi_1 - \varphi_2, \quad \psi_2 = \varphi_2, \quad J_1 = I_1, \quad J_2 = I_1 + I_2. $$ Finally, we obtain the Hamiltonian \begin{gather*} \hat{H}'\left(\psi_1,\psi_2,J_1,J_2\right) = \omega J_2 + a' J_1^2 + b' J_1 J_2 + c' J_2^2 + \\ + d' J_1(J_2-J_1)\cos 2\psi_1 + (e' J_1 + f' J_2)\sqrt{J_1(J_2-J_1)} \cos\psi_1, \end{gather*} where \(a'\), \(b'\), \(c'\), \(d'\), \(e'\), \(f'\) are also constant coefficients. The coordinate \(\psi_2\) in the Hamiltonian \(\hat{H}'\) is cyclic, hence its conjugate momentum \(J_2\) is a first integral of the system. The quantities \(J_2\) and \(J_1\) can be interpreted as the total energy of the two oscillators and the energy of the first oscillator, respectively. Let us consider \(J_2=1\). Then the impulses are in the range \(0 \leqslant J_1,\,J_2 \leqslant 1\). For the numerical plotting of the system's typical phase portrait, let us fix the constants: