How to reconcile the identity $\left( e^{i \theta} \right)^{1/2} = e^{i \theta/2}$ with the fact that $a^2 = b$ is solved by $a = \pm\sqrt{b}$

So I worked along the lines of the following:

$$
\left( \cos \left( \theta \right) + i \sin \left( \theta \right) \right)^{\alpha} = \left( e^{i \theta} \right)^{\alpha} = e^{i (\theta \alpha)} = \cos \left( \theta \alpha \right) + i \sin \left( \theta \alpha \right)
$$

with $i$ the imaginary number, $\theta$ real and $\alpha$ real and $\sin , \cos$ the normal trig functions

However if we take $\alpha = \frac{1}{2}$ a fellow member saw that

$$
\left( \cos \theta + i \sin \theta \right)^{1/2} = \left\{ \begin{array}{l} \cos \left( \frac{\theta}{2} \right) + i \sin \left( \frac{\theta}{2} \right) \\ \cos \left( \frac{\theta}{2} + \pi \right) + i \sin \left( \frac{\theta}{2} + \pi \right) \end{array}\right.
$$

which, from my perspective comes down to the fact that $a^2 = b$ can be solved as $a = \sqrt{b} \lor a = -\sqrt{b}$. I feel as though either I’m being very silly (as per usual) or there’s something deep going on here that I’m missing

Solutions Collecting From Web of "How to reconcile the identity $\left( e^{i \theta} \right)^{1/2} = e^{i \theta/2}$ with the fact that $a^2 = b$ is solved by $a = \pm\sqrt{b}$"

The issue I’m not understanding is why you can only raise to an integer power

To stay focussed on the question asked by the OP, and at the risk of repeating what @Hagen explained from the start, there is no such thing as a function $z\mapsto z^\alpha$ on the complex plane except when $\alpha$ is an integer.

Hence you are in trouble from the second line of your post on, when you consider the nonexistent quantity
$$
\left( \cos \left( \theta \right) + \mathrm i \sin \left( \theta \right) \right)^{\alpha}.
$$
As an example, assume that $\alpha=\sqrt2$ and $\theta=\frac\pi2$, then
$$
\cos \left( \theta \right) + \mathrm i \sin \left( \theta \right) =\mathrm i=\mathrm e^{\mathrm i(2k\pi+\pi/2)},
$$
for every integer $k$, hence legitimate looking candidates to be the $\sqrt2$th power of $\mathrm i$ are
$$
\mathrm e^{\mathrm i\sqrt2(2k\pi+\pi/2)}=\mathrm e^{\mathrm i\pi/\sqrt2}\cdot\mathrm e^{\mathrm i2\sqrt2 k\pi}.
$$
Since $\sqrt2$ is irrational, the set of fractional parts of the numbers $\sqrt2 k$ for every integer $k$ is dense in $[0,1]$, thus, for every $\varphi$ in $[0,2\pi]$ there exists some $k$ such that $2\pi\sqrt2 k$ is as close as one wants to $\varphi$. In particular, $\mathrm e^{\mathrm i2\sqrt2 k\pi}$ can be made as close as one wants to $\mathrm e^{\mathrm i\varphi}$, for every possible angle $\varphi$. Thus, you could declare that the $\sqrt2$th power of $\mathrm i$ is as close as one wants from every point on the unit circle.

Let me only hope that this state of affairs makes you worry about the mere existence of any quantity defined as the $\sqrt2$th power of $\mathrm i$…

Tpofofn’s hint is huge:

$$\bullet\;\;\;\left(\cos\frac\theta2+i\sin\frac\theta2\right)^2=\cos^2\frac\theta2-\sin^2\frac\theta2+2i\cos\frac\theta2\sin\frac\theta2=\cos\theta+i\sin\theta$$

$$\bullet\;\;\left(\cos\left(\frac\theta2+\pi\right)+i\sin\left(\frac\theta2+\pi\right)\right)^2=\left(-\cos\frac\theta2-i\sin\frac\theta2\right)^2=\ldots$$

You can complete the exercise above and see that both leftmost expressions above are square roots of the same complex number $\,\cos\theta+i\sin\theta\;\ldots$

What you are seeing is fundamentally driven by the fact that $\sin$ and $\cos$ are periodic. You obviously know that

$$\sin(\theta) = \sin(\theta + 2\pi) = \sin(\theta +2\pi n)$$

likewise for $\cos$. We conclude therefore that the same applies to

$$e^{i(\theta+2\pi n)}.$$ When we raise Euler’s formula to an integer power, this makes no difference (i.e. we get the same answer for all values of $n$), however when raised to a fractional power, different values of $n$ yield different values, which is what you observed in your post.