Given the equations $y+z=a$ and $y \cdot z = b$, how do I solve for $y$ and $z$?

76 Views Asked by At

Background

Recently, I have been factoring quadratic equation of the form $$ x^2 + ax + b $$ into $$ (x+y) \cdot (x+z) $$

e.g. From $x^2 + 3528x + 63180$ to $(x+3510) \cdot (x+18)$

Normally, it is possible to obtain $y$ and $z$ by looking into every factor of $b$, and find 2 of them, where there product is $b$ and their sum is $a$.

However, I find this method too tedious, especially when dealing with numbers that are hard or impossible to get its factors. So, I decided to use equations to directly obtain $y$ and $z$ given $a$ and $b$.

Question

According to the scenario,

$$ y+z=a $$ $$ y \cdot z = b $$

and so, how do I solve this system of equations, so that I get

$$ y = \frac{-\sqrt{a^2 - 4 \cdot b} + a}{2} \, \text{and} \, z = \frac{\sqrt{a^2 - 4 \cdot b} + a}{2}$$ $$ \text{or} \, y = \frac{\sqrt{a^2 - 4 \cdot b} + a}{2} \, \text{and} \, z = \frac{-\sqrt{a^2 - 4 \cdot b} + a}{2}$$ ?

3

There are 3 best solutions below

0
On BEST ANSWER

Note that by Vieta's formulas, $y$ and $z$ satisfy $x^2-ax+b$, where you can use then the quadratic formula. However, many quadratics can be factored efficiently using a substitution.

You can use the AC method in reverse. In your example, divide by the largest perfect square divisor of $63180$, which is $324 = 18^2$ to get:

$$\frac{x^2}{18^2} + \frac{98}{9}x + 195=0$$ $$\Rightarrow (\frac{x}{18})^2 + 98 \cdot 2 \cdot\frac{x}{18} + 195 = 0$$ $$\Rightarrow X = \frac{x}{18}: X^2+196X+195 = 0$$

which factorises as $(X+195)(X+1)$. In general, $x^2 + (k+1)x + k$ also factorises as $(x+k)(x+1)$. To find the roots of the original quadratic, find $x$ by using $X = x/18$ again.

1
On

Welcome to MSE. there is a method that always gets the solution (small to a large number) and it is like below. Assume $x_1,x_2$ are roots of $ax^2+bx+c$ we can always rewrite it as$$\forall a,c,b:ax^2+bx+c=a(x-x_1)(x-x_2)$$ even in complex roots.

2
On

If I understood the question, you want to know how to get the formulae for the roots of the second-degree polynomial equation. That isn't that hard. First, consider the equation written in the following way (this is the standard way):$$ax^2+bx+c=0$$ and let's assume $a\not=0$, $b\not=0$ and $c\not=0$ (otherwise, the roots are trivial!). Since $a\not=0$, we can divide by $a$ the whole equation, leading to the following expression: $$x^2+mx+n=0;\quad m=\frac{b}{a}, n=\frac{c}{n}.$$ Now add the term $\frac{m^2}{4}$ in both sides (complete the square). By doing this we get $$x^2+mx+n+\dfrac{m^2}{4}=\dfrac{m^2}{4}\Longleftrightarrow \left(x+\dfrac{m}{2}\right)^2=\dfrac{m^2}{4}-n.$$ Now, just solve for $x$ and replace $m$ and $n$ by the original values (In terms of $a$, $b$, and $c$):$$\left(x+\dfrac{m}{2}\right)^2=\dfrac{m^2}{4}-n\Longrightarrow x=-\dfrac{m}{2}\pm \sqrt{\dfrac{m^2}{4}-n}\Longrightarrow x=\dfrac{-b\pm\sqrt{b^2-4ac}}{2a}.$$Now, if we call $r_0$ and $r_1$ to each of the roots we get that $$r_0+r_1=-\dfrac{b}{a};\quad r_0+r_1=\dfrac{c}{a},$$ which is the answer to your question.

Note: One can write the expressions for $r_0$ and $r_1$ in other ways, like:$$r_0=\dfrac{2c}{-b+\sqrt{b^2-4ac}};\quad r_0=\dfrac{2c}{-b-\sqrt{b^2-4ac}}$$ or $$r_0=\dfrac{q}{a};r_1=\dfrac{c}{q};\quad q=-\dfrac{1}{2}\left(b+sign(b\sqrt{b^2-4ac})\right).$$All these three ways of writting the roots are equivalent, but from the point of view of numerical computation the last one is the best amonst the three (ie, if one of the roots is very large while the other is very small, computationally speaking is more accurate and stable).