Ambiguity in product of all $n$th roots of unity I was studying the product of $n$th roots of unity, and the proof in the book went like this:
$$1\cdot a\cdot a^2\cdot\cdots\cdot a^{n-1}
\\=a^{0+1+2+3...+n-1}
\\=a^{n(n-1)/2}
\\=(\cos\frac{2\pi}n+i\sin\frac{2\pi}n)^{n(n-1)/2}
\\=(\cos2\pi+i\sin2\pi)^{(n-1)/2}
\\=(\cos\pi+i\sin\pi)^{n-1}
\\=(-1)^{n-1}
\\=\begin{cases}-1 &\text{if n is even;} \\1 &\text{if n is odd.}\end{cases}$$
But instead of doing that, if we simplified directly from $(\cos2\pi+i\sin2\pi)^{(n-1)/2},$ we'd get
$$1^{(n-1)/2}=1.$$
So, where exactly was I wrong?
I think the problem basically boils down to
$$(-1)^x=1^{x/2}=1.$$
Obviously, this is wrong, but I can't spot where it is wrong. Also, why is it wrong?
 A: *

*In the complex world, the exponent $\frac1n$ does not conventionally output just the principal root, because such a convention isn't as useful as in the real world, and because there isn't a universally-good way to define principal root in the complex world.
So, $$1^{\frac14}=-i,1,i,-1;$$ similarly, for even $n,$ $$1^{(n-1)/2}\\=\pm1\\\neq1.$$


