7

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?

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
KH Kim
  • 253
  • 1
  • 3

4 Answers4

14

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
Artes
  • 57,212
  • 12
  • 157
  • 245
8

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

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
  • 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.'s missing motivation 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.'s missing motivation 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
  • @KHKim, yes, but as you see, the lazy solution is preferred by more people, at least in this case. – J. M.'s missing motivation May 30 '13 at 20:06
  • @J.M. Oh I might as well take your answer if I could. Thank you for the excellent answer. But to my shame, I can't understand it! I better look at it later. And I think recognizing a symmetric expression would be a piece of cake for Mathematica, so I wonder why the developers couldn't fit it in so that we should ponder on it and express it explicit! – KH Kim May 30 '13 at 20:12
  • @KHKim, probably because recognizing the symmetry programmatically would be more trouble than it's worth, and one can instead choose to use a slower, but more general algorithm. Again: computers do not have to think. – J. M.'s missing motivation May 30 '13 at 20:15
  • @KHKim, I'm not normally nice, but I'll make an exception for you today: elementary symmetric polynomials; Newton-Girard. Read up, and (hopefully) enjoy. – J. M.'s missing motivation May 30 '13 at 20:19
  • @J.M. Thank you for your exception and exceptional niceness. :) – KH Kim May 30 '13 at 20:37
  • @J.M. I like your answer (+1), nonetheless your solution has been lazy too, so I've just made mine a bit more elaborated. – Artes May 30 '13 at 21:56
  • @Artes, too bad I cannot upvote again, but I do notice you chose not to use the third argument of SymmetricReduction[]... ;) BTW, by "lazy", I meant one just chucks the equations to be solved into Solve[]; that certainly does not need much thought, but is convenient when the operator is not mathematically sophisticated. – J. M.'s missing motivation May 31 '13 at 01:08
6

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}
*)
rcollyer
  • 33,976
  • 7
  • 92
  • 191
4
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
*)
chyanog
  • 15,542
  • 3
  • 40
  • 78