Complex Numbers: The Argand Plane and Euler’s Formula

Complex Numbers: The Argand Plane and Euler’s Formula

Complex numbers extend the real number system by including the imaginary unit i, where i² = -1. Every complex number is written as z = a + bi, where a is the real part and b is the imaginary part. The Argand plane (complex plane) visualizes complex numbers as points with real coordinates (a, b). Euler’s formula, e^(iθ) = cos θ + i sin θ, connects exponential functions to trigonometry and is fundamental to electrical engineering, quantum mechanics, signal processing, and control theory.

The Argand Plane

The Argand plane is a 2D coordinate system where the x-axis represents the real part and the y-axis represents the imaginary part. The complex number 3 + 4i becomes the point (3, 4). The distance from the origin to the point is the modulus (or magnitude): |z| = √(a² + b²). The angle from the positive real axis is the argument (or phase): arg(z) = arctan(b/a). This geometric interpretation makes operations intuitive: addition is vector addition, multiplication combines moduli and adds arguments (|z₁z₂| = |z₁||z₂|, arg(z₁z₂) = arg(z₁) + arg(z₂)).

import cmath, math

# Complex numbers in Python
z1 = 3 + 4j
z2 = 1 - 2j

# Basic operations
print(f"z1 = {z1}, |z1| = {abs(z1):.2f}, arg(z1) = {cmath.phase(z1):.3f} rad")
print(f"z2 = {z2}, |z2| = {abs(z2):.2f}")
print(f"z1 + z2 = {z1 + z2}")
print(f"z1 * z2 = {z1 * z2}")
print(f"|z1 * z2| = {abs(z1 * z2):.2f}")  # = |z1| * |z2|

Euler’s Formula and Polar Form

Euler’s formula e^(iθ) = cos θ + i sin θ is the most important equation in complex analysis. It allows representing complex numbers in polar form: z = re^(iθ) where r = |z| and θ = arg(z). This form makes multiplication, division, and exponentiation trivial: multiply by multiplying radii and adding angles; raise to a power by raising the radius and multiplying the angle (De Moivre’s theorem). The special case e^(iπ) + 1 = 0 (Euler’s identity) connects five fundamental mathematical constants in a single equation.

# Polar form and Euler's formula
theta = math.pi / 4  # 45 degrees
z_polar = cmath.rect(1.0, theta)  # cos(π/4) + i·sin(π/4)
print(f"e^(iπ/4) = {z_polar:.3f}")
print(f"cos(π/4) = {math.cos(theta):.3f}, sin(π/4) = {math.sin(theta):.3f}")

# De Moivre's theorem: (cos θ + i sin θ)^n = cos(nθ) + i sin(nθ)
z = cmath.rect(1, math.pi/6)  # e^(iπ/6)
z_cubed = z ** 3
expected = cmath.rect(1, math.pi/2)  # e^(iπ/2) = i
print(f"(e^(iπ/6))³ = {z_cubed:.3f}, expected {expected:.3f}")

Applications in Signal Processing

The Fast Fourier Transform (FFT), implemented in NumPy as np.fft.fft(), decomposes signals into their frequency components using complex exponentials. Each frequency component is a complex number: the magnitude represents amplitude, and the argument represents phase. This is essential for audio processing (equalizers, compression), image processing (JPEG uses a related transform), wireless communications (OFDM), and control systems (frequency response analysis). In electrical engineering, complex impedance (Z = R + jX) replaces resistance for AC circuits, with the imaginary part representing reactance from capacitors and inductors.

import numpy as np
import matplotlib.pyplot as plt

# FFT of a signal with two frequencies
fs = 1000  # Sampling rate
t = np.linspace(0, 1, fs, endpoint=False)
signal = np.sin(2 * np.pi * 50 * t) + 0.5 * np.sin(2 * np.pi * 120 * t)

fft = np.fft.fft(signal)
freqs = np.fft.fftfreq(fs, 1/fs)
magnitude = np.abs(fft[:fs//2])  # Magnitude spectrum

# Peaks at 50 Hz and 120 Hz confirm signal composition
peak_freqs = freqs[:fs//2][magnitude > 100]
print(f"Detected frequencies: {peak_freqs} Hz")
# Phase information (from complex argument) gives timing/alignment

Complex numbers are also fundamental to quantum mechanics (wave functions are complex-valued, and the Schrödinger equation uses i∂ψ/∂t), fluid dynamics (potential flow theory uses complex potentials), and fractal generation (the Mandelbrot set is defined by iterating z ← z² + c in the complex plane). Python’s built-in complex type and the cmath, numpy, and scipy libraries provide comprehensive support for complex arithmetic, making it practical to work with complex numbers in any computational domain.

Complex Numbers in Python and NumPy

Python provides first-class support for complex numbers with the j suffix (3+4j) and the complex() constructor. The cmath module mirrors math but for complex arguments: cmath.sqrt(-1) returns 1j, while math.sqrt(-1) raises ValueError. NumPy extends this to array operations: np.array([1+2j, 3+4j]) creates a complex array, and ufuncs like np.sin, np.exp, and np.sqrt work natively on complex arrays. NumPy’s FFT functions return complex arrays where the real part represents cosine amplitudes and the imaginary part represents sine amplitudes. For scientific computing, complex numbers enable solving differential equations (the Schrödinger equation uses i∂ψ/∂t), representing AC circuits (impedance Z = R + jX), and computing the Mandelbrot set (iterating z = z² + c on the complex plane). The matplotlib library plots complex functions using domain coloring, where hue represents argument and brightness represents magnitude, providing a complete visualization of complex-valued functions in a single image.

Complex Numbers in Python and NumPy

Python provides first-class support for complex numbers with the j suffix (3+4j) and the complex() constructor. The cmath module mirrors math but for complex arguments: cmath.sqrt(-1) returns 1j, while math.sqrt(-1) raises ValueError. NumPy extends this to array operations: np.array([1+2j, 3+4j]) creates a complex array, and ufuncs like np.sin, np.exp, and np.sqrt work natively on complex arrays. NumPy’s FFT functions return complex arrays where the real part represents cosine amplitudes and the imaginary part represents sine amplitudes. For scientific computing, complex numbers enable solving differential equations, representing AC circuits (impedance Z = R + jX), and computing the Mandelbrot set (iterating z = z^2 + c on the complex plane).