TExcelTAD
Home › Calculus Essentials › Trigonometric Functions

Trigonometric Functions

The trigonometric functions sine, cosine and tangent turn an angle into a number. In calculus they matter because they are the basic periodic functions: anything that repeats, from a pendulum to a sound wave to a spinning wheel, is described with sines and cosines.

Radians

Calculus measures angles in radians. One radian is the angle at which the arc length on a circle equals its radius. A full turn is 2π2\pi radians, so

360∘=2π rad180∘=π rad1 rad≈57.30∘radians=degrees×π/180\begin{aligned} &360^\circ = 2\pi\ \text{rad} \qquad 180^\circ = \pi\ \text{rad} \qquad 1\ \text{rad} \approx 57.30^\circ \\ &\text{radians} = \text{degrees} \times \pi/180 \end{aligned}
Degrees 0° 30° 45° 60° 90° 180° 270° 360°
Radians 0 π/6\pi/6 π/4\pi/4 π/3\pi/3 π/2\pi/2 π\pi 3π/23\pi/2 2π2\pi

Radians are not just a convention: the clean rule "the derivative of sin⁡x\sin x is cos⁡x\cos x" holds only when xx is in radians. Python's math.sin and np.sin expect radians too; convert with math.radians or np.deg2rad.

The unit circle definition

Walk an angle θ\theta counterclockwise from the positive xx-axis around the circle of radius 1. The point you reach is

(cos⁡θ,sin⁡θ)(\cos\theta, \sin\theta)

From that picture:

Function Definition Period Range Even / odd
sin⁡θ\sin\theta yy-coordinate 2π2\pi [−1,1][-1, 1] odd
cos⁡θ\cos\theta xx-coordinate 2π2\pi [−1,1][-1, 1] even
tan⁡θ\tan\theta sin⁡θ/cos⁡θ\sin\theta / \cos\theta π\pi all reals odd
sec⁡θ\sec\theta 1/cos⁡θ1 / \cos\theta 2π2\pi ∣y∣≥1\lvert y \rvert \ge 1 even
csc⁡θ\csc\theta 1/sin⁡θ1 / \sin\theta 2π2\pi ∣y∣≥1\lvert y \rvert \ge 1 odd
cot⁡θ\cot\theta cos⁡θ/sin⁡θ\cos\theta / \sin\theta π\pi all reals odd

tan⁡θ\tan\theta is undefined where cos⁡θ=0\cos\theta = 0, at θ=π/2+nπ\theta = \pi/2 + n\pi; its graph has vertical asymptotes there.

python · try it yourself
import math

print(" deg   rad      sin      cos      tan")
for deg in [0, 30, 45, 60, 90, 120, 180]:
    r = math.radians(deg)
    s, c = math.sin(r), math.cos(r)
    t = "undef" if abs(c) < 1e-12 else f"{s / c:7.4f}"
    print(f"{deg:4}  {r:6.4f}  {s:7.4f}  {c:7.4f}  {t:>7}")
 deg   rad      sin      cos      tan
   0  0.0000   0.0000   1.0000   0.0000
  30  0.5236   0.5000   0.8660   0.5774
  45  0.7854   0.7071   0.7071   1.0000
  60  1.0472   0.8660   0.5000   1.7321
  90  1.5708   1.0000   0.0000    undef
 120  2.0944   0.8660  -0.5000  -1.7321
 180  3.1416   0.0000  -1.0000  -0.0000

The -0.0000 for tan⁡180∘\tan 180^\circ is floating-point noise: sin⁡(π)\sin(\pi) comes out as about 1.2×10−161.2 \times 10^{-16}, not exactly 0, and dividing by −1 gives a tiny negative number.

Key identities

sin⁡2θ+cos⁡2θ=1(Pythagoras on the unit circle)1+tan⁡2θ=sec⁡2θsin⁡(−θ)=−sin⁡θcos⁡(−θ)=cos⁡θsin⁡(a+b)=sin⁡acos⁡b+cos⁡asin⁡bcos⁡(a+b)=cos⁡acos⁡b−sin⁡asin⁡bsin⁡2θ=2sin⁡θcos⁡θcos⁡2θ=cos⁡2θ−sin⁡2θ=1−2sin⁡2θsin⁡(θ+π/2)=cos⁡θ(cosine is a shifted sine)\begin{aligned} \sin^2\theta + \cos^2\theta &= 1 && \text{(Pythagoras on the unit circle)} \\ 1 + \tan^2\theta &= \sec^2\theta \\ \sin(-\theta) &= -\sin\theta \qquad \cos(-\theta) = \cos\theta \\ \sin(a + b) &= \sin a \cos b + \cos a \sin b \\ \cos(a + b) &= \cos a \cos b - \sin a \sin b \\ \sin 2\theta &= 2\sin\theta\cos\theta \\ \cos 2\theta &= \cos^2\theta - \sin^2\theta = 1 - 2\sin^2\theta \\ \sin(\theta + \pi/2) &= \cos\theta && \text{(cosine is a shifted sine)} \end{aligned}

