# Why does Mathematica give this ArcSin result?

The code

N[ArcSin]


evaluates to

1.5708 − 1.31696 I


but it should be undefined instead because it is on the branch cut: Why is that?

• "but it should be undefined instead because it is on the branch cut." - could you clarify what you mean? FWIW, here is the branch cut convention used by ArcSin[] (This and this are apropos.) – J. M. is in limbo Nov 11 '15 at 4:22
• ...and Limit[{ArcSin[2 + I ε], ArcSin[2 - I ε]}, ε -> 0] // N gives the results I expect. – J. M. is in limbo Nov 11 '15 at 4:25
• Here is a simpler example you might appreciate: consider Limit[{Log[-3 + I ε], Log[-3 - I ε]}, ε -> 0]. Either of the two values could be chosen as the actual value of $\log(-3)$; it happens that the default convention chooses the first one, and the inverse trigonometric/hyperbolic functions inherit the consequences of branch cut choice for the logarithm and square root. – J. M. is in limbo Nov 11 '15 at 4:39
• @J.M. I think this question can admit an answer consisting of your comments here. Your seemingly encyclopedic knowledge of the (sometimes obscure) literature never ceases to amaze me. – Oleksandr R. Nov 11 '15 at 10:10
• Hey guys, if you really want me to write an answer to this, don't close it, y'know. :P – J. M. is in limbo Nov 11 '15 at 16:48

# I. $\sqrt{z}$

Quick, what's the square root of $4$?

• If you said $2$, you're right!
• If you said $-2$, you're right!

Wait, what?

Solve[x^2 == 4, x]
{{x -> -2}, {x -> 2}}


A lot of functions have the problem of not having a unique inverse. That is, if you ask what are the possible values an inverse can take, you might end up with two, three, maybe even infinitely many possibilities. But, if you recall that we want our functions to be injective (one-to-one), even inverse ones, we end up with a hard conclusion:

## We have to make a choice.

That is, for $\sqrt{4}$ to make sense as the result of the function $\sqrt{z}$ for $z=4$, we can pick only one of $2$ or $-2$ as the result. By convention (that is, people agreed upon this), we pick $\sqrt{4}=2$, and thus denote the other possibility as $-\sqrt{4}=-2$.

Put in pictures, we don't want a function like this: What we want, no, expect from an injective inverse is this: Thus far, I've only tackled the square root for real arguments. For complex arguments, however, we still want $\sqrt{z}$ to be injective. The picture changes, though. We now have to look at the notion of a Riemann surface. Put simply, a Riemann surface is a way to visualize how a function with two or more possible values behaves when fed complex arguments. For $\sqrt{z}$, it looks like this:

ParametricPlot3D[{r Cos[θ], r Sin[θ], Im[Sqrt[r] Exp[I θ/2]]}, {r, 0, 2}, {θ, 0, 4 π}] Notice how the surface winds over itself like that? That's the behavior of a multivalued function's Riemann surface. In making a choice (and thus imposing injectivity), we come at the concept of a branch cut. Crudely put, to make a choice, we have to "slice" the surface somewhere to restore the one-to-one property. In particular, the choice that was agreed upon slices like this:

ParametricPlot3D[{r Cos[θ], r Sin[θ], Im[Sqrt[r] Exp[I θ/2]]}, {r, 0, 2}, {θ, -π, π}] This particular "slice" is now what's referred to as the principal value or principal branch.

Notice the consequence of making a choice? We've lost continuity in the process. Can't have 'em all, can we?

Note how the surface was cut at the ray $(-\infty,0)$. In picking this branch cut and putting the discontinuity there, we are faced with one final choice: what should the square root of numbers in that ray be?

Limit[{Sqrt[-4 + I ε], Sqrt[-4 - I ε]}, ε -> 0]
{2 I, -2 I}


Again, by convention, the first value was picked to be the principal value; thus, evaluating at the branch cut gives results like this:

Sqrt[-4]
2 I


# II. $\log z$

The situation for the logarithm is a bit more complicated. Since $\exp(z+2\pi i k)=\exp(z)$ for any integer $k$, we can expect the Riemann surface of its inverse to have many (in fact, infinite!) branches: Here, then, it is more important to pick which of these many branches should be the principal branch. Our predecessors settled on this: The cut was once more chosen to be at $(-\infty,0)$. (The choice makes sense for consistency's sake with roots like in the previous example, by considering the identity $z^r=\exp(r\log(z))$.)

Again, there is one last choice to be made:

Limit[{Log[-1 + I ε], Log[-1 - I ε]}, ε -> 0]
{I π, -I π}


Once more, the value at the upper part of the cut (that is, the one with positive imaginary part) is picked by convention:

Log[-1]
I π


This is the notion of counterclockwise continuity, as espoused by Velvel Kahan. (That paper, in fact, was where most of these conventions for elementary functions was spelled out.)

# III. $\arcsin z$

Finally, we come to the function in the OP's question. Recall that

$$\sin z=\frac{\exp(iz)-\exp(-iz)}{2i}$$

and we see that there are also many possible values for $\arcsin z$: In the interest of making everything consistent (see again Kahan's paper linked above), it was decided to define $\arcsin(z)$ in this way:

$$\arcsin(z)=-i\log(iz+\sqrt{1-z^2})$$

Arranged like this, and considering the choices made earlier, arcsine now has two cuts, at $(-\infty,-1]$ and $[1,\infty)$. With these cuts, now comes the choice of which value to take on the positive cut:

Limit[{ArcSin[2 + I ε], ArcSin[2 - I ε]}, ε -> 0] // N
{1.5707963267948966 + 1.3169578969248166 I,
1.5707963267948966 - 1.3169578969248166 I}


In this case, it works out to arcsine having to take values below the cut:

ArcSin // N
1.5707963267948966 - 1.3169578969248166 I


(For the negative cut, the value above the cut is taken.)

If you've read this far, thanks a lot. Allow me to present a few more references for your perusal.

This paper is a further discussion of the consequences of the choices of cuts that we've made.

This paper further explores the consequences of choosing counterclockwise continuity for the logarithm.

Finally this paper shows how to depict the Riemann surfaces I've displayed in this answer.

There's a lot more that I did not cover or glossed over, but I feel it best to end here.

• On a separate note I'll add this remark. It is sometimes claimed that Log, Sqrt, and friends should be treated as "multifunctions". I believe I have been involved in threads to that effect on MathGroup for example the thread titled "Sqrt of a complex number". The salient point, in my view, is that these need to be bona fide "functions" that return, for suitable input, numerical results. From that point it becomes a matter of design as to what to do for branch cuts (we use a fairly standard convention there). – Daniel Lichtblau Nov 12 '15 at 16:43
• Also, here's a blog post about inconsistencies in the definition of ArcCot among different CAS's. – Chip Hurst Nov 12 '15 at 16:48
• @Chip, funnily enough, the Corless/Davenport paper I linked to above uses exactly the arc-cotangent to highlight the lack of a standard definition for cuts (at least, back in the day). – J. M. is in limbo Nov 12 '15 at 16:53
• @Daniel, I suppose those people who want the multivalued-ness made explicit should be pointed to Reduce[]. Hmm, I guess I forgot to link to Trott's series of articles, but that might be overwhelming for the OP. – J. M. is in limbo Nov 12 '15 at 16:56
• @Chip, sure! (1), (2), (3), (4), (5), (6). I'm still miffed that he never got around to the special functions, tho. – J. M. is in limbo Nov 12 '15 at 17:12