>But which of these steps is wrong?

The law of indices "(a^b )^c =a^bc " doesn't always work. Many laws in maths textbooks are stated in a simplified form that's not 100% precise (because the most precise form is too complicated for students).

Don't worry though. It always work when a is positive and b,c are both real. It also always work when b,c are both integers (regardless of what a is).

>And why?

First let me state the obvious things first to avoid getting downvoted. People in this sub seems to like to just assume that I'm dumb and downvote me if I go straight into the deep reasons without stating the obvious first.

In this particular example you have shown, taking even power canceled the negative. That's the obvious reason.

This doesn't really answer the question of why the law of indices doesn’t always work though. Even powers canceling negatives is just a type of examples of law of indices failing, not exactly the reason.

If you want to figure out exactly when and why does the law of indices hold or not hold, especially in the future if you want to do exponents with irrational exponents or with complex numbers, you need to go a lot deeper.

The actual reason behind this is quite deep. It involves complex analysis, which is undergrad maths material. Don't worry if you don't understand all of these stuff. Just read until you no longer know what I'm talking about, then stop there.

It goes all the way back to how exponents are defined. Consider the expression x^n. When n is a positive integer, that's pretty easy to define. It's just x multiplying itself for n times. When n is a negative integer, it's also easy to define. It's just 1 divided by x for -n times. But what if n is other things? Fractions? Irrational numbers? Complex numbers? What does "5 to the power square root of 2" really mean?

The standard approach is to define x^n to be exp(n*ln(x)), where exp is the exponential function, and "ln" is the natural log (actually pure mathematicians usually use "log" for natural log, but I guess you're more familiar with "ln"). That way, you can define exponents for anything. x and n can be anything. They can be irrational. They can be complex numbers.

(even though your original question doesn't have complex numbers explicitly written out, since logarithm of negative numbers involve complex numbers, ultimately complex numbers are implicitly involved)

Well anyway, so we need to define "exp" and "ln" for any numbers.

The problem comes from trying to define the function "ln(x)" when x is not a positive real number. Any non-zero complex number z can be expressed in the form z=r*e^(iθ), where r is a positive real number and θ is a real number. We define the ln(z) to be ln(r)+iθ. However, there are multiple choices for θ. For example when z=-8, we have r=8, but θ can be -3π, -π, π, 3π, etc.

In your post, when you were claiming that (-8)^(1/3)=-2, you're subtly picking θ to be 3π (or odd multiples of 3π). If you pick θ to be π instead, (-8)^(1/3) would equal to 1+i√3 instead of -2.

Sometimes people try to fix it by fixing an acceptable range for θ to eliminate multiple possibilities. The most common range being chosen is -π<θ≤π, which is called the **principle branch**. I guess that's why another redditor shared Wikipedia page link for "principle branch" under this post.

If you go deep into mathematical analysis on law of indices (which involves messing with power series etc), you'll see that the law of indices always work, but only if you pick the values of θ carefully. It only works when the choices of θ involved in the exponentation in the two sides of the law match up in some abstract sense (and no, always choosing the principle branch doesn't always work, it's more complicated than that).

In your example, the choices of θ you implicitly picked in the exponentation involved don't match up. When you claim that (-8)^1/3 =-2, you picked θ=3π when computing ln(-8). When you claim that 64^1/6 =2, you picked θ=0 (or any multiples of 12π) when computing ln(64). These choices of θ don't match.

(You also declared (-8)^2 =64, but that's true for any choice of θ. When the exponent is an integer, any choice of θ gives you the same value. That's why at the beginning of the post, I said that (a^b )^c =a^bc always work when b,c are both integers.)

For ln(64), θ can actually be any multiples of 2π. Turns out that if you pick θ=6π, you'll end up with 64^1/6 =-2. The two sides of your equation then match.

Probably you would think that I'm insane if I suggested 64^1/6 =-2 at the beginning of the comment. But when you run the complex analysis for the law of indices (-8)^2/6 =((-8)^2 )^1/6 , it'll tell you that θ=3π for ln(-8) corresponds to θ=6π for ln(64). Hence, declaring (-8)^1/3 to be -2 corresponds to declaring 64^1/6 to be -2 in this particular context.