Simplify arithmetic equation I have to solve the system :
$$\begin{align*}
a+b &= S\\
a\times b&= P\\
\end{align*}$$
Someone told me it was equivalent to solve the equation $x^2-S.x+P=0$. I think it's linked with the formula of sum and product of the roots of a second-degree polynomial but I can't figure out why exactly this works.
 A: From the first equation you have $b=S-a$; substituting this into the second equation gives you $a(S-a)=P$, which is easily rearranged to yield $a^2-aS+P=0$. This tells you that $a$ must be a solution of $x^2-Sx+P=0$. Since the original system is symmetric in $b$, you know that the same must be true of $b$. And since $x^2-Sx+P=0$ has just two solutions, they must be precisely $a$ and $b$.
And indeed you can write out the factorization: $$(x-a)(x-b)=x^2-(a+b)x+ab=x^2-Sx+P\;.$$
A: We describe how late Babylonian pupils (circa $500$ BCE) were shown how to solve the system of equations $a+b=S$, $ab=P$.  We use the computer screen instead of incisions on a clay tablet, so our solution will be much shorter-lived than theirs. To make the derivation more familiar, we use algebraic notation that came a couple of thousand years later.  But we give a correct description of the algorithm that was taught. 
We have $(a+b)^2=S^2$.  Subtract $4ab$. We get that $(a-b)^2=S^2-4P$.  Take the square root(s). We get $a-b=\pm \sqrt{S^2-4P}$ (but there were no negative numbers back then either, those were the good old days).  Now we know $a+b$ and $a-b$. Add and subtract, divide by $2$, to find $a$ and $b$.
So we have solved a "quadratic equation" without using the quadratic formula, indeed without writing down the equation.  You will recognize the procedure as a slightly hidden completing the square. Which reminds me, for al-Khwarizmi and many years after that,  completing the square meant completing a geometric figure made up of a square with a square bite taken out of a corner to a real geometric square.
A: Both Brian M. Scott's and Andre Nicolas's answers are cool, but you can also consider the Vieta's formulae which for second degree polynomial $\alpha x^2 + \beta x + \gamma = 0$ are:
\begin{align*}
x_1 + x_2 &= -\frac{\beta}{\alpha} &&& x_1 * x_2 &= \frac{\gamma}{\alpha}
\end{align*}
where $x_1$ and $x_2$ are the roots of that polynomial.
However, that is just like your equations, where $\alpha = 1$, $\beta = -S$ and $\gamma = P$!
Have fun!
