Home Wiki Engineering Mathematics Complex Numbers in Electrical Engineering
Engineering Mathematics

Complex Numbers in Electrical Engineering

What Are Complex Numbers and Why Do Engineers Need Them?

In electrical engineering, many phenomena cannot be described with real numbers alone. When you talk about an AC current lagging behind voltage by a certain angle, you need a mathematical tool that captures magnitude and angle simultaneously -- that tool is the complex number.

A complex number takes the form:

z = a + bj

where a is the real part, b is the imaginary part, and j is the imaginary unit satisfying j² = -1. Electrical engineers use j instead of i because i is reserved for current.

Why "imaginary"? It does not mean "nonexistent" -- it means the value lies on an axis perpendicular to the real number line. Voltage across a resistor is real; voltage across an inductor leads by 90 degrees -- that lead is represented on the imaginary axis.

The Complex Plane: A Map for Electrical Signals

The complex plane is a coordinate system with two axes:

  • Horizontal axis: Real part (Re)
  • Vertical axis: Imaginary part (Im)

Any complex number z = a + bj is a point in this plane, or equivalently a vector (arrow) from the origin to that point.

Magnitude is the vector length:

|z| = sqrt(a² + b²)

Phase angle is the angle with the real axis:

θ = arctan(b / a)

Practical example: If the complex voltage is V = 3 + 4j volts:

  • Magnitude: |V| = sqrt(9 + 16) = 5 V
  • Phase: θ = arctan(4/3) = 53.13°
import cmath

V = 3 + 4j
magnitude = abs(V)           # 5.0
phase_deg = cmath.phase(V) * 180 / 3.14159  # 53.13°

print(f"Magnitude: {magnitude:.1f} V")
print(f"Phase: {phase_deg:.2f}°")

Polar Form and Euler's Formula

Any complex number can be expressed in two ways:

  • Rectangular form: z = a + bj
  • Polar form: z = r * e^(jθ)

The bridge between them is Euler's formula:

e^(jθ) = cos(θ) + j*sin(θ)

This formula is not merely elegant mathematics -- it is the foundation of circuit analysis and signal processing. Every sinusoidal signal can be represented as a rotating vector in the complex plane.

Converting between forms:

import cmath, math

# Rectangular to polar
z = 3 + 4j
r = abs(z)                    # 5.0
theta = cmath.phase(z)        # radians

# Polar to rectangular
r2 = 5.0
theta2 = math.radians(53.13)
z2 = r2 * cmath.exp(1j * theta2)  # approximately 3.0 + 4.0j

print(f"Polar: {r:.1f} < {math.degrees(theta):.1f}°")
print(f"Rectangular: {z2:.2f}")

Phasors: Simplifying AC Circuits

A phasor is a complex number representation of a steady-state sinusoidal signal. Instead of working with:

v(t) = Vm * cos(ωt + φ)

we write the phasor simply as:

V = Vm * e^(jφ) = Vm ∠ φ

This converts differential equations into simple algebraic equations. No need to solve differential equations every time -- just add and multiply complex numbers.

Example: A source voltage v(t) = 170 cos(377t + 30°):

import cmath, math

# Phasor representation
Vm = 170          # peak voltage (V)
phi = math.radians(30)  # phase (30 degrees)

# Phasor as a complex number
V_phasor = Vm * cmath.exp(1j * phi)
print(f"Phasor: {abs(V_phasor):.1f} ∠ {math.degrees(cmath.phase(V_phasor)):.1f}°")
# Phasor: 170.0 ∠ 30.0°

# RMS value
V_rms = Vm / math.sqrt(2)
print(f"RMS voltage: {V_rms:.1f} V")
# RMS voltage: 120.2 V

Complex Impedance: The Heart of AC Circuit Analysis

Impedance is the complex resistance of any element in an AC circuit:

Z = R + jX

where:

  • R = Resistance -- real part -- energy dissipation
  • X = Reactance -- imaginary part -- energy storage
Element Impedance Note
Resistor (R) Z = R Purely real
Inductor (L) Z = jωL Positive imaginary
Capacitor (C) Z = 1/(jωC) = -j/(ωC) Negative imaginary

Industrial example: Calculating the impedance of a series RLC circuit in an electric motor:

