TExcelTAD
Home › Pre-Calculus, Geometry & Trigonometry › Trig and Exponential Functions

Trig and Exponential Functions

Sine and cosine describe rotation; the exponential function describes growth. They look unrelated, but with complex numbers they turn out to be the same function. Euler's formula eiθ=cos⁡θ+isin⁡θe^{i\theta} = \cos\theta + i\sin\theta ties them together and makes trigonometry much easier to compute with.

A quick reminder about complex numbers

A complex number z=a+biz = a + bi has a real part aa and an imaginary part bb, where i2=−1i^2 = -1. Plot it as the point (a,b)(a, b) in the plane. Python has them built in, written with j: 3 + 4j. Its length is ∣z∣=a2+b2\lvert z \rvert = \sqrt{a^2 + b^2} and its angle with the positive real axis is arg⁡z=atan2⁡(b,a)\arg z = \operatorname{atan2}(b, a). More on this in Complex Numbers in Polar Form.

Euler's formula

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

As θ\theta varies, eiθe^{i\theta} runs around the unit circle: its real part is cos⁡θ\cos\theta and its imaginary part is sin⁡θ\sin\theta, exactly the point P(θ)P(\theta) from the unit circle.

Why it is true (series sketch). The exponential, sine and cosine all have power series (see Expanding Functions into Series and Taylor series):

ex=1+x+x22!+x33!+x44!+x55!+⋯cos⁡x=1−x22!+x44!−⋯sin⁡x=x−x33!+x55!−⋯\begin{aligned} e^x &= 1 + x + \frac{x^2}{2!} + \frac{x^3}{3!} + \frac{x^4}{4!} + \frac{x^5}{5!} + \cdots \\ \cos x &= 1 - \frac{x^2}{2!} + \frac{x^4}{4!} - \cdots \\ \sin x &= x - \frac{x^3}{3!} + \frac{x^5}{5!} - \cdots \end{aligned}

Put x=iθx = i\theta into the first series. The powers of ii cycle i,−1,−i,1,…i, -1, -i, 1, \ldots, so

eiθ=1+iθ−θ22!−iθ33!+θ44!+iθ55!−⋯=(1−θ22!+θ44!−⋯ )+i(θ−θ33!+θ55!−⋯ )=cos⁡θ+isin⁡θ\begin{aligned} e^{i\theta} &= 1 + i\theta - \frac{\theta^2}{2!} - \frac{i\theta^3}{3!} + \frac{\theta^4}{4!} + \frac{i\theta^5}{5!} - \cdots \\ &= \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 \end{aligned}

Let us check it numerically, including by summing the series ourselves:

python · try it yourself
import cmath
import math

theta = 2.0
z = cmath.exp(1j * theta)
print("e^(iθ)       =", z)
print("cos θ + i sinθ =", complex(math.cos(theta), math.sin(theta)))
print("|e^(iθ)|     =", abs(z))

partial, term = 0, 1 + 0j
for n in range(25):                 # sum (iθ)^n / n!
    partial += term
    term *= 1j * theta / (n + 1)
print("series sum   =", partial)
e^(iθ)       = (-0.4161468365471424+0.9092974268256817j)
cos θ + i sinθ = (-0.4161468365471424+0.9092974268256817j)
|e^(iθ)|     = 1.0
series sum   = (-0.41614683654714246+0.9092974268256817j)

The last digit of the series differs only by rounding.

At θ=π\theta = \pi the formula gives the famous Euler's identity, eiπ+1=0e^{i\pi} + 1 = 0, linking five fundamental constants.

Trig from exponentials

Write Euler's formula for θ\theta and −θ-\theta, and add or subtract:

eiθ=cos⁡θ+isin⁡θe−iθ=cos⁡θ−isin⁡θcos⁡θ=eiθ+e−iθ2sin⁡θ=eiθ−e−iθ2i\begin{aligned} e^{i\theta} &= \cos\theta + i\sin\theta \\ e^{-i\theta} &= \cos\theta - i\sin\theta \\[1ex] \cos\theta &= \frac{e^{i\theta} + e^{-i\theta}}{2} \\ \sin\theta &= \frac{e^{i\theta} - e^{-i\theta}}{2i} \end{aligned}

So sine and cosine are combinations of exponentials. Replacing iθi\theta by a real xx in these formulas gives the hyperbolic functions.

Identities for free

The exponent rule ea⋅eb=ea+be^a \cdot e^b = e^{a+b} contains every sum formula. Multiply:

