What is the output of this expression:


As far as I know, it should be $-1$. However, wolframalpha outputs a complex number? why?


The problem is that when I compute the expression in R statistical software I also get a complex root ((as.complex(-1))^(1/3)).


I received many good answers and in R I ended up using the following function to get the "real" cubic root of a given number:

Math.cbrt <- function(x) {
  sign(x) * abs(x)^(1/3)
x <- c(-1, -8, -27, -64)

closed as off-topic by Lord Shark the Unknown, Claude Leibovici, user91500, GNUSupporter 8964民主女神 地下教會, B. Goddard Jul 20 '17 at 13:10

This question appears to be off-topic. The users who voted to close gave these specific reasons:

  • "This question is missing context or other details: Please improve the question by providing additional context, which ideally includes your thoughts on the problem and any attempts you have made to solve it. This information helps others identify where you have difficulties and helps them write answers appropriate to your experience level." – user91500, B. Goddard
  • "This question is not about mathematics, within the scope defined in the help center." – Lord Shark the Unknown, Claude Leibovici, GNUSupporter 8964民主女神 地下教會
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ With Wolfie A, you get what you pay for. $\endgroup$ – Lord Shark the Unknown Jul 19 '17 at 5:03
  • $\begingroup$ Typical problem. Try typing cube root of -1 $\endgroup$ – Claude Leibovici Jul 19 '17 at 5:04
  • 2
    $\begingroup$ There are three cube roots of $-1$. Do you know about roots of complex numbers? $\endgroup$ – Sean Roberson Jul 19 '17 at 5:04
  • $\begingroup$ W|A gave you the principal cubic root. $\endgroup$ – Frenzy Li Jul 19 '17 at 5:06
  • 1
    $\begingroup$ @FaCh WA gives you precisely what you asked for, according to their (documented) principal root rules. Compare that to cbrt(-1) or surd(-1,3). $\endgroup$ – dxiv Jul 19 '17 at 5:08

There is no good principled definition of $a^b$ that gives a single real result when when $a$ is a negative real and $b$ is an arbitrary positive real.

In pencil-and-paper mathematics it makes sense to define $x^{1/n}$ for odd $n$ as the inverse function of $x\mapsto x^n$ for real $x$ -- and then extend this to $x^{m/n} = (x^{1/n})^m$ when $n$ is odd and $m$ coprime to $n$.

This defines $a^b$ for negative $a$ and some (but not all) rational $b$s, but comes at the significant cost of not being continuous in $b$ even within its domain -- namely, there are always arbitrarily small (numeric) changes in $b$ that will flip the sign of the output.

This means that in a computer system where real numbers are represented as approximations (e.g. with floating point values), it does not make sense to apply this definition; it cannot in general be trusted to produce an approximation of the pencil-and-paper result.

So Wolfram Alpha and similar systems tend to ignore the $(\sqrt[n]x)^m$ definition and instead jump directly to the multi-valued definition of $z^w$ for complex $z\ne 0$ and $w$, which says $z^w = \exp(w\log z)$ and inherits the multi-valued nature of the complex logarithm. They will then generally return the principal value of $z^w$.

This makes $a^b$ produce a complex value for $a<0$ and $b\notin \mathbb Z$, but at least $a^b$ is then continuous in that domain, such that it makes sense to do that computation with an approximated $b$.

(A semi-symbolic computation system such as W|A could have chosen to check whether it "knows" $b$ as an exact rational with odd denominator, and switch between definitions according to that -- but this might create problems for users who need to have $a^b$ behave continuously in a reasonable $(a,b)$ domain. And it's not clearly unreasonable to come down on the side of those users -- after all, most instances where you meet $a^{m/n}$ in practical mathematics will be ones where $n$ is a known constant so it's reasonable to notate that with a root sign rather than as a power).


In general, non-integer powers of non-positive numbers are multivalued.

The definition of $b^r$ for complex numbers is $\exp(r \log(b))$. However, the logarithm is multivalued: if $y$ is a value of $\log(b)$, so is $y + 2 \pi i n$ for any integer $n$, because $\exp(2 \pi i n) = 1$.

To get rid of the multivaluedness and get an honest-to-goodness function, one chooses a particular branch of the logarithm. A popular choice is the principal branch, sometimes denoted $\text{Log}$, where the imaginary part of $\text{Log}(b)$ is in the interval $(-\pi, \pi]$. In particular, if $b$ is a negative real, we have $\text{Log}(b) = \log(|b|) + \pi i$. Corresponding to this, the principal branch of $b^r$ is $\exp(r \text{Log}(b))$, and if $b$ is a negative real this is $\exp(r \log(|b|) + r \pi i$. In the case at hand, this means the principal branch of $(-1)^{1/3}$ is $$\exp(\pi i/3) = \frac{1+\sqrt{3} i}{2}$$


What you are doing is computing the solution to the algebraic equation $x^3 +1= 0$. The fundamental theorem of algebra state there must be three solutions. In this case there is one real solution and two complex solutions $\omega$ and $\bar{\omega}$ where $\omega = e^{i\pi/3}$. Notice that $\omega^3 = e^{i\pi} = -1$ by Euler's famous formula. However, if we approach the question, "Why did wolfram alpha output this cube root?", the discussion gets more technical. Since solutions to algebraic equations have complex numbers as roots as well, I believe Wolfram Alpha computed the solution via an extension of the cube root to the complex function $z^{1/3}$. This function is multivalued and its standard description has a branch cut along the negative real axis so it omits the solution $-1$, so its principal cube root is then $e^{i\pi/3} = \frac{1}{2}+\frac{\sqrt{3}}{2}i$.


$$\sqrt[3]{-1}=\ \sqrt[3]{\cos\pi+i\sin\pi}=\left\{\cos\frac{\pi+2\pi k}{3}+i\sin\frac{\pi+2\pi k}{3}|k\in\{0,1,2\}\right\}=$$ $$=\left\{\cos(60^{\circ}+120^{\circ}k)+i\sin(60^{\circ}+120^{\circ}k)|k\in\{0,1,2\}\right\}.$$


Not the answer you're looking for? Browse other questions tagged or ask your own question.