math fallacy problem: $-1= (-1)^3 = (-1)^{6/2} = \sqrt{(-1)^6}= 1$? I know there is something wrong with this but I don't know where. It's some kind of a math fallacy and it is driving me crazy. Here it is:
$$-1= (-1)^3 = (-1)^{6/2} = \sqrt{(-1)^6}= 1?$$

There is a simpler version of this fallacy: $-1 = (-1)^{2/2} = \sqrt{(-1)^2} = \sqrt{1} = 1$. The mistake comes from the fact that the function $f(x)=x^2$ is not invertible so you cannot conclude that for any real number $x$ it is the case that $x = \sqrt{x^2}$.
There is a version of the same mistake that uses the fact that $log$ is not invertible on $\mathbb{C}$ to prove that all numbers equal 1:
$x = e^{\ln(x)} = e^{\ln(x) * (2\pi i) / (2\pi i)} = (e^{2\pi i})^{\ln(x)/2\pi i} = (\cos(2\pi)+i \sin(2\pi))^{\ln(x) / 2\pi i} = 1^{\ln(x) / 2\pi i} = 1$