SymPy can confirm them:

python · try it yourself
import sympy as sp

a, b, t = sp.symbols('a b t')
print(sp.simplify(sp.sin(t)**2 + sp.cos(t)**2))
print(sp.expand_trig(sp.sin(a + b)))
print(sp.expand_trig(sp.cos(2*t)))
print(sp.simplify(sp.sin(t + sp.pi/2)))
print(sp.solve(sp.sin(t) - sp.Rational(1, 2), t))
1
sin(a)*cos(b) + sin(b)*cos(a)
2*cos(t)**2 - 1
cos(t)
[pi/6, 5*pi/6]

sp.solve returns the solutions in one period only. The full solution of sin⁡t=1/2\sin t = 1/2 is t=π/6+2nπt = \pi/6 + 2n\pi or t=5π/6+2nπt = 5\pi/6 + 2n\pi for any whole number nn.

Inverse trig functions

Because sine and cosine repeat, they are not one-to-one. Their inverses use restricted ranges:

Inverse Domain Returns angles in
arcsin⁡x\arcsin x (asin) [−1,1][-1, 1] [−π/2,π/2][-\pi/2, \pi/2]
arccos⁡x\arccos x (acos) [−1,1][-1, 1] [0,π][0, \pi]
arctan⁡x\arctan x (atan) all reals (−π/2,π/2)(-\pi/2, \pi/2)

Programmers usually want math.atan2(y, x) instead of atan(y/x): it looks at the signs of both coordinates and returns the correct angle in all four quadrants, in (−π,π](-\pi, \pi] (atan2).

In software: waves and animation

A sine wave y=Asin⁡(2πft+φ)y = A \sin(2\pi f t + \varphi) has amplitude AA, frequency ff (cycles per second) and phase φ\varphi.

  • Audio: a 440 Hz sine sampled 44,100 times per second is the note A. Every sound is a sum of sines, the idea behind the FFT.
  • Animation: bobbing pickups, pulsing buttons and breathing idle animations use sin(time); circular motion uses (rcos⁡ωt,rsin⁡ωt)(r\cos\omega t, r\sin\omega t).
  • Graphics: 2D rotation by θ\theta uses the matrix built from cos⁡θ\cos\theta and sin⁡θ\sin\theta (2D Rotation).
python · try it yourself
import numpy as np
import matplotlib.pyplot as plt

t = np.linspace(0, 0.01, 1000, endpoint=False)    # 10 ms
a4 = 0.8 * np.sin(2 * np.pi * 440 * t)           # the note A4
e5 = 0.4 * np.sin(2 * np.pi * 659.25 * t)        # the note E5
chord = a4 + e5

plt.figure(figsize=(6, 4))
plt.plot(t * 1000, a4, label="440 Hz", alpha=0.6)
plt.plot(t * 1000, e5, label="659.25 Hz", alpha=0.6)
plt.plot(t * 1000, chord, label="sum", linewidth=2)
plt.xlabel("time (ms)"); plt.legend(); plt.grid(alpha=0.3)
plt.title("Two sine waves and their sum")

print("440 Hz period:", round(1000 / 440, 4), "ms")
print("peak of the sum:", round(chord.max(), 4))
440 Hz period: 2.2727 ms
peak of the sum: 1.1487

The peak of the sum is less than 0.8+0.4=1.20.8 + 0.4 = 1.2 because the two waves rarely reach their maximum at the same instant.

Exercises

Exercise 1: Convert angles

Convert 150° and 225° to radians, and 7π/67\pi/6 and 2 rad to degrees.

Answer

150∘=5π/6150^\circ = 5\pi/6, 225∘=5π/4225^\circ = 5\pi/4, 7π/6=210∘7\pi/6 = 210^\circ, 2 rad≈114.59∘2\ \text{rad} \approx 114.59^\circ.

Solution
150×π/180=5π/6225×π/180=5π/47π/6×180/π=210∘2×180/π=360/π≈114.59∘\begin{aligned} 150 \times \pi/180 &= 5\pi/6 \\ 225 \times \pi/180 &= 5\pi/4 \\ 7\pi/6 \times 180/\pi &= 210^\circ \\ 2 \times 180/\pi &= 360/\pi \approx 114.59^\circ \end{aligned}

