Complex numbers as turning arrows
About this lesson
A complex number is an arrow on a plane: a real part across and an imaginary part up. Multiplying by j turns it a quarter, multiplying multiplies lengths and adds angles, and a spinning arrow draws a sine wave. Follow one AC circuit, a 3 Ω resistor and a coil with 4 Ω reactance, as its impedance becomes the arrow Z = 3 + 4j and Ohm's law turns it into the current I = 0.6 − 0.8j A.
Numbers with two parts
A complex number like 3 + 4j has two parts: a real part, 3, and an imaginary part, 4. Draw it on a plane: 3 steps right along the real axis, 4 steps up. The arrow from 0 to that point is the number.
>>> z = 3 + 4j >>> z.real, z.imag (3.0, 4.0) >>> type(z) <class 'complex'>
Read the lesson step by step
Numbers with two parts
A complex number like 3 + 4j has two parts: a real part, 3, and an imaginary part, 4. Draw it on a plane: 3 steps right along the real axis, 4 steps up. The arrow from 0 to that point is the number.
>>> z = 3 + 4j >>> z.real, z.imag (3.0, 4.0) >>> type(z) <class 'complex'>Times j: a quarter turn
Multiplying by j turns an arrow 90° anticlockwise and keeps its length: (3 + 4j)·j = −4 + 3j. Two quarter turns point it backwards, so j·j = −1. That is what j² = −1 means. Four quarter turns bring it home.
>>> z = 3 + 4j >>> z * 1j (-4+3j) >>> z * 1j * 1j (-3-4j) >>> 1j * 1j (-1+0j)Adding: tip to tail
A 3 Ω resistor pushes back in step with the current: 3, on the real axis. At 50 Hz, a 12.7 mH coil adds about 4 Ω a quarter turn later: 4j. Add them tip to tail: the impedance Z = 3 + 4j Ω.
>>> import math >>> round(2 * math.pi * 50 * 0.0127, 2) # coil: 2πfL 3.99 >>> Z = 3 + 4 * 1j >>> Z (3+4j)Length: Pythagoras
The two parts and the arrow form a right triangle. Its length, the magnitude |Z|, comes from Pythagoras: √(3² + 4²) = √25 = 5. So at 50 Hz this pair limits the current like a single 5 Ω resistor.
>>> abs(3 + 4j) 5.0 >>> (3**2 + 4**2) ** 0.5 5.0Angle: arctangent
The angle from the real axis is θ = atan2(4, 3) = 53.13°. Length and angle together are the polar form: Z = 5∠53.13°. Going back is trig: 5·cos 53.13° = 3 and 5·sin 53.13° = 4.
>>> import cmath, math >>> cmath.phase(3 + 4j) # radians 0.9272952180016122 >>> math.degrees(cmath.phase(3 + 4j)) 53.13010235415598 >>> cmath.polar(3 + 4j) (5.0, 0.9272952180016122)Euler's formula
Euler's formula, e^jθ = cos θ + j sin θ, is an arrow of length 1 at angle θ. Turn it to 53.13°, which is 0.927 radians, and stretch it 5 times: Z = 5e^j0.927. One expression holds the length and the angle.
>>> import cmath >>> cmath.exp(1j * 0.9272952180016122) (0.6+0.7999999999999999j) >>> cmath.rect(5, 0.9272952180016122) # 3 + 4j, rounded (3+3.9999999999999996j)Divide: shrink, turn back
The source gives V = 5∠0° V. Ohm's law, I = V / Z, divides arrows: divide the lengths, 5 ÷ 5 = 1, and subtract the angles, 0° − 53.13°. So the current is I = 1∠−53.13° A.
>>> import cmath, math >>> I = 5 / (3 + 4j) >>> abs(I), math.degrees(cmath.phase(I)) (1.0, -53.13010235415599)Back to a + bj
In parts, I = cos(−53.13°) + j sin(−53.13°) = 0.6 − 0.8j A. Check by multiplying: (0.6 − 0.8j)(3 + 4j) = 5. Multiplying undoes dividing: the lengths multiply, 1 × 5, and the angles add, −53.13° + 53.13° = 0°.
>>> I = 5 / (3 + 4j) >>> I (0.6-0.8j) >>> I * (3 + 4j) # 5, up to rounding (5-4.440892098500626e-16j)Spinning arrows make waves
Spin both arrows 50 times a second. The voltage arrow's shadow on the real axis traces v = 5 cos ωt, ω = 2π·50. The current arrow trails by 53.13°, so its wave peaks 2.95 ms later. The fixed arrows V and I are phasors.
>>> import math >>> 2 * math.pi * 50 # ω in rad/s 314.1592653589793 >>> 53.13010235415598 / 360 * 20 # lag in ms 2.9516723530086657Python speaks j
Python writes imaginary numbers with j, as engineers do, since i usually means current. In cmath, abs(Z) gives 5.0, cmath.phase(Z) gives the angle in radians, 0.927, and 5 / Z gives (0.6-0.8j).
>>> import cmath >>> Z = 3 + 4j >>> abs(Z) 5.0 >>> cmath.phase(Z) 0.9272952180016122 >>> I = 5 / Z >>> I (0.6-0.8j)
5 quick questions
Choose one answer per question. You can change your choices before checking them.
01What is (2 + 1j) × j?
j × 2 = 2j and j × 1j = j² = −1, so the answer is −1 + 2j. The arrow turned 90° anticlockwise and kept its length, √5.
02What are the magnitude and angle of 6 + 8j?
√(6² + 8²) = √100 = 10, and atan2(8, 6) = 53.13°, the same angle as 3 + 4j because 6 + 8j is the same arrow stretched twice.
03Z1 = 2∠30° and Z2 = 3∠45°. What is Z1 × Z2?
Multiplying complex numbers multiplies the lengths, 2 × 3 = 6, and adds the angles, 30° + 45° = 75°.
04A 10∠0° V source drives an impedance Z = 5∠53.13° Ω. What is the current?
I = V / Z: divide the lengths, 10 ÷ 5 = 2, and subtract the angles, 0° − 53.13°. The current lags the voltage by 53.13°.
05Euler's formula says e^jθ = cos θ + j sin θ. What is e^j90°?
cos 90° = 0 and sin 90° = 1, so e^j90° = 0 + 1j = j: the arrow of length 1 turned a quarter turn. In Python, cmath.exp(1j * math.pi / 2) gives about 1j (the real part is a tiny rounding error).
Glossary
- Complex number
- A number a + bj with a real part a and an imaginary part b, where j² = −1. It can be drawn as the point (a, b) or the arrow from 0 to it.
- Imaginary unit (j or i)
- The number whose square is −1. Multiplying by it turns an arrow 90° anticlockwise. Engineers and Python write j; mathematicians write i.
- Magnitude (modulus)
- The length of the arrow: |a + bj| = √(a² + b²). Python: abs(z).
- Angle (argument, phase)
- The angle from the positive real axis to the arrow, found with atan2(b, a). Python: cmath.phase(z), in radians.
- Polar form
- A complex number written as length and angle, such as 5∠53.13° or 5e^j0.927, instead of 3 + 4j (rectangular form).
- Euler's formula
- e^jθ = cos θ + j sin θ: the arrow of length 1 at angle θ.
- Impedance
- A circuit's opposition to alternating current as a complex number Z = R + jX, in ohms. X is the reactance; a coil's is 2πfL. Here a 3 Ω resistor and a coil with 4 Ω reactance give Z = 3 + 4j Ω.
- Phasor
- The fixed complex number that stands for a sine wave: its length is the wave's peak and its angle is the wave's phase, such as V = 5∠0° V. Spinning it at ω and taking the real part gives the wave.
Notes and sources
- Mathematicians write i for √−1; electrical engineers and Python write j, because i (or I) already stands for current. 3 + 4j and 3 + 4i are the same number.
- Use atan2(b, a) or cmath.phase, not atan(b / a): atan cannot tell 3 + 4j from −3 − 4j (both have b / a = 4/3), while atan2 looks at both signs and returns the angle in the right quarter, between −180° and 180°.
- Python's cmath works in radians: a full turn is 2π rad = 360°, so 53.13° = 53.13 × π / 180 = 0.927 rad. math.degrees and math.radians convert.
- A coil's reactance is X = 2πfL. At 50 Hz a 12.7 mH coil gives 2π × 50 × 0.0127 = 3.99 Ω, which the lesson rounds to 4 Ω.
- By hand, divide by multiplying top and bottom by the conjugate 3 − 4j: 5(3 − 4j) / ((3 + 4j)(3 − 4j)) = (15 − 20j) / 25 = 0.6 − 0.8j.
- Floats round: Python prints I * Z as (5-4.440892098500626e-16j). The imaginary part, about 0.00000000000000044, is rounding error; the exact answer is 5.
- MIT OCW 18.03SC Differential Equations: Complex Arithmetic and Exponentials
- OpenStax Precalculus 2e, 8.5 Polar Form of Complex Numbers
- The Feynman Lectures on Physics, vol. I, ch. 22 Algebra (Euler's formula)
- OpenStax University Physics vol. 2, 15.3 RLC Series Circuits with AC (impedance, phase angle)
- MIT OCW 6.002 Circuits and Electronics
- Alexander & Sadiku, Fundamentals of Electric Circuits, 7th ed. (2021), ch. 9 Sinusoids and Phasors, appendix B Complex Numbers
- Python library: cmath, mathematical functions for complex numbers
- Python reference: Imaginary literals
Quiz Unlocks after the last step.