Visualize Complex Numbers & Euler's Formula

Visualize complex numbers as points on the plane and Euler's formula as a point tracing the unit circle. Animate why e^(iθ) = cos θ + i sin θ in Manim.

By Shihab
3 min read

To visualize complex numbers, plot them as points on the complex plane — the real part on the x-axis, the imaginary part on the y-axis. Euler's formula, eiθ=cosθ+isinθe^{i\theta} = \cos\theta + i\sin\theta, then becomes a point tracing the unit circle as θ\theta increases. Animating that single point is the clearest way to show why the formula is true. Build it in Manim or generate it from a prompt with QuantumSketch.

Complex numbers are just the plane

A complex number a+bia + bi is a point at coordinates (a,b)(a, b). That reframing dissolves most of the mystery: addition is vector addition, magnitude is distance from the origin, and the "imaginary" axis is simply the vertical one. Showing 3+2i3 + 2i as an arrow from the origin makes complex arithmetic concrete before any formula appears.

Set up the complex plane

Manim's ComplexPlane (or NumberPlane) gives you the grid for free:

from manim import *

class ComplexPoint(Scene):
    def construct(self):
        plane = ComplexPlane().add_coordinates()
        self.play(Create(plane))
        z = plane.n2p(3 + 2j)                 # number -> point
        dot = Dot(z, color=YELLOW)
        arrow = Arrow(plane.n2p(0), z, buff=0)
        self.play(GrowArrow(arrow), FadeIn(dot))

n2p ("number to point") converts a Python complex number directly to screen coordinates, so you think in math, not pixels.

Animate Euler's formula

Now the centerpiece: let θ\theta run from 00 to 2π2\pi and trace eiθe^{i\theta}. Because its magnitude is always 1, the point stays on the unit circle, and its shadow on each axis draws cosθ\cos\theta and sinθ\sin\theta:

        theta = ValueTracker(0)
        circle = Circle(radius=1).move_to(plane.n2p(0))
        point = always_redraw(
            lambda: Dot(plane.n2p(np.exp(1j * theta.get_value())), color=RED)
        )
        self.add(circle, point)
        self.play(theta.animate.set_value(TAU), run_time=4, rate_func=linear)

As the red dot sweeps the circle, you can drop perpendiculars to each axis to show cosθ\cos\theta and sinθ\sin\theta being traced simultaneously — that's Euler's formula, seen rather than memorized.

The "aha" with rotating vectors

Multiplying by eiθe^{i\theta} rotates a complex number by angle θ\theta. Animate a vector being multiplied by eiπ/2e^{i\pi/2} and watch it turn 90° — suddenly "multiplication by ii is a quarter turn" is obvious. This rotational view is why complex numbers are the natural language for waves, signals, and AC circuits.

From idea to narrated video

Drawing this by hand in Manim teaches the mechanics; producing a polished, narrated explainer takes longer. QuantumSketch generates the storyboard, animation, and narration from a prompt like "explain Euler's formula on the unit circle." The underlying Manim techniques are open in manim-coding-skill.

Frequently Asked Questions

How do you visualize complex numbers? Plot a+bia + bi as the point (a,b)(a, b) on the complex plane — real part horizontal, imaginary part vertical — and draw it as an arrow from the origin.

How do you animate Euler's formula? Sweep an angle θ\theta from 00 to 2π2\pi and trace eiθe^{i\theta}, which stays on the unit circle while its axis projections draw cosθ\cos\theta and sinθ\sin\theta.

Why is multiplying by i a 90° rotation? i=eiπ/2i = e^{i\pi/2}, and multiplying by eiθe^{i\theta} rotates by θ\theta. So multiplying by ii rotates a complex number a quarter turn.

What tool animates this best? Manim for direct control, or QuantumSketch to generate a narrated version from a text prompt.


Written by Shihab Shahriar Antor — AI Engineer & Founder of Shahriar Labs. Turn a prompt into a narrated math video with QuantumSketch; Manim techniques in manim-coding-skill. Also building freelm.

Tags:#manim#complex-numbers#eulers-formula#math-animation#tutorial
S

Shihab Shahriar

AI Engineer & Founder of Shahriar Labs. Exploring the intersection of design, cognition, and machine learning.