import cmath, math

# Circuit parameters
R = 10          # ohms
L = 0.05        # henries
C = 100e-6      # farads
f = 50          # Hz (standard grid frequency)
omega = 2 * math.pi * f  # angular frequency

# Total impedance
Z_R = R + 0j
Z_L = 1j * omega * L           # 0 + 15.71j
Z_C = 1 / (1j * omega * C)     # 0 - 31.83j

Z_total = Z_R + Z_L + Z_C
print(f"Resistance: {Z_total.real:.2f} ohms")
print(f"Reactance: {Z_total.imag:.2f} ohms")
print(f"Total impedance: {abs(Z_total):.2f} ∠ {math.degrees(cmath.phase(Z_total)):.1f}°")

# Current calculation (source voltage 220V)
V = 220 + 0j
I = V / Z_total
print(f"Current: {abs(I):.2f} A ∠ {math.degrees(cmath.phase(I)):.1f}°")

Output:

Resistance: 10.00 ohms
Reactance: -16.12 ohms
Total impedance: 18.97 ∠ -58.2°
Current: 11.60 A ∠ 58.2°

The negative angle means the circuit is capacitive (capacitive reactance exceeds inductive) -- the current leads the voltage.

Arithmetic Operations on Complex Numbers

Operation Rectangular Form Polar Form
Addition (a+bj) + (c+dj) = (a+c) + (b+d)j Convert to rectangular first
Multiplication Complex r₁r₂ ∠ (θ₁+θ₂) -- very easy
Division Complex (r₁/r₂) ∠ (θ₁-θ₂) -- very easy
Conjugate conj(a+bj) = a-bj r ∠ (-θ)

Golden rule: Use rectangular form for addition and subtraction, polar form for multiplication and division.

# Multiplying two impedances (easier in polar)
Z1 = 5 * cmath.exp(1j * math.radians(30))
Z2 = 3 * cmath.exp(1j * math.radians(45))
Z_product = Z1 * Z2  # 15 ∠ 75°

print(f"Product: {abs(Z_product):.1f} ∠ {math.degrees(cmath.phase(Z_product)):.1f}°")

Industrial Application: Power Quality Analysis in a Factory

In industrial plants, power factor problems are extremely common. Complex numbers help diagnose them:

import cmath, math

# Measurements from an electrical panel in a textile factory
V_rms = 380       # volts (3-phase)
I_rms = 45        # amperes
phase_angle = math.radians(-25)  # current lags voltage

# Complex power
S = V_rms * I_rms  # apparent power (VA)
P = S * math.cos(phase_angle)   # active power (W)
Q = S * math.sin(phase_angle)   # reactive power (VAR)

S_complex = P + 1j * Q

print(f"Apparent power: {S:.0f} VA")
print(f"Active power: {P:.0f} W")
print(f"Reactive power: {Q:.0f} VAR")
print(f"Power factor: {math.cos(phase_angle):.3f}")

# Correcting the power factor to 0.95
target_pf = 0.95
target_angle = math.acos(target_pf)
Q_new = P * math.tan(target_angle)
Q_capacitor = Q - Q_new  # required capacitor reactive power

C_needed = abs(Q_capacitor) / (2 * math.pi * 50 * V_rms**2)
print(f"\nTo correct PF to {target_pf}:")
print(f"Reactive power to compensate: {abs(Q_capacitor):.0f} VAR")
print(f"Required capacitance: {C_needed*1e6:.1f} uF")

Summary and Practical Rules

Concept Formula Use Case
Complex number z = a + bj Foundation of all analysis
Euler's formula e^(jθ) = cos θ + j sin θ Links polar and rectangular
Phasor V = Vm ∠ φ Simplifies AC circuits
Impedance Z = R + jX Circuit analysis
Complex power S = P + jQ Power quality analysis

Practical tip: Any advanced SCADA or PLC system measures voltage and current to compute impedance and power -- all of these calculations are built on complex numbers. Understanding them is not an academic luxury but a daily engineering necessity.

complex-numbers impedance phasor real-imaginary AC-analysis Euler الأعداد المركبة الممانعة الطور التحليل المركب دوائر التيار المتناوب صيغة أويلر