Suppose we have the general solution \begin{align} &x_0(\theta,\phi)=C\left( \cos \left( 2\,\theta \right) -1 \right) {{\rm e}^{-2\,i\phi}},\\ &x_1(\theta,\phi)=-C\sin \left( 2\,\theta \right) {{\rm e}^{-i\phi}},\\ &x_2(\theta,\phi)=-\frac 2 3\,C \left( 3\, \left( \cos \left( \theta \right) \right) ^{2}-1 \right),\\ &x_3(\theta,\phi)=C\,{{\rm e}^{i\phi}}\sin \left(2 \theta \right) ,\\ &x_4(\theta,\phi)=C{{\rm e}^{2\,i\phi}} \left( \cos \left( 2\,\theta \right) -1 \right) \end{align} of some system of PDE.
I need to find first integrals of the PDE. I know answers - the first integrals are $$ I_1(x_0,x_1,x_2,x_3,x_4)=x_{{0}}x_{{4}}-4\,x_{{1}}x_{{3}}+3\,{x_{{2}}}^{2}$$ and $$ I_2(x_0,x_1,x_2,x_3,x_4)=x_{{0}}x_{{2}}x_{{4}}-x_{{0}}{x_{{3}}}^{2}-{x_{{1}}}^{2}x_{{4}}+2\,x_{ {1}}x_{{2}}x_{{3}}-{x_{{2}}}^{3} $$ but I want to get it by eliminating the parameters $\theta, \phi, C$. After some manipulations I have got
\begin{align*} &x_{{0}}=\frac{1} {27}\,{\frac {54\,C{x_{{2}}}^{2}+27\,{x_{{2}}}^{3}-32\,{C}^{3}}{{x_{{3}}}^{2}}}, \\ &x_{{1}}=\frac 1 9\,{\frac {6\,Cx_{{2 }}+9\,{x_{{2}}}^{2}-8\,{C}^{2}}{x_{{3}}}},\\ &x_{{4}}={\frac {3{x_ {{3}}}^{2}}{3\,x_{{2}}-2C}} \end{align*} Now, by eliminating $C$ I obtain two expression $$ x_{{1}}{x_{{4}}}^{2}-3\,x_{{2}}x_{{3}}x_{{4}}+2\,{x_{{3}}}^{3}\\ x_{{0}}{x_{{4}}}^{3}-9\,{x_{{2}}}^{2}{x_{{4}}}^{2}+12\,x_{{2}}{x_{{3}}}^{2}x _{{4}}-4\,{x_{{3}}}^{4} $$
but it is not first integrals!
Question: How to find first integrals from the solutions? Where is my mistake in solutions?
Let's start by solving for $\theta$, or rather for $\cos^2\theta$, from the equation for $x_2$ (since that is the only one that involves just a $\theta$). We find that $$ \cos^2\theta = \frac{1}{3}-\frac{x_2}{2C}. $$ Using the double angle formula $\cos(2\theta)=2\cos^2\theta-1$ then yields $$ \cos(2\theta)=-\frac{1}{3}-\frac{x_2}{C}. $$ Now we can substitute directly into the equations for $x_0$ and $x_4$ to obtain that $$ x_0=-Ce^{-2i\phi}\Bigl(\frac{4}{3}+\frac{x_2}{C}\Bigr),\qquad x_4=-Ce^{2i\phi}\Bigl(\frac{4}{3}+\frac{x_2}{C}\Bigr). $$ Multiply these equations to cancel out the $\phi$ expressions: $$ x_0x_4 = \Bigl(\frac{4C}{3}+x_2\Bigr)^2. $$ To get rid of the $C$ in this expression, we'll follow a similar procedure to isolate $x_1 x_3$ in terms of $x_2$ and $C$: $$ x_1x_3 = -\bigl(C\sin(2\theta)\bigr)^2=-\bigl(2C\sin \theta\cos\theta\bigr)^2, $$ and since $\sin^2\theta=1-\cos^2\theta=\tfrac23+\tfrac{x_2}{2C}$ it follows that $$ x_1x_3 = \Bigl(\frac{4C}{3}+x_2\Bigr)\Bigl(-\frac{2C}{3}+x_2\Bigr)=-\frac{8C^2}{9} + \frac{2C}{3} x_2 +x_2^2. $$ To find the first integral of the motion, all we need to do is kill off the cross term, using the $x_0x_4$ equation. Its cross term is $\tfrac{8C}{3} x_2$, so we subtract $x_0x_4/4$ to obtain $$ x_1x_3-\frac{x_0x_4}{4}=-\frac{4C^2}{3} + \frac{3}{4} x_2^2, $$ which rearranges to give $$ \boxed{x_0x_4-4x_1x_3+3x_2^2=\frac{16C^2}{3}}, $$ where the left side matches $I_1$.
To get $I_2$, start by solving for $\phi$: $$ x_4=e^{4i\phi}x_0,\qquad x_3=e^{2i\phi}x_1 $$ from which it follows that $$ x_4x_1^2=x_0x_3^2=C^3\bigl(\cos(2\theta)-1\bigr)\sin^2(2\theta). $$ Using our earlier work, we can substitute into both factors involving $\theta$ on the right side to obtain that $$ x_4x_1^2=x_0x_3^2=\Bigl(\frac{4C}{3}+x_2\Bigr)^2\Bigl(-\frac{2C}{3}+x_2\Bigr). $$ To isolate the $C^3$ term that appears after multiplying out the right side, we need to cancel out both a $C^2x_2$ cross term, and a $Cx_2^2$ cross term. Factoring out the $x_2$ in common from both these cross terms allows us to use the same technique as before to find a suitable linear combination of $x_0x_4$ and $x_1x_3$ to kill the cross terms. After moving everything but the $C^3$ term from the right side over to the left, one obtains the equation $$ I_2=\frac{64C^3}{27}. $$ Note the non-uniqueness of the $I_2$ expression, since we can always rebalance the $x_0x_3^2$ and $x_4x_1^2$ terms (which are equal to each other).