Why doesn't $(x^a)^b$ always equal $x^{ab}$ In middle school, I was taught that $(x^a)^b = x^{ab}$. Of course, we were only looking at $a, b \in \mathbb{N}$.
So today I was playing around with squares, and I tried to do this:
$$(x^\sqrt{2})^{\sqrt{2}} = x^{\sqrt{2}\cdot\sqrt{2}} = x^2$$
But then doing some tests in Wolfram alpha told me that I'm wrong for $x<0$. I know that we're dealing with complex numbers here, but I don't see why this would break that law.
My question is: Why can't I use this law in this situation? Is there an intuitive explanation for this?
 A: For $a>0$ and $b\in \Bbb N$, $a^0 = 1$ and $a^b = a \times \cdots \times a$ ($b$ times) for $b \ge 1$. For $b \in\Bbb Z$, $a^b = \frac1{a^{-b}}$. For $b\in \Bbb R \setminus \Bbb Z$:

$$a^b = \exp(b \ln a)$$

No need to freak out, though, because all the rules you like still hold. Note that there are other possible ways to define $a^b$ when $b$ is non-integer real number, but this is the simplest one of them. 
However, for $a < 0$, 

$$a^b = \exp(b \log a)$$

where $\log$ is (some branch of) the complex logarithm function, which is defined for $z \in \Bbb C^*$ as:

$$\log z = \ln|z| + i\arg(z)$$

where some branch of $\arg$ is pre-chosen. And $\exp$ is the complex exponential function.
Now consider that for $a<0$, one has:
$$a^{bc} = \exp(bc \log a), \text{ and} \\ (a^b)^c = \exp(c\log(a^b))$$
These two would be equal only if $\log a^b = b \log a$, but unfortunately that's not true. For instance, assuming that we are dealing with the principal branch of logarithm, $\log((-1)^2) = \log 1 = 0$, while $\log(-1) = \ln|-1| + i\arg(-1) = i\pi$, and $0 \neq 2i\pi$.