eiα⋅eiβ=(cos⁡α+isin⁡α)(cos⁡β+isin⁡β)=(cos⁡αcos⁡β−sin⁡αsin⁡β)+i(sin⁡αcos⁡β+cos⁡αsin⁡β)ei(α+β)=cos⁡(α+β)+isin⁡(α+β)\begin{aligned} e^{i\alpha} \cdot e^{i\beta} &= (\cos\alpha + i\sin\alpha)(\cos\beta + i\sin\beta) \\ &= (\cos\alpha\cos\beta - \sin\alpha\sin\beta) + i(\sin\alpha\cos\beta + \cos\alpha\sin\beta) \\ e^{i(\alpha+\beta)} &= \cos(\alpha+\beta) + i\sin(\alpha+\beta) \end{aligned}

Matching real and imaginary parts gives the sum formulas from the angle-formulas lesson in two lines. Raising to the nn-th power gives De Moivre's formula:

(cos⁡θ+isin⁡θ)n=einθ=cos⁡nθ+isin⁡nθ(\cos\theta + i\sin\theta)^n = e^{in\theta} = \cos n\theta + i\sin n\theta

Expanding the left side with the binomial theorem gives cos⁡nθ\cos n\theta and sin⁡nθ\sin n\theta as polynomials in cos⁡θ\cos\theta and sin⁡θ\sin\theta. SymPy can do the rewriting:

python · try it yourself
import sympy as sp

t = sp.Symbol("theta", real=True)
print("cos as exp :", sp.cos(t).rewrite(sp.exp))
print("sin as exp :", sp.sin(t).rewrite(sp.exp))

lhs = sp.expand((sp.cos(t) + sp.I * sp.sin(t))**3)
print("real part of (cos+i sin)^3:", sp.re(lhs))
print("equals cos 3θ?", sp.simplify(sp.re(lhs) - sp.cos(3 * t)) == 0)
print("e^(iπ) + 1 =", sp.exp(sp.I * sp.pi) + 1)
cos as exp : exp(I*theta)/2 + exp(-I*theta)/2
sin as exp : -I*(exp(I*theta) - exp(-I*theta))/2
real part of (cos+i sin)^3: -3*sin(theta)**2*cos(theta) + cos(theta)**3
equals cos 3θ? True
e^(iπ) + 1 = 0

Multiplying means rotating

Every complex number can be written in polar form z=r⋅eiφz = r \cdot e^{i\varphi}, with r=∣z∣r = \lvert z \rvert and φ=arg⁡z\varphi = \arg z. Then

(r1eiφ1)⋅(r2eiφ2)=r1r2⋅ei(φ1+φ2)(r_1 e^{i\varphi_1}) \cdot (r_2 e^{i\varphi_2}) = r_1 r_2 \cdot e^{i(\varphi_1 + \varphi_2)}

Multiplication multiplies lengths and adds angles. In particular, multiplying by eiθe^{i\theta} rotates a point by θ\theta about the origin without changing its length. This is the complex-number version of the rotation matrix.

In software

  • 2D rotation with complex numbers. Store a point as complex(x, y) and rotate it with p * cmath.exp(1j * angle). Some 2D engines and many quick scripts do exactly this; it is the 2D cousin of quaternions (quaternions).
  • Signals and the FFT. The discrete Fourier transform measures how much of each frequency is in a signal by multiplying with e−2πikn/Ne^{-2\pi ikn/N}. Every audio equaliser, MP3/JPEG compressor and spectrum analyser uses it (/signals-fourier/).
  • Phasors in electronics and rotary positional embeddings (RoPE) in large language models both treat pairs of numbers as complex numbers rotated by eiθe^{i\theta}: RoPE rotates query and key vectors by an angle proportional to the token position, so attention depends on relative position.
python · try it yourself
import cmath
import math

p = complex(3, 1)
r = cmath.exp(1j * math.pi / 2)              # rotate by 90°
print("rotated 90°:", complex(round((p * r).real, 12), round((p * r).imag, 12)))

# 12 points of a clock face by repeated rotation
step = cmath.exp(1j * 2 * math.pi / 12)
z, pts = 1 + 0j, []
for _ in range(12):
    pts.append(z)
    z *= step
print("after 12 steps back at start:", round(abs(z - 1), 12))
print("polar form of 1+1j: r =", round(abs(1 + 1j), 6), " angle =", round(math.degrees(cmath.phase(1 + 1j)), 6), "°")
rotated 90°: (-1+3j)
after 12 steps back at start: 0.0
polar form of 1+1j: r = 1.414214  angle = 45.0 °

Exercises

Exercise 1: Evaluate

Write eiπ/3e^{i\pi/3} and e−iπ/2e^{-i\pi/2} in the form a+bia + bi, exactly.

Answer

eiπ/3=12+32ie^{i\pi/3} = \frac{1}{2} + \frac{\sqrt{3}}{2}i, e−iπ/2=−ie^{-i\pi/2} = -i.

Solution
eiπ/3=cos⁡(π/3)+isin⁡(π/3)=12+i32e−iπ/2=cos⁡(−π/2)+isin⁡(−π/2)=0−i=−i\begin{aligned} e^{i\pi/3} &= \cos(\pi/3) + i\sin(\pi/3) = \tfrac{1}{2} + i\tfrac{\sqrt{3}}{2} \\ e^{-i\pi/2} &= \cos(-\pi/2) + i\sin(-\pi/2) = 0 - i = -i \end{aligned}

Exercise 2: Polar form

Write z=−2+2iz = -2 + 2i as r⋅eiφr \cdot e^{i\varphi} with φ\varphi in (−π,π](-\pi, \pi].

Answer

z=22⋅ei⋅3π/4z = 2\sqrt{2} \cdot e^{i \cdot 3\pi/4}.

Solution
r=4+4=22φ=atan2⁡(2,−2)=3π/4(quadrant II)\begin{aligned} r &= \sqrt{4 + 4} = 2\sqrt{2} \\ \varphi &= \operatorname{atan2}(2, -2) = 3\pi/4 && \text{(quadrant II)} \end{aligned}
python · try it yourself
import cmath, math
r, phi = cmath.polar(-2 + 2j)
print(round(r, 6), round(2 * math.sqrt(2), 6), round(phi / math.pi, 6))
2.828427 2.828427 0.75

Exercise 3: De Moivre

Use De Moivre's formula to express sin⁡2θ\sin 2\theta and cos⁡2θ\cos 2\theta in terms of sin⁡θ\sin\theta and cos⁡θ\cos\theta.

Answer

cos⁡2θ=cos⁡2θ−sin⁡2θ\cos 2\theta = \cos^2\theta - \sin^2\theta, sin⁡2θ=2sin⁡θcos⁡θ\sin 2\theta = 2\sin\theta\cos\theta.

Solution
(cos⁡θ+isin⁡θ)2=cos⁡2θ+2isin⁡θcos⁡θ−sin⁡2θ=(cos⁡2θ−sin⁡2θ)+i (2sin⁡θcos⁡θ)It equals cos⁡2θ+isin⁡2θ, so match real and imaginary parts.\begin{aligned} (\cos\theta + i\sin\theta)^2 &= \cos^2\theta + 2i\sin\theta\cos\theta - \sin^2\theta \\ &= (\cos^2\theta - \sin^2\theta) + i\,(2\sin\theta\cos\theta) \\ &\text{It equals } \cos 2\theta + i\sin 2\theta, \text{ so match real and imaginary parts.} \end{aligned}

Exercise 4: Powers of a complex number

Compute (1+i)8(1 + i)^8 using polar form, then check in Python.

Answer
Solution
1+i=2⋅eiπ/4(1+i)8=(2)8⋅ei⋅8π/4=16⋅e2πi=16\begin{aligned} 1 + i &= \sqrt{2} \cdot e^{i\pi/4} \\ (1 + i)^8 &= (\sqrt{2})^8 \cdot e^{i \cdot 8\pi/4} = 16 \cdot e^{2\pi i} = 16 \end{aligned}
python · try it yourself
print((1 + 1j) ** 8)
(16+0j)

Exercise 5: Rotate a polygon

Rotate the square with corners 1+1j, -1+1j, -1-1j, 1-1j by 30° about the origin using complex multiplication, and print the new corners rounded to 4 decimals.

Answer

(0.366+1.366j), (-1.366+0.366j), (-0.366-1.366j), (1.366-0.366j).

Solution
python · try it yourself
import cmath, math
rot = cmath.exp(1j * math.radians(30))
for c in [1+1j, -1+1j, -1-1j, 1-1j]:
    z = c * rot
    print(complex(round(z.real, 4), round(z.imag, 4)))
(0.366+1.366j)
(-1.366+0.366j)
(-0.366-1.366j)
(1.366-0.366j)

Test yourself

What is ∣eiθ∣\lvert e^{i\theta} \rvert for a real angle θ\theta?

  1. θ\theta
  2. eθe^\theta
  3. 1
  4. It depends on θ\theta

Which expression equals cos⁡θ\cos\theta?

  1. (eiθ−e−iθ)/2(e^{i\theta} - e^{-i\theta}) / 2
  2. (eiθ+e−iθ)/2(e^{i\theta} + e^{-i\theta}) / 2
  3. eiθ/ie^{i\theta} / i
  4. eθ+e−θe^\theta + e^{-\theta}

What does multiplying a complex number by eiπ/2e^{i\pi/2} do geometrically?

  1. Doubles its length
  2. Reflects it in the real axis
  3. Rotates it 90° counter-clockwise about the origin
  4. Moves it right by π/2\pi/2