|q⟩ Bad Qubits

beginner · Physics · Math Foundations: Complex Numbers

Euler’s Formula

One of the most powerful identities in all of mathematics connects the complex exponential to trigonometry. For any real angle θ\theta (in radians),

eiθ=cosθ+isinθ.e^{i\theta} = \cos\theta + i\sin\theta.

This is Euler's formula. It means that the complex exponential eiθe^{i\theta} is a point on the unit circle in the complex plane, at angle θ\theta from the positive real axis. The real part is cosθ\cos\theta and the imaginary part is sinθ\sin\theta, so its modulus is always 1:

eiθ2=cos2θ+sin2θ=1.|e^{i\theta}|^2 = \cos^2\theta + \sin^2\theta = 1.

The last equality follows from the Pythagorean identity, confirming that eiθe^{i\theta} stays exactly on the unit circle for every θ\theta.

Why it matters for quantum mechanics

A quantum state amplitude is a complex number, and rotating that amplitude by an angle θ\theta multiplies it by eiθe^{i\theta}. Because eiθ=1|e^{i\theta}| = 1, this rotation — called a phase — leaves the measurement probability z2|z|^2 unchanged. Euler's formula makes this fact transparent: phases are pure rotations on the unit circle. This is why quantum gates like the T gate (rotation by π/4\pi/4) and S gate (rotation by π/2\pi/2) are expressed in terms of eiθe^{i\theta}.

Deriving the formula

A concise route uses Taylor series. Expanding exe^{x}, cosx\cos x, and sinx\sin x around x=0x = 0:

ex=1+x+x22!+x33!+x44!+e^x = 1 + x + \frac{x^2}{2!} + \frac{x^3}{3!} + \frac{x^4}{4!} + \cdots

Substitute x=iθx = i\theta and use i2=1i^2 = -1, i3=ii^3 = -i, i4=1i^4 = 1, cycling every four powers:

eiθ=1+iθθ22!iθ33!+θ44!+e^{i\theta} = 1 + i\theta - \frac{\theta^2}{2!} - \frac{i\theta^3}{3!} + \frac{\theta^4}{4!} + \cdots

Separating real and imaginary parts:

eiθ=(1θ22!+θ44!)+i(θθ33!+θ55!)=cosθ+isinθ.e^{i\theta} = \left(1 - \frac{\theta^2}{2!} + \frac{\theta^4}{4!} - \cdots\right) + i\left(\theta - \frac{\theta^3}{3!} + \frac{\theta^5}{5!} - \cdots\right) = \cos\theta + i\sin\theta.

The two bracket expressions are exactly the Taylor series for cosθ\cos\theta and sinθ\sin\theta, completing the derivation.

Special values

Several angles give exact results worth memorizing:

| θ\theta | eiθe^{i\theta} | |---|---| | 00 | 11 | | π/6\pi/6 | 32+i2\dfrac{\sqrt{3}}{2} + \dfrac{i}{2} | | π/4\pi/4 | 12+i2\dfrac{1}{\sqrt{2}} + \dfrac{i}{\sqrt{2}} | | π/3\pi/3 | 12+i32\dfrac{1}{2} + \dfrac{i\sqrt{3}}{2} | | π/2\pi/2 | ii | | π\pi | 1-1 | | 2π2\pi | 11 |

The case θ=π\theta = \pi gives eiπ=1e^{i\pi} = -1, or equivalently eiπ+1=0e^{i\pi} + 1 = 0 — often called Euler's identity.

Try it

This is a numerical exercise — your code should return a number. Using Euler's formula, eiθ=cosθ+isinθe^{i\theta} = \cos\theta + i\sin\theta, find the real part of eiπ/3e^{i\pi/3}.

From the table above (and the 30-60-90 triangle), cos(π/3)=1/2=0.5\cos(\pi/3) = 1/2 = 0.5 exactly.

Run your code to see the quantum state.

Sign in on the full site to ask questions and join the discussion.