# Given $x+y$ and $x\cdot y$, what is $x^3+ y^3$ ?

I have been looking at an assortment of high school number sense tests and I noticed a reoccurring problem that states what x+y is and what $x\cdot y$ is then asks for $x^3+ y^3$. I want to know how to work these problems. I have a couple of examples.

$x+y=5$ and $x\cdot y=1$, then $x^3+y^3=?$ [key says 110]

$x+y=-1$ and $x\cdot y=2$, then $x^3+y^3=?$ [key says 5]

$x-y=-1$ and $x\cdot y=2$, then $x^3 -y^3=?$ [key says -7]

$x+y=\frac{1}{3}$ and $x\cdot y=\frac{1}{9}$, then $x^3+y^3=?$ $\left[-\dfrac{2}{27}\right]$

Use the identity $$(x+y)^3=x^3+3x^2y+3xy^2+y^3= x^3+y^3+3xy(x+y).$$

Gauss gave a simple algorithm to rewrite a symmetric polynomial $f(x,y)$ as polynomial in the elementary symmetric polynomials $\,s_1\! = x+y,\ \ s_2 = xy.$ Namely if $f$ has highest degree term $\ c x^a y^b$ in the lex (dictionary) order (i.e. $\,(a,b) > (c,d)\,$ if $\,a >c,\,$ or $\,a= c\,$ and $\, b > d)\,$ then cancel the highest term of $\,f\,$ by subtracting $\,cs_1^{a-b} s_2^b,\,$ then recurse on what remains.

Let's perform Gauss's algorithm on the example at hand $\, f = x^3 + y^3.\,$ Since $\,(3,0) > (0,3)\,$ the highest degree monomial is $\ 1\cdot x^\color{#0a0}3y^\color{#c00}0,\,$ so we subtract $\ 1\cdot s_1^{\color{#0a0}3-\color{#c00}0} s_2^\color{#c00}0\, =\, (x+y)^3$ yielding

$$\ x^3+y^3\ -\ (x+y)^3\, =\ {-}3x^2 y - 3x y^2$$

By $(2,1)>(1,2),\,$ RHS has high term $\,-3x^{\color{#0a0}2} y^\color{#c00}1$ so we subtract $\, {-}3 s_1^{\color{#0a0}2-\color{#c00}1} s_2^\color{#c00}1 =\, -3(x\!+\!y)(xy)$

$$\ x^3+y^3\, -\ (x+y)^3\, +\ 3(x+y)(xy) \ =\ 0$$

So the algorithm terminates, yielding $\ f = s_1^3 - 3s_1 s_2.\$ Since you know the values $\,s_1 = x+y,\$ and $\ s_2 = xy,\$ you can now calculate $f$ by using the prior equation.

This same algorithm works for polynomials in any number of variables. It reduces such problems to rote mechanical computation, i.e. no guesswork is required to solve such problems, only simple polynomial arithmetic. The algorithm yields a constructive interpretation of the Fundamental Theorem of Symmetric Polynomials, that every symmetric polynomial has a unique representation as a polynomial in the elementary symmetric polynomials.

Gauss's algorithm may be viewed as a special case of Gröbner basis methods (which may be viewed both as a multivariate generalization of the (Euclidean) polynomial division algorithm, as well as a nonlinear genralization of Gaussian elimination for linear systems of equation). Gauss's algorithm is the earliest known use of such a lexicographic order for term-rewriting (now mechanized by the Grobner basis algorithm and related methods).

Hrm. How can we make $x^3 + y^3$ out of that?

What tools do we have available to us? We have $x+y$. We have $xy$. And we have arithmetic.

I don't know yet how to make $x^3 + y^3$ exactly. Let's focus on one part: let's make $x^3$, and then see what we can do with what's left over.

It's pretty easy to make $x^3$ by multiplying things together. We could take $(xy) \cdot (xy) \cdot (xy)$. We could take $(x+y) \cdot(x+y) \cdot (xy)$. There are others. Let's experiment and actually try all of them. Multiplying them out, we can make

• $x^3 y^3$
• $x^3 y^2 + x^2 y^3$
• $x^3 y + 2 x^2 y^2 + x y^3$
• $x^3 + 3 x^2 y + 3 x y^2 + y^3$

That last one looks intriguing: it has $x^3$ all by itself without other terms multiplied in. It even has $y^3$ in it too.

So let's go with that, and try to subtract off the rest. Now, the question is

How do we make $3x^2 y + 3 x y^2$

If we can solve that, then we can combine that answer with the above to make $x^3 + y^3$.

• Readers may be interested to learn that such heuristics were made algorithmic by Gauss, who gave a uniform algorithm to rewrite any symmetric polynomial in terms of elementary symmetric polynomials - see my answer for examples and references. – Gone Jan 26 '14 at 19:26

Its simple. Use the identity ${x^3 + y^3 =(x+y)(x^2 +y^2 -xy) }$

In the above identity; make modifications and bring it to this form : ${x^3+y^3 = (x+y)((x+y)^2 -3xy) }$

Now putting the values of ${x+y}$ and ${xy}$ in the above equations, you should get the correct answer.

:)

The straight way is as given by @AndréNicolas, cleverly exploiting remarkable identities.

Alternatively, as we know the sum, let $s$, and the product, let $p$, by Vieta's formulas, we know that the two numbers are the roots of

$$t^2-st+p=0.$$

Then

$$t^3=t\cdot t^2=st^2-pt=s(st-p)-pt=(s^2-p)t-sp$$ and the sum of the cubes of the roots must be

$$(s^2-p)s-2sp=s^2-3sp.$$

If the problem cannot be reduced to the symmetric case then Groebner basis can be used to solve the problem. But the calculation by hand is very cumbersome so I use Maxima and got the following output. poly_reduced_grobnercalculates a Groebner base and poly_pseudo_dividedoes the division. The first element of the result list is the list of coefficients the second and the third are the numerator and the denomiantor of the remainder. This is the number we are looking for.

  (%i4)                            load(grobner)
Loading maxima-grobner $Revision: 1.6$ $Date: 2009-06-02 07:49:49$
(%i5) poly_reduced_grobner([-5+y+x,x*y-1],[x,y])
(%o5) [y+x-5,y^2-5*y+1]
(%i6) poly_pseudo_divide(y^3+x^3,%,[x,y])
(%o6) [[y^2-x*y-10*y+x^2+5*x+25,15],110,1,7]
(%i7) poly_reduced_grobner([1+y+x,x*y-2],[x,y])
(%o7) [y+x+1,y^2+y+2]
(%i8) poly_pseudo_divide(y^3+x^3,%,[x,y])
(%o8) [[y^2-x*y+2*y+x^2-x+1,-3],5,1,7]
(%i9) poly_reduced_grobner([1+y+x,2+x*y],[x,y])
(%o9) [y+x+1,y^2+y-2]
(%i10) poly_pseudo_divide(y^3+x^3,%,[x,y])
(%o10) [[y^2-x*y+2*y+x^2-x+1,-3],-7,1,7]
(%i11) poly_reduced_grobner([(-1)/3+y+x,x*y-1/9],[x,y])
(%o11) [3*y+3*x-1,9*y^2-3*y+1]
(%i12) poly_pseudo_divide(y^3+x^3,%,[x,y])
(%o12) [[9*y^2-9*x*y-6*y+9*x^2+3*x+1,3],-2,27,7]

• Using a sledgehammer to miss flies... – Yves Daoust Jun 9 '17 at 14:09
• @YvesDaoust Maybe it is a sledgehammer but certainly it didn't miss the flies. – miracle173 Jun 9 '17 at 18:51