Thursday, August 14, 2025

The déjà vu - more than 30 years after engineering college - multiplying a vector by exp(jθ) in the complex plane is nothing but rotating it by an angle θ...

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 jj here was not the current in Ohm’s law but the mysterious square root of 1-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 the complex number. Because mostly the game engine uses Quaternions for elegantly handling rotation and for that to understand, 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 is the case - and my mind took me more than 30 years ago, when my engineering college professor taught me this.

I totally forgot...

But NOW... i remember everything.

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 used...

z *= np.exp(1j * theta)

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 maths 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.

Here's the python code for experimentation - visualising that multiplying by rotation matrix and by exp(jθ) produce the same effect.

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()

And here's the screen recording of the above code.


Mathematics from decades ago can surprise you when it comes alive again on your screen.

No comments: