Are two numbers, $a$ and $b$, uniquely determined by their addition $a+b$ and product $a b$?

I'm wondering whether for any two numbers, are their respective values uniquely determined by the output of their addition, and output of their product? For example if we knew $$x = a+b$$ and $$y = a b$$, would we always know $$a$$ and $$b$$? And if so, would this apply to more than two numbers?

• Say $x=1$ and $y=-2$. Then $a=2$ and $b=-1$ or $a=-1$ and $b=2$. – J. W. Tanner Apr 22 at 19:34

If $$a+b=x$$ and $$ab=y$$ then $$a(x-a)=y$$, which implies $$a^2-xa+y=0$$. This is a quadratic equation which has at most two complex solutions. They are given by $$a_1=\frac{x+\sqrt{x^2-4y}}{2}$$ and $$a_2=\frac{x-\sqrt{x^2-4y}}{2}$$. It doesn't matter which solution you will choose, you will get that the second solution equals to $$b=x-a$$. So yes, such $$a$$ and $$b$$ are unique up to switching between them.

You know them up to permutation. That is, you can know the set $$\{a,b \}$$ but not who specifically $$a,b$$ are.

Indeed, with your notations, $$a,b$$ are the only roots of the polynomial $$X^2 -xX + y = (X-a)(X-b)$$.

This generalizes to any finite list of numbers $$(x_1,..., x_n)$$ : you can know it up to permutation from the knowledge of $$\displaystyle \sum_{i_0<... for $$k$$ varying from $$0$$ to $$n-1$$ because these are the coefficients of the polynomial $$(X-x_1)...(X-x_n)$$ whose roots are precisely this list, up to permutation.

• What’s nice about this approach is that by avoiding any explicit solving for $a,b$ we can be confident that there are no hidden singularities for special values of $a,b$, so this generalizes very cleanly. – Erick Wong Apr 23 at 1:07
• @ErickWong : or special fields if we're interested in more general numbers. The accepted answer, for instance, doesn't deal wkth characteristic $2$ – Max Apr 23 at 7:30

You have two equations in two unknowns. Because one is quadratic, you expect two solutions, which are accounted for by swapping $$a$$ and $$b$$.

With more than two variables, you have fewer equations than unknowns, so expect an infinite number of solutions, though some may be complex. As a real example, note that $$1+4+11=16\\ 1\cdot 4 \cdot 11=44$$, then if we want one number to be $$2$$ we just solve the above with sum of $$14$$ and product of $$42$$, getting $$2,7-\sqrt 7, 7+\sqrt 7$$ with the same sum and product

Here's an intuitive way to see this. The description is long, but simple once you visualize it.

First, let's change symbols to the convention that $$x,y$$ are variables and $$a,b$$ are constants:

\begin{align} x+y & =a \\ xy & =b \end{align}

Solve for $$y$$, so we can graph them:

\begin{align} &y=-x+a\\ &y=b\frac{1}{x} \end{align}

The first equation is a line with gradient $$-1$$ (so it slopes diagonally right-down), with y-intercept at $$a$$, which could be positive or negative or zero.

The second equation is two curves, symmetrical over the diagonal line $$y=x$$, and also over the diagonal line $$y=-x$$. Perhaps it's easier to see in the original form $$xy=b$$: whatever values of $$x,y$$ make this equation true, swapping them is also makes it true.

If $$b$$ is positive, there's two curves, one in quadrant I (both $$x,y$$ are positive), and the other in quadrant III (both $$x,y$$ are negative). If $$b$$ is negative, the curves are in quadrants II and IV (only one of $$x,y$$ is negative). In all, $$y$$ is not defined at $$x=0$$.

Finally, the line and curves constrain $$x,y$$ to their intersection.

When $$b$$ is positive (curves in Quadrants I, III), the diagonal line might go between the curves, and there's no solution. Or, just touch one of the curves, and there's one solution. Or, it might intersect one of the curves twice. Because the curves are symmetrical over the diagonal line $$y=x$$, the intersections are the same values for $$x,y$$, but swapped.

If $$b$$ is negative (curves in Quadrants II, IV), the line always intersects both curves once. Because the curves are also symmetrical over the line $$y=-x$$, again the two intersections are the same values for $$x,y$$, just swapped.

The key thing about this proof is that there is a unique solution, just swapped. The swapping is secondary, but another way to see that swapping must give the same solution is that addition and multiplication are both commutative: $$x+y=y+x$$ and $$xy=yx$$.

PS: maybe I should have just drawn the graphs.