# How do I make Mathematica understand roots of unity?

Try the following:

z = Exp[2 \[Pi] I / 5]

Z = { { z, 1 }, { 0, 1/z } }

Simplify[MatrixPower[Z, 5]] //MatrixForm


Of course, this should return a 2 x 2 identity matrix. Instead, we get:

{{1, 1 - (-1)^(1/5) + (-1)^(2/5) - (-1)^(3/5) + (-1)^(4/5)}, {0, 1}}


That is, Mathematica doesn't seem to understand that summing these roots of unity gives zero. Is there some way to make it realize this?

-

Try FullSimplify:

m = {{1, (1 - (-1)^(1/5) + (-1)^(2/5) - (-1)^(3/5) + (-1)^(4/5)) b}, {0, 1}};

m // FullSimplify


{{1, 0}, {0, 1}}

Alternatively, for this very specific situation you can use the ExpToTrig function which will convert expressions of the form $(-1)^\alpha$ to $\cos (\pi \alpha )+i \sin (\pi \alpha )$. When written in this form, the terms cancel trivially, thus the simplification is done automatically. ExpToTrig will be a bit faster, in case this matters in your application or you have huge expressions on which FullSimplify is very slow.

ExpToTrig[m]


{{1, 0}, {0, 1}}

-
Thanks for the edit! – István Zachar Jun 4 '12 at 9:33
ComplexExpand also works here. – Mr.Wizard Jun 4 '12 at 9:42

As István says, FullSimplify[MatrixPower[Z, 5]], is the usual way to do things when Simplify[] just isn't cutting it. ExpToTrig[]/ComplexExpand[] are very handy in this specific application as well, but if you've already done the work with Simplify[] as with the OP, the only further push needed can be done via RootReduce[]:

Simplify[MatrixPower[Z, 5]]
{{1, 1 - (-1)^(1/5) + (-1)^(2/5) - (-1)^(3/5) + (-1)^(4/5)}, {0, 1}}

RootReduce[%]
{{1, 0}, {0, 1}}

-
Thanks! Upvoted both answers; sad I can only accept one. – Daniel McLaury Jun 4 '12 at 20:26