# Solve system of nonlinear equations using non-numerical method

Is there any non-numerical method to solve this kind of system of nonlinear equations for $c_1, c_2, x_1, x_2$: $$c_1+c_2 = 1$$ $$c_1x_1+c_2x_2 = 1$$ $$c_1x_1^2+c_2x_2^2 = 2$$ $$c_1x_1^3+c_2x_2^3 = 6$$ I tried to solve this system, but I cannot find the efficient way.

Write $a = c_1$, $u = x_1$, and $v = x_2$.

Since $c_2 = 1-c_1 = 1-a$, $a u^k + (1-a)v^k = r_k$ for $k = 1, 2, 3$ where the $r_k = 1, 2, 6$ as above.

From this, $a(u^k-v^k)+v^k = r_k$, or $a = \frac{r_k-v^k}{u^k-v^k}$.

Equating for $k=1,2$, $\frac{r_1-v}{u-v} =\frac{r_2-v^2}{u^2-v^2}$, or $u+v = \frac{r_2-v^2}{r_1-v}$, or $u = \frac{r_2-v^2}{r_1-v}-v$.

Squaring, we also have $\frac{(r_2-v^2)^2}{(r_1-v)^2} =(u+v)^2 =u^2+2uv+v^2$.

Equating for $k=1,3$, $\frac{r_1-v}{u-v} =\frac{r_3-v^3}{u^3-v^3}$, or $u^2+uv+v^2 = \frac{r_3-v^3}{r_1-v}$.

Subtracting these two, $uv =\frac{(r_2-v^2)^2}{(r_1-v)^2}- \frac{r_3-v^3}{r_1-v}$ so that $v(\frac{r_2-v^2}{r_1-v}-v) =\frac{(r_2-v^2)^2}{(r_1-v)^2}- \frac{r_3-v^3}{r_1-v}$.

This is a quartic in $v$, which can be solved by the usual methods.

I'll leave it at this for now.

Finding any errors are left as an exercise for the reader, but the method should be correct.

Groebner Basis solution (using sympy):

from sympy import *

c1, c2, x1, x2 = symbols('c1 c2 x1 x2')

G = groebner([c1+c2-1,c1*x1+c2*x2-1,c1*x1**2+c2*x2**2-2,c1*x1**3+c2*x2**3-6])
print G
C2 = solve(G)

#solution #1
C1 = solve(G.subs(c2, C2))
X2 = solve(G.subs(c2, C2))
X1 = solve(G.subs(c2, C2))
print 'X1 = ', X1, ', ', 'X2 = ', X2, ', ', 'C1 = ', C1, ', ', 'C2 = ', C2

#solution #2
C1 = solve(G.subs(c2, C2))
X2 = solve(G.subs(c2, C2))
X1 = solve(G.subs(c2, C2))
print 'X1 = ', X1, ', ', 'X2 = ', X2, ', ', 'C1 = ', C1, ', ', 'C2 = ', C2


here is the output:

GroebnerBasis([-4*c2 + x1, 4*c2 + x2 - 4, c1 + c2 - 1, 8*c2**2 - 8*c2 + 1], x1, x2, c1, c2, domain='ZZ', order='lex')
X1 =  -sqrt(2) + 2 ,  X2 =  sqrt(2) + 2 ,  C1 =  sqrt(2)/4 + 1/2 ,  C2 =  -sqrt(2)/4 + 1/2
X1 =  sqrt(2) + 2 ,  X2 =  -sqrt(2) + 2 ,  C1 =  -sqrt(2)/4 + 1/2 ,  C2 =  sqrt(2)/4 + 1/2


Let us denote $u=x_1-1$, $v=x_2-1$. Since $u^2=x_1^2-2x_1+1$, $u^3=x_1^3-3x_1^2+3x_1-1$, we get \begin{align} c_1+c_2&=1\\ c_1u+c_2v&=0\\ c_1u^2+c_2v^2&=1\\ c_1u^3+c_2v^3&=2 \end{align} (The second line is obtained as $(2)-(1)$, the third line as $(3)-2\cdot(2)+(1)$, the fourth line as $(4)-3\cdot(3)+3\cdot(2)-(1)$, if (1), (2), (3), (4) denote the equations from the original system.)

This is a similar system, but it is a little simpler, since we have a zero on the RHS. In particular, from the second equation we get $u=-\frac{c_2}{c_1}v$ and $u^2=\frac{c_2^2}{c_1^2}v^2$. We can plug this into the third equation to get $$\left(c_1\cdot\frac{c_2^2}{c_1^2}+c_2\right)v^2=1\\ \left(\frac{c_2^2}{c_1}+c_2\right)v^2=1\\ (c_2^2+c_1c_2)v^2=c_1\\ c_2(c_1+c_2)v^2=c_1\\ c_2v^2=c_1\\ v^2=\frac{c_1}{c_2}$$ So we get $v^2=c_1/c_2$ and $u^2=c_2/c_1$.

