Advanced Techniques with Complex Numbers

Some advanced techniques with complex numbers include using complex numbers in 3D, sorting complex values, and taking derivatives involving complex numbers. Get started with our Complex Numbers article, then dive deeper with the examples and concepts below.

Complex Numbers in 3D

In the 3D Calculator, complex numbers aren’t immediately plotted as they are in the Graphing Calculator, but you can still use them when performing calculations or plotting surfaces.

In the example graph, the 3D surface in line 2 represents the magnitude of a function of all complex numbers of the form \(x+yi\). By adjusting the slider, you can explore how the surface intersects the plane \(z=0\). These intersection points correspond to the zeros of the function.

For this specific function, the zeros appear on both the x-axis and y-axis:

  • Zeros on the x-axis are real zeros because when \(y=0\), the complex number \(x+yi\) simplifies to \(x+0i\), which can be written as the real number \(x\).
  • Zeros on the y-axis are complex zeros because when \(x=0\), \(x+yi\) simplifies to \(0+yi\), which is a complex number.
Screenshot of the magnitude of the function w squared plus a evaluated at x plus yi with the real and imaginary versions of the function graphed when equal to zero.

Number Theory Functions on Complex Numbers

In Desmos, complex numbers are expressed using real coefficients for both their real and imaginary parts. For example, in the complex number \(2.9+3.7i\), \(2.9\) is the real part, and \(3.7\) is the imaginary part. Since some functions involving complex numbers lack universal conventions, the table below explains how Desmos handles number theory functions on complex numbers.

Function: Try Typing: This Function:
round round\((2.9+3.7i)\) rounds the coefficients of the real and imaginary part of the number.
floor floor\((2.9+3.7i)\) computes the complex floor function (attributed to E.E. McDonnell).*
ceil ceil\((2.9+3.7i)\) computes the complex ceiling function, which can be found with \(-\)floor\((-z)\).
mod mod\((2.9+3.7i,3i)\) computes the modular function with the equation mod\((a,b) = a - b*\)floor\((\frac{a}{b})\).
gcd gcd\((4+2i, 1-3i)\) finds the number in the first quadrant with the largest magnitude that divides both numbers.
lcm lcm\((4+2i, 1-3i)\) finds the number in the first quadrant with the smallest magnitude that is a multiple of both numbers.

*floor( )

In Desmos, the floor function always returns a number that is at most one unit away from the original number. For complex numbers, this means the floor function outputs one of three options:

  1. floor\((x+yi)=\)floor\((x)+\)floor\((y)i\)
  2. floor\((x+yi)=\)floor\((x)+\)floor\((y)i+1\)
  3. floor\((x+yi)=\)floor\((x)+\)floor\((y)i+i\)

Open the example graph and drag around the point to see how the position of the complex number affects the floor value.

Note: Since complex numbers are not ordered, there are multiple possible definitions of the floor function. The method used by Desmos is attributed to E.E. McDonnell.

Gif of moving a complex point throughout the graph and showing how the floor function changes

Comparisons and Ordering

Two complex numbers are considered equal if and only if their real and imaginary parts are both equal.

Due to the complex number system lacking a total ordering, non-strict inequalities \((\lt\) or \(\gt)\) involving complex numbers with non-zero imaginary parts will always be undefined. Strict inequalities \((\leq\) or \(\geq)\) are only defined when the two numbers are equal or when the corresponding non-strict inequality is defined.

Complex numbers with a zero imaginary part (such as \(3+0i\)) are treated as real numbers and can be compared to other real numbers.

Functions like min, max, median, quartile, and quantile are undefined for complex numbers. However, you can still sort a list of complex numbers. The sort( ) function compares the real parts first, and if any two numbers have equal real parts sort( ) will then compare the imaginary parts.

Derivatives of Complex Numbers

For complex numbers, Desmos uses the Wirtinger derivative. This approach allows you to take the derivative of functions like abs, real, imag, and conj which are not complex differentiable (or not holomorphic).

Note: Occasionally, the Wirtinger derivative of a function evaluated at \(a + 0i\) gives a different value than the derivative evaluated at \(a\). In such cases, a warning will appear in the expression list.

Learn More

Please reach out to us with any questions or suggestions at support@desmos.com.