*In general, a number raised to a non-integer (including complex) power may have multiple values.
Further, when $z\in\mathbb C$ and $\theta\in\mathbb R,$
$$\left(e^{i\theta}\right)^z=e^{z\,i\left(\theta \color{#C00}{+2k\pi}\right)}.\tag{*}$$
A corollary is that when $m\in\mathbb Z$ and $\theta\in\mathbb R,$
$$\left(e^{i\theta}\right)^m=e^{i\,m\theta}.\tag{#}$$


*The proof supplied by the book is misleadingly
hand-wavy, with errors at its $4$th and $5$th ‘=’ (apparently misapplying De Moivre's theorem). Here's a
clearer version: $$1\cdot a\cdot a^2\cdot\cdots\cdot a^{n-1}
\\=a^{0+1+2+3...+n-1} \\=a^{n(n-1)/2}
\\=\left(e^{i\frac{2\pi}n}\right)^{n(n-1)/2}$$
$$=e^{i(n-1)\pi}\tag {applying (#)} \\=\begin{cases}e^{i(\pi)} &\text{if n is even;} \\e^{i(0)} &\text{if n is odd}\end{cases} \\=\begin{cases}-1 &\text{if n is even;} \\1 &\text{if n is odd.}\end{cases}$$
A: Note that $n(n-1)/2$ is an integer. After all, it is a sum of integers.
I think the book makes a blunder by factoring $n(n-1)/2$ into an integer factor $n$ and another factor $(n-1)/2$ that might not be an integer.
By doing this, it reaches a step where it must evaluate $1^{(n-1)/2}.$
This is not necessarily $1$ as you claim.
But it also is not necessarily $-1$ when $n$ is even as the book claims.
As several other answers have pointed out, when dealing with complex numbers we have to treat raising a number to a fractional power as a multivalued function,
and in the case of $n$ even we simply cannot say whether $1^{(n-1)/2}$
is $1$ or $-1.$
What the book's argument does, in fact, is use the fallacious "identity"
$z^{ab} = (z^a)^b$ for complex $z$ and arbitrary rational $a$ and $b.$
The equality sign before $(\cos2\pi+i\sin2\pi)^{(n-1)/2}$ is invalid.
If instead we recall that $n(n-1)/2$ is an integer, we can immediately multiply the argument of $\cos\frac{2\pi}n+i\sin\frac{2\pi}n$  by this integer with no ambiguity and no weird multivalued outputs. Quite simply,
\begin{align}
\left(\cos\frac{2\pi}n+i\sin\frac{2\pi}n\right)^{n(n-1)/2}
&= \cos\left(\frac{n(n-1)}2\cdot\frac{2\pi}n\right)
    + i\sin\left(\frac{n(n-1)}2\cdot\frac{2\pi}n\right) \\
&= \cos\left((n-1)\pi\right) + i\sin\left((n-1)\pi\right) \\
&= \begin{cases}
-1 & \text{$n$ even,} \\
\phantom{-}1 & \text{$n$ odd.}
\end{cases}
\end{align}
A: First,
$$  (-1)^3 = -1  \text{,}  $$
not $1$, as your last paragraph would have us believe.
Here is a difficulty.  Notice that $$  \mathrm{e}^{0 \mathrm{i}} = 1 = \mathrm{e}^{2 \pi  \mathrm{i}}  \text{.}  $$
When we take the complex square root of these three numbers, we use the convention that we obtain a number with the square root of the magnitude and half the argument.  So we should see \begin{align*}
\sqrt{\mathrm{e}^{0 \mathrm{i}}} &= \mathrm{e}^{(0/2) \mathrm{i}} = \mathrm{e}^{0 \mathrm{i}} = 1 \text{,}  \\
\sqrt{1} &= 1  \text{, and} \\
\sqrt{\mathrm{e}^{2 \pi  \mathrm{i}}} &= \mathrm{e}^{\pi  \mathrm{i}} = -1  \text{.}  
\end{align*}
Of course, these three things are not all equal.  To regain equality, we would need to obtain all the square roots of $1$: $\{-1, 1\}$ for all three of these, so we cannot trust the convention to solve all of our problems.
A less confusing way to proceed is to recognize that any complex number has infinitely many magnitude-argument representations.  Perhaps we should look at how those behave.  Throughout, $k$ is permitted to range over the integers.  Arithmetic of magnitudes is arithmetic over the reals, so uses the usual convention that real square roots return nonnegative results.  (This is not a significant restriction, since generally we should be keeping all magnitudes nonnegative, and in the present, $1$ is the only magnitude we will have.)
\begin{align*}
1 &= 1 \cdot \mathrm{e}^{0 + 2 \pi \mathrm{i} k} = \{1\}  \\
1^{1/2} &= 1^{1/2} \mathrm{e}^{0/2 + \pi \mathrm{i} k} = 1 \cdot \mathrm{e}^{0 + \pi \mathrm{i} k} = \{-1,1\} \\
\end{align*}
That is, if we keep track of all the magnitude-argument aliases of our various numbers, we get all of their roots at once.
Let's try this with the development you recite.  Since $a$ is the $n^\text{th}$ root of unity of least positive argument,
$$  a = (\cos(2\pi/n) + \mathrm{i}\sin(2\pi/n)) = \mathrm{e}^{2 \pi \mathrm{i}/n + 2 \pi \mathrm{i} k}  \text{.}  $$
We first need that
\begin{align*}
n(n-1)/2 + n &= (n^2 - n)/2  \\
    &= (n^2 + n)/2 - n  \\
    &= n(n+1)/2 - n
\end{align*}
and $a^{-n} = 1$.  (We don't actually need this.  We can keep "$n-1$" through to the end.  However, to parallel the work you recite, ...)
\begin{align*}
a^{n(n-1)/2} &= (\mathrm{e}^{2 \pi \mathrm{i}/n + 2 \pi \mathrm{i} k})^{n(n-1)/2}  \\
    &= (\mathrm{e}^{2 \pi \mathrm{i}/n + 2 \pi \mathrm{i} k})^{n(n+1)/2 - n}  \\
    &= (\mathrm{e}^{2 \pi \mathrm{i}/n + 2 \pi \mathrm{i} k})^{n(n+1)/2} (\mathrm{e}^{2 \pi \mathrm{i}/n + 2 \pi \mathrm{i} k})^{-n}  \\
    &= (\mathrm{e}^{2 \pi \mathrm{i}/n + 2 \pi \mathrm{i} k})^{n(n+1)/2}  \\
    &= (\mathrm{e}^{2 \pi \mathrm{i} + 2 n \pi \mathrm{i} k})^{(n+1)/2}  \\
    &= (\mathrm{e}^{\pi \mathrm{i} + n \pi \mathrm{i} k})^{n+1}  \\
    &= \mathrm{e}^{(n+1)\pi \mathrm{i}} \cdot \mathrm{e}^{n(n+1) \pi \mathrm{i} k}  \\
    &= \begin{cases}
\mathrm{e}^{(2j+1)\pi \mathrm{i}} \cdot \mathrm{e}^{2j(2j+1) \pi \mathrm{i} k}  ,&  n = 2j, j \in \Bbb{Z}  \\
\mathrm{e}^{(2j+2)\pi \mathrm{i}} \cdot \mathrm{e}^{(2j+1)(2j+2) \pi \mathrm{i} k}  ,&  n = 2j+1, j \in \Bbb{Z}  
\end{cases}  \\
    &= \begin{cases}
(-1) \cdot (1)  ,&  n = 2j, j \in \Bbb{Z}  \\
(1) \cdot (1)  ,&  n = 2j+1, j \in \Bbb{Z}  
\end{cases}  \\
    &= \begin{cases}
-1  ,&  n \text{ is even}  \\
1  ,&  n \text{ is odd}
\end{cases}  \text{,}
\end{align*}
correcting the error in the last line of your recitation.  Notice that the calculation shows that during the sequence of operations the "${} + 2 \pi \mathrm{i} k$" is modified in various ways, but at the end, all of the alternatives produced by varying $k$ have been collapsed back to a single complex number.  During the process, this was not always true.  As $k$ ranges over the integers, $\mathrm{e}^{\pi \mathrm{i} + n \pi \mathrm{i} k}$ is $\{-1\}$ if $n$ is even and is $\{-1,1\}$ if $n$ is odd.
