Functions That Do Not Have Unique Values

When you ask for the square root s of a number a, you are effectively asking for the solution to the equation (s^2)==a. This equation, however, in general has two different solutions. Both s==2 and s==-2 are, for example, solutions to the equation (s^2)==4. When you evaluate the "function" (Sqrt[4]), however, you usually want to get a single number, and so you have to choose one of these two solutions. A standard choice is that (Sqrt[x]) should be positive for x>0. This is what the Wolfram Language function (RefLink[Sqrt, paclet:ref/Sqrt])[x] does.

The need to make one choice from two solutions means that (RefLink[Sqrt, paclet:ref/Sqrt])[x] cannot be a true inverse function for x^2. Taking a number, squaring it, and then taking the square root can give you a different number than you started with.

(Sqrt[4]) gives +2, not -2:

Sqrt[4]

Squaring and taking the square root does not necessarily give you the number you started with:

Sqrt[(-2)^2]

When you evaluate (Sqrt[-2i]), there are again two possible answers: -1+i and 1-i. In this case, however, it is less clear which one to choose.

There is in fact no way to choose (Sqrt[z]) so that it is continuous for all complex values of z. There has to be a "branch cut"—a line in the complex plane across which the function (Sqrt[z]) is discontinuous. The Wolfram Language adopts the usual convention of taking the branch cut for (Sqrt[z]) to be along the negative real axis.

This gives 1-i, not -1+i:

N[Sqrt[-2 I]]

The branch cut in (RefLink[Sqrt, paclet:ref/Sqrt]) along the negative real axis means that values of (RefLink[Sqrt, paclet:ref/Sqrt])[z] with z just above and below the axis are very different:

{Sqrt[-2+0.1 I],Sqrt[-2-0.1 I]}

Their squares are nevertheless close:

%^2

The discontinuity along the negative real axis is quite clear in this three-dimensional picture of the imaginary part of the square root function:

Plot3D[Im[Sqrt[x+I y]],{x,-4,4},{y,-4,4}]

When you find an n(^th) root using (z^(1/n)), there are, in principle, n possible results. To get a single value, you have to choose a particular principal root. There is absolutely no guarantee that taking the n(^th) root of an n(^th) power will leave you with the same number.

This takes the tenth power of a complex number. The result is unique:

(2.5+I)^10

There are 10 possible tenth roots. The Wolfram Language chooses one of them. In this case it is not the number whose tenth power you took:

%^(1/10)

There are many mathematical functions which, like roots, essentially give solutions to equations. The logarithm function and the inverse trigonometric functions are examples. In almost all cases, there are many possible solutions to the equations. Unique "principal" values nevertheless have to be chosen for the functions. The choices cannot be made continuous over the whole complex plane. Instead, lines of discontinuity, or branch cuts, must occur. The positions of these branch cuts are often quite arbitrary. The Wolfram Language makes the most standard mathematical choices for them.

Some branch-cut discontinuities in the complex plane.

(RefLink[ArcSin, paclet:ref/ArcSin]) is a multiple-valued function, so there is no guarantee that it always gives the "inverse" of (RefLink[Sin, paclet:ref/Sin]):

ArcSin[Sin[4.5]]

Values of (RefLink[ArcSin, paclet:ref/ArcSin])[z] on opposite sides of the branch cut can be very different:

{ArcSin[2+0.1 I],ArcSin[2-0.1 I]}

A three-dimensional picture, showing the two branch cuts for the function (sin^(-1))(z):

Plot3D[Im[ArcSin[x+I y]],{x,-4,4},{y,-4,4}]