I wonder and tried to google it, but I am not sure what to google it, how to solve non linear equations where equations are equal between each other. I am able to write a specific algorithm for two equations but not dynamically for N equations. I will show the example of three (how my equations approximately looks like):

enter image description here

C1, C2, C3, X - are unknows, but in the end I do not need to know result of X.

It can be interpreted like this (last equation C1 + C2 + C3 = 1 is not included here):

enter image description here

Please, don't try to solve this, I am not sure if these equations have results. I just randomly typed coefficients. But this is how my equations can looks like. Only with different coefficients. I tried to calculated it with only two unknows and I have got quadratic equation in the end so with three unknowns there will be cubic in the end. With N unknows there will be polynomial equation with degree N. Also, I have to say, result do not have to be with 100% accuracy. I am not sure if its help somehow or not.

I found on google that maybe using iterative method could help. I look at few iterative methods but I am still not sure how to use it on this kind of problem. I also found, that non linear equation can by linearize. Maybe that would be a option but I am not sure how to do it here.


2 Answers 2


From $C_1 + C_2 + C_3 = 1 $, you get $C_3 = 1 - C_1 - C_2 $

Substitute that in your equations, you get

$\dfrac{ 4 C_1 + 8 C_2 + 16 (1 - C_1 - C_2) }{2 C_1} = \dfrac{ -12 C_1 - 8 C_2 + 16} {2 C_1} = \dfrac{ - 6 C_1 - 4 C_2 + 8} {C_1} $


$\dfrac{ 9 C_1 + 27 C_2 + 81(1 - C_1 - C_2) }{3 C_2} = \dfrac{ - 24 C_1 - 18 C_2 + 27 }{C_2} $


$\dfrac{16 C_1 + 64 C_2 + 256 (1 -C_1 - C_2) }{4 C_3} = \dfrac{ -60 C_1 - 48 C_2 + 64 }{C_3} $

Since these expressions are equal as you have in your question, we can cross multiply to get

$( - 6C_1 - 4C_2 +8 ) C_2 = (-24 C_1 - 18 C_2 + 27) C_1 \hspace{25pt}(1)$


$(- 6 C_1 - 4 C_2+8) (1 -C_1 - C_2) = (-60 C_1 - 48 C_2 + 64 ) C_1 \hspace{25pt}(2)$

Equations (1) and (2) are two quadratic equations in $C_1 $ and $C_2$ and can be solved using the method outlined in the solution of this problem

  • $\begingroup$ I really appreciate your answer and thank you for that but I am really sorry and I don't wanna sounds rude, but, is this way will gonna work for N equations as I mentioned in my question? System of three was just example. In my case, they can be 16 equations or more. Not really infinite, but a pretty large amount. $\endgroup$ Mar 24, 2022 at 23:52
  • $\begingroup$ No. It doesn't work for $N$ equations. It is for this specific case, where you can cancel $X$ and also where the unknowns $C_1, C_2, C_3$ are related linearly. $\endgroup$
    – ghasheem
    Mar 25, 2022 at 0:01
  • 1
    $\begingroup$ If you wanna solve $N$ equations, then your best bet is to have a good initial guess of the solution, and to use the multi-variate Newton-Raphson numerical method. This method is very versatile, and very fast, and is applicable to a wide range of problems. $\endgroup$
    – ghasheem
    Mar 25, 2022 at 0:04
  • $\begingroup$ OOoooo, sounds good, I will check that out, THANK you very much for now, I will try it <3 $\endgroup$ Mar 25, 2022 at 0:05
  • $\begingroup$ Please, have a look at the solution I just posted. $\endgroup$
    – Jean Marie
    Mar 30, 2022 at 12:00

A much more direct way is to consider that this kind of system is composed of an eigensystem condition + (the last equation which is plainly a normalizing condition.

Let us take your example written under the form of a slightly simplified system

$$\begin{cases}2C_1+4C_2+8C_3&=&C_1\\ 3 C_1+9C_2+27C_3&=&C_2\\ 4C_1+16C_2+64C_3&=&C_3\end{cases}$$

giving the matrix-vector eigen-equation (of the form $MV=XV$)

$$\underbrace{\begin{pmatrix}2&4&8\\ 3&9&27\\ 4&16&64\end{pmatrix}}_M\underbrace{\begin{pmatrix}C_1\\ C_2\\ C_3\end{pmatrix}}_V=X \underbrace{\begin{pmatrix}C_1\\ C_2\\ C_3\end{pmatrix}}_V$$

where there are only 3 possibilities for $X$ and $(C_1,C_2,C_3)$ to be chosen among the eigenvalues and associated eigenvectors with normalizing condition $C_1+C_2+C_3=1$ giving (for example using the matlab program below):

$$X = 71.5723 \ or \ X=3.2194 \ or \ X=0.2083$$

associated resp. to normalized vectors:

$$\begin{pmatrix}C_1\\ C_2\\ C_3\end{pmatrix}= \begin{pmatrix}0.0888\\ 0.2776\\ 0.6335\end{pmatrix} \ \ or \ \ \begin{pmatrix}0.6198\\ 0.5713\\ -0.1912\end{pmatrix} \ \ or \ \ \begin{pmatrix}2.2101\\ -1.4302\\ 0.2201\end{pmatrix}$$

Matlab program:

 M=[2, 4,  8
    3, 9, 27
    4,16, 64];
 eig(M), % list of eigenvalues
 [P,~]=eig(M); % P is a matrix whose columns are eigenvectors
 for k=1:3
     V=P(:,k);V=V/sum(V), % normalization of eigenvectors
  • 1
    $\begingroup$ Nice approach !! [+1] $\endgroup$
    – ghasheem
    Mar 30, 2022 at 12:09
  • $\begingroup$ @Calm down and have some tea You shouldn't have erased your previous answer ! $\endgroup$
    – Jean Marie
    Mar 30, 2022 at 14:03
  • $\begingroup$ Why do you say that? $\endgroup$
    – ghasheem
    Mar 30, 2022 at 14:08
  • $\begingroup$ I say that because I feel confused that it looks a consequence of my own answering. $\endgroup$
    – Jean Marie
    Mar 30, 2022 at 14:20
  • $\begingroup$ Yes. You're right. After seeing your answer, I realized that my answer is a bad answer to this question that should be solved in the way you did. $\endgroup$
    – ghasheem
    Mar 30, 2022 at 15:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .