Complex Numbers
Complex numbers expand the real number system by introducing the imaginary unit , where .
Arithmetic in the Complex Plane
A complex number is written as , where is the real part and is the imaginary part. Addition and multiplication follow standard algebraic rules, with .
python
1# Python supports complex numbers natively using 'j'
2z1 = 3 + 4j
3z2 = 1 - 2j
4
5# Addition
6print(f"z1 + z2 = {z1 + z2}")
7
8# Multiplication (3+4j)*(1-2j) = 3 - 6j + 4j - 8j^2 = 3 - 2j + 8 = 11 - 2j
9print(f"z1 * z2 = {z1 * z2}")
10
11# Magnitude (Absolute Value)
12print(f"|z1| = {abs(z1)}")
Polar Form and Euler’s Formula
Complex numbers can be represented in polar coordinates . Euler’s Formula connects the exponential function to trigonometry: Thus, .
python
1import cmath
2import math
3
4z = 1 + 1j
5r, theta = cmath.polar(z)
6print(f"r: {r:.3f}, theta: {theta:.3f} rad")
7
8# Euler's Identity: e^(i*pi) + 1 = 0
9identity = cmath.exp(1j * math.pi) + 1
10print(f"e^(i*pi) + 1 = {identity.real:.1f} + {identity.imag:.1f}j")
Fundamental Theorem of Algebra
The Fundamental Theorem of Algebra states that every non-constant polynomial of degree with complex coefficients has exactly complex roots (counting multiplicity).