# Alternative methods for solving a system of one linear one non linear simultaneous equations

Take the equations $$x+y=5$$ $$x^2 + y^2 =13$$

The most basic method to solve this system is to first express the linear equation in terms of one of the variables and then sub that into the non-linear equation.

But I am curious if there are other methods to solve such a system ?

In general, the set of equations:

$$\sum_{k=1}^{N}x_k^p = S_p$$

for $$1\leq p\leq N$$, can be solved by considering the function:

$$f(x) = -\sum_{p=1}^N\log\left(1-\frac{x_p}{x}\right) \tag{1}$$

The expansion of $$f(x)$$ around infinity is given by:

$$f(x) = \sum_{r=1}^{\infty}\frac{S_r}{r x^r}$$

We can thus write down $$f(x)$$ to order $$x^{-2}$$ as:

$$f(x) = \frac{5}{x} + \frac{13}{2 x^2} + \mathcal{O}\left(x^{-3}\right)\tag{2}$$

From (1) it follows that $$x^2 \exp\left[-f(x)\right]$$ is a second degree polynomial that has the solutions as its roots. Using (2) it follows that:

$$\exp\left[-f(x)\right] = 1 - \frac{5}{x} + \frac{6}{x^2} + \mathcal{O}\left(x^{-3}\right)$$

It thus follows that:

$$(x-x_1)(x-x_2) = x^2 - 5 x + 6$$

So, the solutions are $$x_1=2$$ and $$x_2 = 3$$ and vice versa.

• Is there any reference to this method, I need to understand it further if possible. Thank you. – NoChance Jul 24 at 11:08
• That is a sweet trick. But unfortunately, it only covers the special case where all variables are treated symmetrically. – Paul Sinclair Jul 24 at 16:26

We have $$(x+y)^2=13+2xy,$$ which gives $$xy=6$$ and by the Viete's theorem $$x$$ and $$y$$ are roots of the equation: $$t^2-5t+6=0$$ or $$(t-2)(t-3)=0,$$ which gives the answer: $$\{(2,3),(3,2)\}$$

• i was wondering where did $t^2-5t+6=0$ come from? Thank you. – NoChance Jul 24 at 4:24
• @NoChance See here: en.wikipedia.org/wiki/Vieta%27s_formulas If $x+y=\frac{5}{1}$ and $xy=\frac{6}{1}$ so $x$ and $y$ they are roots of the equation: $1t^2-5t+6=0$ – Michael Rozenberg Jul 24 at 4:47
• Got it. Many thanks for your clear explanation. – NoChance Jul 24 at 11:05
• @NoChance You are welcome! – Michael Rozenberg Jul 24 at 11:24

