# The Principal and the Piecewise - Complex Roots

## May 16, 2021 | 10 minutes, 25 seconds

# Introduction

I cannot begin to tell you how frustrating the process of getting to this point has been. As someone with a fairly rudimentary knowledge of complex numbers and how branches of functions work in the complex plane, it's been an experience getting to terms with things like roots again in this new context. Square roots, cube roots, whathaveyou. But it all started with \(\left|x\right|\).

I claimed that \(|x| = \sqrt{x^2}\) - and it is. Sometimes. The square root operator in most contexts gives us the principal branch of the square roots of a given number. That is - give any number, say \(9\), and you wanted to take the square root - you'd be inclined to say \(3\). Some would be inclined to also give \(-3\). And technically both are correct, but one is used far more often when we're not talking about complex numbers unless we're solving for the roots of an equation (which we'll end up doing anyway, ironically).

It turns out \(|x| = \sqrt{x^2}\) if we only talk about the principal branch of the square root. But... if we're going to do that - it's also equal to \(\sqrt[4]{x^4}\) or \(\sqrt[6]{x^6}\) and so on and so forth. So naturally, at the time, I wanted to prove the first definition - e.g. \(\sqrt{x^2}\) was piecewise (which is a complicated philosophical matter and TL:DR everything is piecewise). So I started. And eventually that lead me on to trying to extend this to complex numbers and higher order roots - using strictly the principal root.

Naturally, when we consider the roots of a complex number, we have to consider all of them. There are a number of complex numbers that can be raised to some power to get a single complex number. But in this context, what we want to do is consider and 'pull' all of those complex numbers into a single complex number, similar to how we use the absolute value to pull the negative numbers on to the positive number line. Instead of \(\sqrt{x^2}\) we start talking about \(\sqrt{z^2}\) (boring!) or \(\sqrt[3]{z^3}\) (fun!) - we talk about in what ways complex numbers in other regions of the complex plane can be pulled together to a single region. What function would give us that. And how then do we talk about this in full generality? That is: how can we define \(\sqrt[n]{x^n}\)?

# The Tools

## The Piecewise Stratagem

Piecewise will take over the world! Or has it already? A strategem, or a strategy? All these unanswered questions. But realistically, it already has. Here I'll present to you an argument for writing functions in terms of piecewise functions under separate intervals. In this section I'll only present a simple example in terms of functions - but this methodology can an will be extended to things like complex numbers.

Consider the function \(f:\mathbb{D}\to\mathbb{R}\). We can write our function \(f(x)\) as the following:

\[ f(x) = \begin{cases} f_{1}(x) & g(x)\in \mathbb{D}_{1} \\ \vdots & \vdots \\ f_{n}(x) & g(x)\in \mathbb{D}_{n} \end{cases}\]

Consider \(\forall i\in \left\{1,\dots,n\right\}\) that \(f(x) = f_{i}(x)\). Consider the case where \(f(x)\) is, for example, an inverse or a composed function. We can apply the inverse of that - or one of the functions - in order to solve for *all* (or most) possibilities of \(f_{i}(x)\). However many solutions for our functions is how many functions there are in our piecewise function.

The next step is to solve for the intervals of our functions. Assuming, for example, that \(f_{i}(x)\) is a transformation of our original function \(f(x)\) of some kind, we can say that \(f(x)\in\mathbb{D} \implies f_{i}(x)\in\mathbb{D}\) and solve from there. (That is, equate the two functions and apply a transformation to the domain of \(f(x)\) to obtain the domain of \(f_{i}(x)\)).

And thus we're done constructing our piecewise equation.

It's easier with a concrete example. Applying this logic to say, \(\sqrt{x^2}\) we have that \(f_{i}(x)=\sqrt{x^2} \implies f_{i}(x)^2-x^2=0\). And therefore \(f_{i}(x) = x\) or \(f_{i}(x) = -x\). Since we know that \(\forall x\in \mathbb{R}: \sqrt{x^2} \geq 0\) (principal branch!), we can say that for \(\sqrt{x^2}=x\), that \(x\geq 0\). Similarly for \(-x\), we have \(-\sqrt{x^2}=x\) and therefore \(x\leq 0\). We thus obtain:

