How to find a polynomial identity to evaluate sum of fifth powers?

Anonymous

I saw the following problem on a book of mine:

Let $a,b,c\in \mathbb C$ satisfies $a+b+c=3,a^2+b^2+c^2=5, a^3+b^3+c^3=7$. Compute $a^5+b^5+c^5$.

How one can do it by Sage? I found a mathematician who was able to find the identity that solves the problem.

sage: a = var('a')
sage: b = var('b')
sage: c = var('c')
sage: x = a+b+c
sage: y = a^2+b^2+c^2
sage: z = a^3+b^3+c^3
sage: expand((x^5-5*x^3*y+5*x^2*z+5*y*z)/6)
a^5 + b^5 + c^5
sage: expand((3^5-5*3^3*5+5*3^2*7+5*5*7)/6)
29/3

But can I use Sage to find the correct identity?

edit retag close merge delete

Sort by » oldest newest most voted

Here are two ways to proceed. The first one gives you approximate results from which you can guess the correct solution, the second is an exact resolution. In both cases, I define $s = a^5 + b^5 + c^5$ and I try to obtain the value of $s$.

1. Using symbolic variables and solve: approximate solution

sage: var('a, b, c, s')
(a, b, c, s)
sage: eq1 = a + b + c == 3
sage: eq2 = a^2 + b^2 + c^2 == 5
sage: eq3 = a^3 + b^3 + c^3 == 7
sage: eq4 = a^5 + b^5 + c^5 == s
sage: sol = solve([eq1, eq2, eq3, eq4], [s, a, b, c])
sage: sol
[[s == (9.666666666666746 + 2.94556046220862e-14*I), a == -0.240011808699075, b == (1.620005904858813 - 0.3914357752931976*I), c == (1.620005904858815 + 0.3914357752931956*I)], [s == (9.666666666666746 - 2.94556046220862e-14*I), a == -0.240011808699075, b == (1.620005904858813 + 0.3914357752931976*I), c == (1.620005904858816 - 0.3914357752931965*I)], [s == (9.666666666666751 + 3.28070903776734e-14*I), a == (1.620005904858813 + 0.3914357752931967*I), b == (1.620005904858812 - 0.3914357752931972*I), c == (-0.2400118097109294 + 2.8091418080578e-13*I)], [s == (9.666666666666785 + 3.01612557994701e-14*I), a == (1.620005904858813 + 0.3914357752931967*I), b == (-0.2400118097176253 + 3.13587902457777e-16*I), c == (1.620005904858814 - 0.3914357752931946*I)], [s == (9.666666666666691 - 2.60902410786912e-15*I), a == (1.620005904858813 - 0.3914357752931967*I), b == (1.620005904858812 + 0.3914357752931972*I), c == (-0.2400118097145694 + 1.53912993461347e-12*I)], [s == (9.666666666666424 - 3.01370197640685e-14*I), a == (1.620005904858813 - 0.3914357752931967*I), b == (-0.2400118097176253 - 2.82969990755139e-16*I), c == (1.620005904858808 + 0.3914357752932017*I)]]

To obtain only the value of s, you can write:

sage: [s[0] for s in sol]
[s == (9.666666666666746 + 2.94556046220862e-14*I),
s == (9.666666666666746 - 2.94556046220862e-14*I),
s == (9.666666666666751 + 3.28070903776734e-14*I),
s == (9.666666666666785 + 3.01612557994701e-14*I),
s == (9.666666666666691 - 2.60902410786912e-15*I),
s == (9.666666666666424 - 3.01370197640685e-14*I)]

From there, you can guess that the value of s is in fact $9.6666666... = 29/3$ and try to prove it.

2. Using polynomials and Gröbner bases: exact solution

sage: R.<a,b,c,s> = QQ[]
sage: f1 = a + b + c - 3
sage: f2 = a^2 + b^2 + c^2 - 5
sage: f3 = a^3 + b^3 + c^3 - 7
sage: f4 = a^5 + b^5 + c^5 - s
sage: I = R.ideal([f1, f2, f3, f4])
sage: G = I.groebner_basis()
sage: G
[c^3 + (-3)*c^2 + 2*c + 2/3, b^2 + b*c + c^2 + (-3)*b + (-3)*c + 2, a + b + c - 3, s - 29/3]

From there you conclude that the only possibility for $s$ is $29/3$.

Of course, you can ask for more to obtain the full list of solutions :

First compute the dimension of I:

sage: I.dimension()
0

Since it is zero, the variety (set of solutions) defined by your ideal is finite, and you can compute the full list:

sage: V = I.variety()
sage: V
[]

This means that there is no solution with all variables set to some rational. But there are solutions in the algebraic ...

more

You can also solve it a bit more directly without explicitly invoking the Groebner basis (this happens under the hood).

sage: R.<a,b,c> = PolynomialRing(QQ,order='lex')
sage: f1 = a+b+c - 3
sage: f2 = a^2+b^2+c^2 - 5
sage: f3 = a^3+b^3+c^3 - 7
sage: Rel = ideal(f1,f2,f3)
sage: Rel.reduce(a^5+b^5+c^5)
29/3

(I came up with this solution after reading the solution to Exercise 37 from the book "Calcul Mathematique avec Sage", given on page 423)

more

Right, that's a much better way to use Gröbner bases than what I proposed!

( 2016-10-24 22:30:28 +0200 )edit