7
$\begingroup$

I want to know what $ a^4+b^4+c^4 $ would be when

$ a+b+c=1, a^2+b^2+c^2=2, a^3+b^3+c^3=3. $

I tried

Solve[{a + b + c == 1, a^2 + b^2 + c^2 == 2, 
a^3 + b^3 + c^3 == 3}, {a, b, c}]

a^4 + b^4 + c^4 /. {a -> ... }

I copied and pasted one instance from the result of Solve[] into {a -> ...}

The solution and the result of Simplify[] of it was not quite what I expected.

So as a test, I tried a+b+c /. {a -> ...}

Still it was strange, it didn't come up with 1 which is obvious correct answer.

So am I missing anything here?

Is there any better way?

$\endgroup$
1
  • $\begingroup$ As a quick check, try sol=Solve[...] and then 1. (a + b + c) /. sol. $\endgroup$ May 30, 2013 at 15:06

4 Answers 4

14
$\begingroup$

Solve your equations with respect to another variable d == a^4 + b^4 + c^4 eliminating given ones

Solve[{ a + b + c == 1,       a^2 + b^2 + c^2 == 2, 
        a^3 + b^3 + c^3 == 3, a^4 + b^4 + c^4 == d},  {d}, {a, b, c}]
{{d -> 25/6}}

This tutorial will be helpful Eliminating Variables.

Edit

For the sake of completeness we add another methods of dealing with the problem. Let's point out even simpler way than the first one, just add assumptions to Simplify:

Simplify[ a^4 + b^4 + c^4, {a + b + c == 1, a^2 + b^2 + c^2 == 2, a^3 + b^3 + c^3 == 3}]
25/6

Of course we can use FullSimplify as well. In this case, Simplify works nicely, but the first method is stronger and should work in more general cases.

SymmetricReduction is more appropriate when we would like to get symbolic results, i.e. here we would like to express a^4 + b^4 + c^4 in terms of these polynomials: {a + b + c, a^2 + b^2 + c^2, a^3 + b^3 + c^3}

First we need to get rid of unknown symmetric polynomials (we know only a + b + c):

 SymmetricPolynomial[#, {a, b, c}] & /@ Range[3]
{a + b + c, a b + a c + b c, a b c}

form the last reduction using the previous ones:

First @ SymmetricReduction[ a^# + b^# + c^#, {a, b, c}] & /@ Range[4] // Column
a + b + c

(a + b + c)^2 - 2 (a b + a c + b c)

3 a b c + (a + b + c)^3 - 3 (a + b + c) (a b + a c + b c) 

4 a b c (a + b + c) + (a + b + c)^4 - 4 (a + b + c)^2 (a b + a c + b c)
+ 2 (a b + a c + b c)^2

Now we have a^4 + b^4 + c^4 expressed in terms of given polynomials:

str = 
First[ SymmetricReduction[ a^4 + b^4 + c^4, {a, b, c}]] //. {
  (a b + a c + b c) -> 1/2 (a + b + c)^2 - 1/2 (a^2 + b^2 + c^2),
  (a b c) -> 1/3 (a^3 + b^3 + c^3) - 1/3 (a + b + c)^3 + (a + b + c) (a b + a c + b c)}
 (a + b + c)^4 - 4 (a + b + c)^2 (1/2 (a + b + c)^2 + 1/2 (-a^2 - b^2 - c^2))
 + 2 (1/2(a + b + c)^2 + 1/2(-a^2 - b^2 - c^2))^2 + 4(a + b + c) (-(1/3)(a + b + c)^3
 + 1/3 (a^3 + b^3 + c^3) + (a + b + c) (1/2 (a + b + c)^2 + 1/2 (-a^2 - b^2 - c^2)))

of course

Simplify @ %
a^4 + b^4 + c^4

and finally:

str /. {a + b + c -> 1, (-a^2 - b^2 - c^2) -> -2, (a^3 + b^3 + c^3) -> 3}
25/6
$\endgroup$
8
$\begingroup$

It seems that the route using elementary symmetric functions has been neglected, so I'll discuss this. Recall that by Newton-Girard, one can always express power sums in terms of the elementary symmetric polynomials. Mathematica has the function SymmetricReduction[] that allows you to express power sums in terms of the elementary symmetric polynomials; now, when given values for the power sums, one can obtain the values for the corresponding elementary symmetric polynomials, and then use these to evaluate higher-order power sums. In particular, you can do the following:

First @ SymmetricReduction[a^4 + b^4 + c^4, {a, b, c}, C /@ Range[3]] /. 
     First @ Solve[Table[
           First[SymmetricReduction[a^k + b^k + c^k, {a, b, c},C /@ Range[3]]] == k,
                         {k, 3}], C /@ Range[3]]

which gives the result $25/6$.

$\endgroup$
12
  • $\begingroup$ Interesting: SymmetricReduction eliminates the need for FullSimplify and is about 100 times faster on my machine. Not a "simple" presentation, but effective. $\endgroup$
    – rcollyer
    May 30, 2013 at 18:46
  • $\begingroup$ I consider it "simple" in the sense that the elementary symmetric polynomials are "nicer" to handle than power sums. Of course, looking at how this answer has been received, the mathematical advantages are not fully appreciated by most... $\endgroup$ May 30, 2013 at 18:55
  • $\begingroup$ @J.M. Exactly, why use mathematics if you have Mathematica:)? $\endgroup$
    – Ajasja
    May 30, 2013 at 19:06
  • $\begingroup$ @Ajasja, let the computer do the thinking instead of your brain, why not... :) $\endgroup$ May 30, 2013 at 19:07
  • $\begingroup$ Even in the era of super fast computing, we are still in need of faster algorithms and always will be... :) $\endgroup$
    – KH Kim
    May 30, 2013 at 20:03
