Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

share|improve this question
    
As a quick check, try sol=Solve[...] and then 1. (a + b + c) /. sol. –  b.gatessucks May 30 '13 at 15:06

4 Answers 4

up vote 13 down vote accepted

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
share|improve this answer

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$.

share|improve this answer
    
Interesting: SymmetricReduction eliminates the need for FullSimplify and is about 100 times faster on my machine. Not a "simple" presentation, but effective. –  rcollyer May 30 '13 at 18:46
    
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... –  J. M. May 30 '13 at 18:55
    
@J.M. Exactly, why use mathematics if you have Mathematica:)? –  Ajasja May 30 '13 at 19:06
    
@Ajasja, let the computer do the thinking instead of your brain, why not... :) –  J. M. May 30 '13 at 19:07
    
Even in the era of super fast computing, we are still in need of faster algorithms and always will be... :) –  KH Kim May 30 '13 at 20:03

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}
*)
share|improve this answer
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
*)
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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