Exercise 2: Exact values

Find sin⁡(5π/6)\sin(5\pi/6), cos⁡(4π/3)\cos(4\pi/3) and tan⁡(3π/4)\tan(3\pi/4) exactly using the unit circle.

Answer

1/21/2, −1/2-1/2, −1-1.

Solution
  • 5π/65\pi/6 is 150°, in quadrant II with reference angle 30°: sine is positive, sin⁡30∘=1/2\sin 30^\circ = 1/2.
  • 4π/34\pi/3 is 240°, in quadrant III with reference angle 60°: cosine is negative, −cos⁡60∘=−1/2-\cos 60^\circ = -1/2.
  • 3π/43\pi/4 is 135°, quadrant II, reference 45°: sin⁡=2/2\sin = \sqrt{2}/2, cos⁡=−2/2\cos = -\sqrt{2}/2, so tan⁡=−1\tan = -1.
python · try it yourself
import sympy as sp

print(sp.sin(5*sp.pi/6), sp.cos(4*sp.pi/3), sp.tan(3*sp.pi/4))
1/2 -1/2 -1

Exercise 3: Use an identity

If sin⁡θ=3/5\sin\theta = 3/5 and θ\theta is in quadrant II, find cos⁡θ\cos\theta, tan⁡θ\tan\theta and sin⁡2θ\sin 2\theta.

Answer

cos⁡θ=−4/5\cos\theta = -4/5, tan⁡θ=−3/4\tan\theta = -3/4, sin⁡2θ=−24/25\sin 2\theta = -24/25.

Solution
cos⁡2θ=1−sin⁡2θ=1−925=1625  ⇒  cos⁡θ=±45, negative in quadrant II: −45tan⁡θ=3/5−4/5=−34sin⁡2θ=2⋅35⋅(−45)=−2425\begin{aligned} \cos^2\theta &= 1 - \sin^2\theta = 1 - \tfrac{9}{25} = \tfrac{16}{25} \;\Rightarrow\; \cos\theta = \pm\tfrac{4}{5}, \text{ negative in quadrant II: } -\tfrac{4}{5} \\ \tan\theta &= \frac{3/5}{-4/5} = -\frac{3}{4} \\ \sin 2\theta &= 2 \cdot \tfrac{3}{5} \cdot \left(-\tfrac{4}{5}\right) = -\tfrac{24}{25} \end{aligned}

Exercise 4: Orbiting sprite

A sprite circles the point (100,50)(100, 50) with radius 20, one turn every 4 seconds, starting at angle 0. Write its position at time tt and print it at t=0,1,2,3t = 0, 1, 2, 3.

Answer

(100+20cos⁡(πt/2),50+20sin⁡(πt/2))(100 + 20\cos(\pi t/2), 50 + 20\sin(\pi t/2)): (120,50)(120, 50), (100,70)(100, 70), (80,50)(80, 50), (100,30)(100, 30).

Solution

One turn (2π2\pi) every 4 s gives angular speed ω=2π/4=π/2\omega = 2\pi/4 = \pi/2 rad/s.

python · try it yourself
import math

def pos(t):
    a = math.pi / 2 * t
    return (round(100 + 20 * math.cos(a), 6) + 0.0, round(50 + 20 * math.sin(a), 6) + 0.0)

for t in range(4):
    print(t, pos(t))
0 (120.0, 50.0)
1 (100.0, 70.0)
2 (80.0, 50.0)
3 (100.0, 30.0)

Test yourself

What is the period of tan⁡x\tan x?

  1. 2π2\pi
  2. π\pi
  3. π/2\pi/2
  4. It is not periodic

Why should you prefer math.atan2(y, x) over math.atan(y / x) for the angle of a vector?

  1. atan2 is faster
  2. atan2 returns degrees
  3. atan2 uses the signs of xx and yy to get the right quadrant and handles x=0x = 0
  4. atan cannot take negative numbers

Which identity is correct?

  1. sin⁡2θ=2sin⁡θ\sin 2\theta = 2\sin\theta
  2. cos⁡(−θ)=−cos⁡θ\cos(-\theta) = -\cos\theta
  3. sin⁡2θ+cos⁡2θ=1\sin^2\theta + \cos^2\theta = 1
  4. tan⁡θ=cos⁡θ/sin⁡θ\tan\theta = \cos\theta / \sin\theta