This implies $u^2v^2=1$, which means that $uv=\pm1$ and $v=\pm\frac1u$.

Now we can simplify a little the last equation \begin{align} c_1u^3+c_2v^3&=2\\ c_1u^2u+c_2v^2v&=2\\ c_2u+c_1v&=2 \end{align} Adding together the equations $c_1u+c_2v=0$ and $c_2u+c_1v=2$ we get that $(c_1+c_2)(u+v)=2$, i.e. $$u+v=2.$$

Plugging $v=\pm\frac1u$ into the previous equation we get either $$u+\frac1u=2 \qquad \Rightarrow \qquad u=v=1$$ or $$u-\frac1u=2 \qquad \Rightarrow \qquad u=1\pm\sqrt{2}, v=1\mp\sqrt{2}.$$

If $u=v=1$, then we would have simultaneously $c_1+c_2=1$ and $c_1+c_2=2$, so we get no solution in this case.

Since the situation is symmetric, it suffices to consider one of the two remaining cases. So let us assume that $$u=1+\sqrt2 \qquad v=1-\sqrt2.$$ Simply by solving the first two equation for $c_{1,2}$ we get $$c_1=\frac{\sqrt2-1}{2\sqrt2}=-\frac{v}{2\sqrt2}\\ c_2=\frac{\sqrt2+1}{2\sqrt2}=\frac{u}{2\sqrt2}\\$$

We can check that $$c_1+c_2=\frac{u-v}{2\sqrt2}=\frac{2\sqrt2}{2\sqrt2}=1$$ $$c_1u+c_2v=\frac{uv-uv}{2\sqrt2}=0$$ Since $u^2=2+u$ and $v^2=2+v$, we get $$c_1u^2+c_2v^2=2(c_1+c_2)+(c_1u+c_2v)=1.$$ Similarly from $u^3=2u+u^2=3u+2$ we get $$c_1u^3+c_2v^3=3(c_1u+c_2v)+2(c_1+c_2)=2.$$ So this values of $c_1$, $c_2$, $u$, $v$ fulfill the system of equations which we got after the substitution.

We can also check that for $x_1=2+\sqrt2$ and $x_2=2-\sqrt2$ we get $$c_1x_1+c_2x_2=\frac{(\sqrt2-1)(2+\sqrt2)}{2\sqrt2}+\frac{(\sqrt2+1)(2-\sqrt2)}{2\sqrt2}=\frac{2\sqrt2}{2\sqrt2}=1.$$ Now by noticing that $x_{1,2}$ are roots of $x^2-4x+2$ we get $$c_1x_1^2+c_2x_2^2=4(c_1x_1+c_2x_2)-2(c_1+c_2)=4-2=2$$ and from $x^3=x^2\cdot x=(4x-2)x=4x^2-2x=14x-8$ we get $$c_1x_1^3+c_2x_2^3=14(c_1x_1+c_2x_2)-8(c_1+c_2)=6.$$

## With polynomial roots

$p(x)=(x-x_1)(x-x_2)(x-a)$ is a cubic polynomial with roots $x_1,x_1,a$ and coefficients $$p(x)=x^3-(x_1+x_2+a)x^2+(x_1a+x_2a+x_1x_2)x-x_1x_2a.$$ Forming the linear combination of the given equations with these coefficients to give $c_1p(x_1)+c_2p(x_2)$ on the left side results in $$0=6-2(x_1+x_2+a)+(x_1a+x_2a+x_1x_2)-x_1x_2a$$ which has to hold independent of the value of $a$. Thus by isolating the coefficients of powers of $a$ the two equations \begin{align} 0&=6-2(x_1+x_2)+x_1x_2\\ 0&=-2+(x_1+x_2)-x_1x_2 \end{align} result, and in consequence (also directly by setting $a=1$ and $a=2$) \begin{align} x_1+x_2&=4\\ x_1x_2&=2 \end{align} so that $x_{1/2}$ are the solutions of $$0=z^2-4z+2=(z-2)^2-2$$ i.e., $x_{1/2}=2\pm\sqrt2$.

## With a difference equation

The given equations form on the left the first terms of the general solution $$u_n=c_1⋅x_1^n+c_2⋅x_2^n$$ of a general second order linear homogeneous recurrence equation $$0=u_{n+2}+a_1⋅u_{n+1}+a_0⋅u_n$$ with $x_{1/2}$ the roots of its characteristic equation.

The values $(u_0,u_2,u_2,u_3)=(1,1,2,6)$ on the right form the start of a solution of this linear recurrence allowing to determine its coefficients. Insertion of the two contained triples gives the equations \begin{align} 0&=2+a_1⋅1+a_0⋅1\\ 0&=6+a_1⋅2+a_0⋅1 \end{align} with solution $a_1=-4$, $a_0=2$, and thus the characteristic equation giving the same quadratic polynomial $$0=z^2-4z+2=(z-(2+\sqrt2))(z-(2-\sqrt(2)).$$

• Very well done indeed! +1! – Robert Lewis May 10 '14 at 18:15