6
$\begingroup$

Artes has the obvious answer, but there are a couple of other methods that work.

a = Solve[{a + b + c == 1, a^2 + b^2 + c^2 == 2, a^3 + b^3 + c^3 == 3}, {a, b, c}]

You can get the numerical equivalent:

a^4 + b^4 + c^4 /. a // N
(*
 {4.16667 - 1.28618*10^-15 I, 4.16667 - 2.86492*10^-16 I, 
  4.16667 + 1.28618*10^-15 I, 4.16667 + 2.86492*10^-16 I, 
  4.16667 + 0. I, 4.16667 + 0. I
 }
*)

where it is obvious that the imaginary parts are due to numerical error, and can be taken care of using Chop. Perhaps the other most obvious method is to use Simplify, but it does not give anything that is helpful. So, next in line is its big brother FullSimplify:

b = a^4 + b^4 + c^4 /. a // FullSimplify
(*
 {25/6, 25/6, 25/6, 25/6, 25/6, 25/6}
*)

For sanity sake,

N @ b
(*
 {4.16667, 4.16667, 4.16667, 4.16667, 4.16667, 4.16667}
*)
$\endgroup$
4
$\begingroup$
Solve[{a + b + c == 1, a^2 + b^2 + c^2 == 2, a^3 + b^3 + c^3 == 3, 
  a^4 + b^4 + c^4 == d}, d, MaxExtraConditions -> Infinity]

(*
{{d -> ConditionalExpression[25/6, 
    a + b + c == 1 && -b + b^2 - c + b c + c^2 == 1/ 2 && -c - 2 c^2 + 2 c^3 == 1/3]}}
*)

Reduce[{a + b + c == 1, a^2 + b^2 + c^2 == 2, a^3 + b^3 + c^3 == 3, 
  a^4 + b^4 + c^4 == d}]

(*
 d == 25/6 && (c == Root[-1 - 3 #1 - 6 #1^2 + 6 #1^3 &, 1] || 
   c == Root[-1 - 3 #1 - 6 #1^2 + 6 #1^3 &, 2] || 
   c == Root[-1 - 3 #1 - 6 #1^2 + 6 #1^3 &, 3]) && (b == 
    1/2 (1 - c - Sqrt[3 + 2 c - 3 c^2]) || 
   b == 1/2 (1 - c + Sqrt[3 + 2 c - 3 c^2])) && a == 1 - b - c
*)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.