You can use some symmetries (but I'm not sure if that makes any difference) $$2 x y = (x + y) ^2 - (x^2 + y^2) = 25 - 13 = 12,$$ express the difference $$(x - y)^2 = (x^2 + y^2) - 2 x y = 1,$$ and get a system of linear equations \begin{aligned} x + y &= 5,\\ x - y &= \pm 1, \end{aligned} that yields $$x = 3$$ and $$y = 2$$ or $$x=2$$ and $$y=3$$

The quadratic equation can be used.

Given:

x + y = 5, then y = 5 -4

Given

x^2 + y^2 = 13

then x^2 + (4-x)^2 = 13

and x^2 + x^2 - 10x + 25 -13 = 0

2x^2 + (-10x) + 12 = 0

Then the co-factors are a = 2, b = -10, c = 12

y = [-b (+-) sqrt(b^2 - 4ac)]/[2a] <-- Quadratic Formula

y = [-(-10) (+-) sqrt((-10)^2 - 4(2*12))]/(2*2)

y = [10 (+-) sqrt(100-96)]/4

y = [10 + 2]/4 and y = [10-2]/4

y = 12/4 and y = 8/4

y = 3 and y = 2

given x + y = 5

When y = 3, x + 3 = 5, x = 5-3, x = 2

when y = 2, x+2 = 5, x = 5-2, x = 3

Answers: x = 3, y = 2 and x = 2, y = 3

Try your answers in all of the original equations and against any given or implied restrictions to make sure they work. They do! (Always check for 'extraneous' answers.)

• Using LaTex, you could simply enclose each equation between $...$ and the answer would look much better. – NoChance Jul 24 at 14:47
• I'm new to this site and don't know what LaTex is. I apologize for how the post looks but hopefully the method is clear even if the format is hard to read. – Science_1 Jul 24 at 15:00
• No problem. To make the equations look like text book type setting a somewhat simple formatting can be used. For example instead of writing a=1, you write it between $..$ like \$a=1\$. A good description is here:math.meta.stackexchange.com/questions/5020/… – NoChance Jul 24 at 15:12
• Thank you for this, NoChance! I will study your reference so my future answers can look as nice as everyone else's. Cheers! – Science_1 Jul 24 at 15:22
• It seems to me that this solution is precisely what the OP called "the most basic method". The questions is about other methods. – Arnaud D. Jul 24 at 15:31

$$\DeclareMathOperator{\lcm}{lcm}$$ Compute the Gröbner basis of your system. Let us start by writing this with zeroes on the right of the equals signs. \begin{align*} 0 &= x+y-5 \\ 0 &= x^2 + y^2 - 13 \text{.} \end{align*} We pick a variable ordering. Let us choose $$x < y$$. (The given system is unchanged by the exchange of the variables $$x$$ and $$y$$, so we get the same computation, but with the variables swapped, if we choose the other ordering.) We compute the first $$s$$-polynomial. We need the LCM of the leading terms $$\lcm(x, x^2) = x^2$$ and using this we get \begin{align*} 0 &= \frac{x^2}{x}(x+y-5) - \frac{x^2}{x^2}(x^2 + y^2 - 13) \\ &= x^2 + xy - 5x -(x^2 + y^2 - 13) \\ &= xy - y^2 -5x + 13 \text{.} \end{align*} Now $$\lcm(xy, x) = xy$$ and \begin{align*} 0 &= \frac{xy}{x}(x+y-5) - \frac{xy}{xy}(xy - y^2 -5x + 13) \\ &= xy + y^2 - 5y -(xy - y^2 -5x + 13) \\ &= 2y^2 +5x -5y -13 \end{align*} and since we have a relation for $$x$$ and $$y$$ both of degree $$1$$, \begin{align*} 0 &= 2y^2 +5x - 5y - 13 -5(x+y-5) \\ &= 2y^2 +5x - 5y - 13 -5x -5y + 25 \\ &= 2y^2 -10y + 12 \\ &= 2(y^2 - 5y + 6) \text{,} \end{align*} and since twice a thing is zero means the thing is zero, we have $$y^2 - 5y + 6 = 0 \text{.}$$ Our collection of expressions which evaluate to zero is then (sorting by decreasing total degree, then according to the order we picked for the variables) \begin{align*} x^2 + y^2 - 13 &= 0 \\ xy - y^2 -5x + 13 &= 0 \\ y^2 - 5y + 6 &= 0 \\ x+y-5 &= 0 \text{.} \end{align*} Notice that in degree $$2$$ we slowly decreased the degree of the dependence on $$x$$ until we were left with a polynomial in $$y$$ alone. Solving that polynomial, $$y = 2$$ or $$y = 3$$. Then the collection becomes (by specializing the value of $$y$$ and appending a final equation for that value of $$y$$) either \begin{align*} x^2 - 9 &= 0 \\ -3x + 9 &= 0 \\ 0 &= 0 \\ x-3 &= 0 \\ y -2 &= 0 \text{,} \end{align*} giving the solution $$(x,y) = (3,2)$$, or \begin{align*} x^2 - 4 &= 0 \\ -2x + 4 &= 0 \\ 0 &= 0 \\ x-2 &= 0 \\ y - 3 &= 0 \text{,} \end{align*} giving the solution $$(x,y) = (2,3)$$.

Let $$u^2-5u+c$$ be the polynomial whose roots are $$x$$ and $$y$$, i.e. $$u^2-5u+c=(u-x)(u-y)=u^2-u(x+y)+xy.$$
Then \begin{align*} x^2-5x+c&=0\\ y^2-5y+c&=0. \end{align*} Adding the two equations and using the facts given we get $$13-25+2c=0 \implies c=6.$$ Thus we have $$u^2-5u+6$$ as our polynomial, so $$x=2,y=3$$ or vice versa.

Let's use some geometry.

I tried as simple approach as I was able to muster

We can do it because it's easy to see that the only possible solutions will always contain x > 0 and y > 0: if it's not so then at least one of them will be greater than 5 as follows from the first equation and then it's square is greater than 25 which contradicts with the second equation. Let it be x <= y for simplicity.

The areas of rectangles R are equal and also their area is equal to the area of outer square without squares X and Y all divided by 2, so R = (25 - 13)/2 = 6

Then by square symmetry we also have:

So, area of S is the area of outer square minus area R four times, thus S = 25 - 4*R = 25 - 4*6 = 1, but the side of S (which is 1 since S is a square) is also the difference between the sides of squares Y and X (which are y and x) and therefore x + 1 = y

Remembering now our first figure and x + y = 5 we get x = 2 and y = 3.

By symmetry of course, if (x, y) is a solution, then (y, x) is too, so x = 3 and y = 2 also solves the original equations. This permutation is also easily illustrated on the figures above (as they don't change if x and y are just swapped).

Another method, good for double-checking your answers on a test, is to graph the two equations on a TI-84 or similar calculator, then examine the graph to see where the lines overlap.

On the calculator, under the [y=] button, set

Y1 = 5-x

Y2 = sqrt(13-x^2)

Y3 = -sqrt(13-x^2)

Then press [graph].

When the graph is displayed, press [2nd][trace] to get into the calculation menu.

Choose #5, intersect.

Select the lines that intersect and choose a 'guess' point that is close to the intersection. The calculator will come back with the answer, x = 3, y = 2

Do the same for the other intersection and the calculator will come back with x =2 , y = 3.

This doesn't always work where you don't have nice, text-book solutions, but when it does work, boy is it nice!

You can use polynomial division to eliminate a variable.

$$(x^2+y^2-13) - x(x+y-5) = y^2 -xy+5x-13$$

$$(y^2 -xy+5x-13) - (-y+5)(x+y-5) = 2y^2-10y+12$$

Solve the equation 2$$y^2-10y+12=0$$, then plug the values of $$y$$ into the linear equation.

Generalization: Given a system of polynomial equations in $$2$$ variables, if one of the equations has one of the variables occurring only as a linear term, then you can eliminate that variable by polynomial division to get a polynomial equation in the remaining unknown. The utility of this is somewhat suspect due to the unsolvability of many univariate polynomials.

Bigger generalizations:

Groebner bases https://en.wikipedia.org/wiki/Gr%C3%B6bner_basis

Elimination theory https://en.wikipedia.org/wiki/Elimination_theory

If you don't need exact answers, but only decimal approximations up to a specific precision, skip all this and look up Newton's method.

The 'ac' method can be used.

From above:

2x^2 + (-10x) + 12 = 0

a = 2, c = 12

a*c = 24

The possible factors of 24 are: (24*1),(12*2),(6*4),(3*8) In the 'ac method' the sets of factors must multiply to 24 and sum to -10. By examination we find that this is true of only one of the above factors, (6*4) where (-6*-4) = 24 and (-6 + -4) = -10.

2x^2 + (-10x) + 12 = 0

but, as we found, -10x = (-6x + -4x) so by substitution..

2x^2 + (-6x + -4x) + 12 = 0

Regrouping we get..

[2x^2 - 6x] + [-4x + 12] = 0

Factoring like terms out we get..

2x(x-3) + -4(x-3) = 0

Factoring (x-3) out we get..

(x-3)(2x-4) = 0

The zeros occur where x-3 = 0 and where 2x-4 = 0

x-3 = 0, x = 3

2x - 4 = 0, 2x = 4, x = 4/2, x = 2

Given x+y = 5

when x = 3, 3+y=5, y = 5-3, y = 2

when x = 2, 2+y=5, y = 5-2, y = 3