DEV Community

Somenath Mukhopadhyay
Somenath Mukhopadhyay

Posted on • Originally published at som-itsolutions.blogspot.com on

The déjà vu - more than 30 years after engineering college...


It was 1989, a humid afternoon in the engineering college classroom.
The blackboard was already half-white from chalk dust, and our mathematics professor — a bespectacled man who loved quoting Euler more than Bollywood — scribbled furiously:

ejθ=cosθ+jsinθ e^{j\theta} = \cos\theta + j\sin\theta

"This, my dear students," he declared, "is the key to rotating any vector in the plane. Multiply your vector by ejθe^{j\theta} and watch it turn by $\theta$ degrees without changing its length."

At 17 years old, I copied the formula into my notebook without much ceremony.
My mind was more occupied with the upcoming electronics lab, the taste of the canteen’s samosa, and the fact that j here was not the current in Ohm’s law but the mysterious square root of -1.

"So," I wondered back then, "why would anyone bother multiplying by such a strange expression instead of using a good old rotation matrix?"

The professor moved on to another topic, the bell rang, and ejθe^{j\theta} quietly slipped into the dusty attic of my mind, along with Laplace transforms and contour integrals.


Fast forward: three decades later

Yesterday my young son, Ridit, said:

"Baba, I would like to study complex numbers. Because most game engines use quaternions for elegantly handling rotation, and for that, I need the knowledge of complex algebra."

And then today, after coming back from school, he opened ChatGPT and showed me what he was speaking about — and I was astonished.
Yes… this was it. My mind instantly went back more than 30 years, to that engineering classroom where my professor taught me this.

I had totally forgotten.


The rediscovery

In the glow of a laptop screen, with Python code dancing across the terminal, I was plotting a simple 2D rotation.
I tried the matrix way — it worked, as always.

Then I typed:

z *= np.exp(1j * theta)
Enter fullscreen mode Exit fullscreen mode

And there it was — the vector spun, clean and elegant, no sine or cosine in sight.
A 30-year-old chalkboard came rushing back. My professor’s voice, muffled by time, echoed:

"Multiply by ejθe^{j\theta} and it rotates."

I finally felt the truth of it — the way Euler’s formula hides geometry inside algebra, the way the complex exponential is not just math trickery but a perfect rotation operator.


The déjà vu

I sat back and smiled. In engineering college, it was just a formula to memorize.
Three decades later, it was like meeting an old classmate and realizing they’d been brilliant all along.

The same equation, the same ejθe^{j\theta} but now it wasn’t an exam answer — it was an elegant, almost poetic bridge between numbers and motion.

And somewhere, in some cosmic complex plane, I imagined my younger self and older self standing at the same point, separated by an angle theta of 30 years, both connected by the same exponential arc.


Python demo – Rotation via ejθe^{j\theta} vs Rotation Matrix

import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation

# Initial vector
x0, y0 = 1, 0.5
z0 = x0 + 1j * y0  # complex form

# Rotation speed
theta = np.pi / 60
frames = 120

# Rotation matrix
R = np.array([[np.cos(theta), -np.sin(theta)],
              [np.sin(theta),  np.cos(theta)]])

# Set up figure
fig, axes = plt.subplots(1, 2, figsize=(10, 5))
titles = ["Rotation via e^(jθ)", "Rotation via Matrix"]
plots = []

for ax, title in zip(axes, titles):
    ax.set_xlim(-2, 2)
    ax.set_ylim(-2, 2)
    ax.set_aspect('equal', adjustable='box')
    ax.axhline(0, color='gray', linewidth=0.5)
    ax.axvline(0, color='gray', linewidth=0.5)
    ax.set_title(title)
    plots.append(ax.plot([], [], 'ro-', lw=2)[0])

# State variables
z = z0
v = np.array([x0, y0])

# Update function
def update(frame):
    global z, v
    # Complex method
    plots[0].set_data([0, z.real], [0, z.imag])
    z *= np.exp(1j * theta)

    # Matrix method
    plots[1].set_data([0, v[0]], [0, v[1]])
    v = R @ v

    return plots

# Animate
ani = FuncAnimation(fig, update, frames=frames, interval=50, blit=True)
plt.show()
Enter fullscreen mode Exit fullscreen mode

Enjoy exploring the elegance of ejθe^{j\theta} !
Mathematics from decades ago can surprise you when it comes alive again on your screen.


Top comments (0)