\[ \sqrt{x^2} = \begin{cases} x & x\geq 0 \\ -x & x\leq 0 \end{cases}\]

We will apply this later.

## Introduction to the Principal Argument

The principal argument essentially tells us the angle of a complex number (in polar coordinates) mapped to \(\left(-\pi,\pi\right]\). We denote this \(\operatorname{Arg}(z)\) - not to be confused with \(\operatorname{arg}(z)\), which tells us all possible angles of a single complex number in polar coordinates. The existence of such a function is important to denoting where a complex number lies in the plane in a finite number of ways (well, one way, to be precise).

In our case, this is important. Let us (finally!) consider the 'function' \(\sqrt[n]{x^n}\) for \(n\in\mathbb{R}^{+}\).

Suppose that \(\operatorname{Arg}(z) \in \left(-\pi, \pi\right]\). Then if \(w=z^n, \operatorname{Arg}(w)\in \left(-\pi, \pi\right]\). Now we can take the principal root of \(w\) - and so under the strictest conditions, \(\operatorname{Arg}(w^\frac{1}{n})\in \left(-\frac{\pi}{n}, \frac{\pi}{n}\right]\). This is an absolutely critical fact because it applies to *all* complex numbers under this (also don't mind the handwaviness of Arg function - it'll become important later on, but for now we're simply applying modulo \(2\pi\) here to our intervals).

If you want to read up more on the principal argument and handwaving - see this particular Wikipedia article.

This will become our tool for solving for intervals of complex numbers. We'll also call this our first lemma (is there a second?).

# Principal Root!

By our piecewise solving tool, suppose we have complex numbers \(w_{k}\) for \(k\in \left\{0,\dots,n-1\right\}\), where \(\sqrt[n]{z^n}=w_{k}\). Solving, we have the equation:

\[ w_{k}^n=z^n\]

For \(z=0\) we have \(w_{k} = 0 \implies \sqrt[n]{z^n}=0\) (so we have a conforming solution here - as we'll see). We can then solve this equation by solving via roots of unity. That is:

\[ \frac{w_{k}}{z}=e^{\frac{i2k\pi}{n}}\]

And therefore:

\[ w_{k} = e^{\frac{i2k\pi}{n}}z \]

Notice here that we're using \(k\) in the exponent of our roots of unity. This is because our solutions already span \(k\in \left\{0,\dots,n-1\right\}\) which is exactly where our roots of unity lie - and thus how many solutions we have (clever, huh? Also a smidge cheeky - sorry!). Also notice this maps all of our complex numbers via the principal argument and root using all the roots of unity. Absolutely beautiful.

To obtain the intervals we have to use the principal argument function. However, because there is a possibility our modified angle will lie outside of \(\left(-\pi,\pi\right]\), we'll use the multivalued arg function from which the principal argument can be obtained - in terms of intervals that is.

\[ \sqrt[n]{z^n} = e^{\frac{i2k\pi}{n}}z \implies \operatorname{arg}(z)\in\left(\frac{\left(-1-2k\right)\pi}{n},\frac{\left(1-2k\right)\pi}{n}\right]\]

In cases where our interval falls outside of \(\left(-\pi,\pi\right]\) we can simply split up our interval appropriately via unions (e.g. at \(\pi\) or \(-\pi\)) and take whichever portion of the interval modulo \(2\pi\) (an add or take a few multiples of it) to obtain the principal argument. For example: For \(\left(-\frac{5\pi}{3}, -\frac{\pi}{3}\right]\) we have \(\left(-\frac{5\pi}{3},-\pi\right] \cup \left(-\pi,-\frac{\pi}{3}\right]\). From there we can add a multiple of \(2\pi\) to the first interval, getting us \(\left(\frac{\pi}{3},\pi\right]\cup\left(-\pi,-\frac{\pi}{3}\right]\).

In any case, we can give our function an explicit form - and a name too while we're at it - let's call it the nth Principal Equivalent, denoted by \(\mathfrak{P}_n(z)\). Suppose \(\alpha_{k}\) describes the interval given as above for the \(k\) case. In other words, Then we have:

\[ \mathfrak{P}_{n}(z) = \begin{cases} z & \operatorname{Arg}(z)\in \alpha_{0} \\ e^\frac{i2\pi}{n}z & \operatorname{Arg}(z)\in \alpha_{1} \\ \vdots & \vdots \\ e^\frac{i(n-1)2\pi}{n}z & \operatorname{Arg}(z)\in \alpha_{n-1} \end{cases}\]

# The Cube Root of -1 isn't -1. Mostly.

Technically, if you calculuate the principal cube root of -1 this way, you'll get \(-e^\frac{i4\pi}{3}\) ... or just \(e^\frac{i\pi}{3} \approx 0.5 +0.87i\). Bet you weren't expecting that.
Though of course, if you are a normal person working under real numbers, you'd take the real-valued root, which *is* \(-1\). Pick your poison, I guess!

Also under this definition we can say that, for \(x\in\mathbb{R}\), \(\left|x\right| = \mathfrak{P}_{2k}(x)\) for \(k\in\mathbb{N}\).

As a challenge, prove the above using induction.

# Addendum - General Formulation

(Written 30th June, 2021)

When going through the above process, you may be inclined to try to find a general formula as opposed to simply the piecewise form.

In general, we can find a formula and it is given by below. Proof is up to you:

\[ \mathfrak{P}_{n}(z)=\sqrt[n]{z^n} = ze^{i\frac{2\pi}{n}\left\lfloor \frac{1}{2}-\frac{n}{2\pi}\operatorname{Arg}(z)\right\rfloor}\]

But, we can demonstrate for \(\mathfrak{P}_2(z)\) case.

\[ \begin{align} \mathfrak{P}_2(z) &= \begin{cases} z & \operatorname{Arg}(z)\in\left(-\frac{\pi}{2},\frac{\pi}{2}\right] \\ -z & \operatorname{Arg}(z)\in\left(-\pi,-\frac{\pi}{2}\right]\cup\left(\frac{\pi}{2},\pi\right] \end{cases} \\ &= ze^{i\pi\begin{cases} 0 & \operatorname{Arg}(z)\in\left(-\frac{\pi}{2},\frac{\pi}{2}\right] \\ 1 & \operatorname{Arg}(z)\in\left(-\pi,-\frac{\pi}{2}\right]\cup\left(\frac{\pi}{2},\pi\right] \end{cases}} \\ &= ze^{i\pi\begin{cases} 0 & -\frac{2}{\pi}\operatorname{Arg}(z)\in\left[-1,1\right) \\ 1 & -\frac{2}{\pi}\operatorname{Arg}(z)\in\left[1,2\right)\cup\left[-2,-1\right) \end{cases}} \\ &= ze^{i\pi\begin{cases} 0 & \frac{1}{2}-\frac{1}{\pi}\operatorname{Arg}(z)\in\left[0,1\right) \\ 1 & \frac{1}{2}-\frac{1}{\pi}\operatorname{Arg}(z)\in\left[1,\frac{3}{2}\right) \\ 1 & \frac{1}{2}-\frac{1}{\pi}\operatorname{Arg}(z)\in\left[-\frac{1}{2},0\right) \end{cases}} \\ &= ze^{i\pi\begin{cases} 0 & \frac{1}{2}-\frac{1}{\pi}\operatorname{Arg}(z)\in\left[0,1\right) \\ 1 & \frac{1}{2}-\frac{1}{\pi}\operatorname{Arg}(z)\in\left[1,\frac{3}{2}\right) \\ -1 & \frac{1}{2}-\frac{1}{\pi}\operatorname{Arg}(z)\in\left[-\frac{1}{2},0\right) \end{cases}} \\ &= ze^{i\pi\left\lfloor \frac{1}{2}-\frac{1}{\pi}\operatorname{Arg}(z)\right\rfloor} \\ \end{align}\]

We justify the second last step as \(e^{i\pi}\equiv e^{i\pi-2\pi}=e^{-i\pi}\). The final step is justified because our expression in the floor is limited to the three cases as above. We can insert the rest of the cases - which the expression inside will never be - to have the equivalent of the floor function. Furthermore, cases with fractional intervals can have their intervals extended to integral values without implication, as they fall outside of what the inside expression can be, again. e.g. \(\frac{3}{2} \to 2\) and \(-\frac{1}{2} \to -1\).

Interactive Desmos, here.