Prerequisites: ch100 (Angle Measurement), ch099 (Circles)
Outcomes: Understand sin, cos, tan as ratios in a right triangle; Connect to the unit circle definition; Build intuition for all six trig functions
Right Triangle Definition¶
In a right triangle with angle θ:
sin(θ) = opposite / hypotenuse
cos(θ) = adjacent / hypotenuse
tan(θ) = opposite / adjacent = sin(θ)/cos(θ)
Mnemonic: SOH-CAH-TOA
Key identity: sin²(θ) + cos²(θ) = 1 (Pythagorean identity) Proof: (opp/hyp)² + (adj/hyp)² = (opp² + adj²)/hyp² = hyp²/hyp² = 1
Unit circle definition (extends to all angles): For angle θ, the point (cos(θ), sin(θ)) lies on the unit circle.
cos(θ) = x-coordinate of the point
sin(θ) = y-coordinate of the point
This works for all θ, including negative angles and angles > 360°.
##
# --- Trigonometry visualization ---
import numpy as np
import matplotlib.pyplot as plt
plt.style.use('seaborn-v0_8-whitegrid')
fig, axes = plt.subplots(1, 3, figsize=(15, 5))
# Right triangle
theta = np.radians(35)
hyp = 1
adj = np.cos(theta)
opp = np.sin(theta)
ax = axes[0]
ax.plot([0, adj, adj, 0], [0, 0, opp, 0], 'steelblue', linewidth=2)
ax.fill([0, adj, adj, 0], [0, 0, opp, 0], alpha=0.15, color='steelblue')
ax.text(adj/2, -0.06, f'adj={adj:.3f}', ha='center', fontsize=10)
ax.text(adj+0.02, opp/2, f'opp={opp:.3f}', va='center', fontsize=10)
ax.text(adj/2-0.08, opp/2+0.04, f'hyp=1', fontsize=10)
ax.text(0.1, 0.04, f'θ={np.degrees(theta):.0f}°', fontsize=11, color='crimson')
ax.set_aspect('equal'); ax.set_xlim(-0.1, 1.3); ax.set_ylim(-0.15, 0.8)
ax.set_title('Right Triangle: SOH-CAH-TOA'); ax.axis('off')
# Unit circle
theta_all = np.linspace(0, 2*np.pi, 300)
axes[1].plot(np.cos(theta_all), np.sin(theta_all), 'steelblue', linewidth=1.5)
theta_demo = np.radians(50)
x_pt, y_pt = np.cos(theta_demo), np.sin(theta_demo)
axes[1].plot([0, x_pt], [0, y_pt], 'crimson', linewidth=2, label='radius=1')
axes[1].plot([x_pt, x_pt], [0, y_pt], 'darkgreen', linewidth=2, linestyle='--', label=f'sin={y_pt:.3f}')
axes[1].plot([0, x_pt], [0, 0], 'darkorange', linewidth=2, linestyle='--', label=f'cos={x_pt:.3f}')
axes[1].plot(x_pt, y_pt, 'ro', markersize=10)
axes[1].annotate(f'(cos θ, sin θ)', (x_pt, y_pt), xytext=(5,5), textcoords='offset points', fontsize=9)
axes[1].axhline(0, color='k', linewidth=0.4); axes[1].axvline(0, color='k', linewidth=0.4)
axes[1].set_aspect('equal'); axes[1].set_xlim(-1.4,1.4); axes[1].set_ylim(-1.4,1.4)
axes[1].set_title(f'Unit Circle (θ=50°)'); axes[1].legend(fontsize=8)
# All six trig functions
theta_plot = np.linspace(-np.pi, 2*np.pi, 400)
ax = axes[2]
ax.plot(theta_plot, np.sin(theta_plot), color='steelblue', lw=2, label='sin')
ax.plot(theta_plot, np.cos(theta_plot), color='crimson', lw=2, label='cos')
ax.plot(theta_plot, np.tan(np.where(np.abs(np.cos(theta_plot))>0.1, theta_plot, np.nan)),
color='darkgreen', lw=2, label='tan')
ax.set_ylim(-3, 3); ax.axhline(0, color='k', linewidth=0.4); ax.set_xlabel('θ (radians)')
ax.set_title('sin, cos, tan'); ax.legend(fontsize=8)
plt.suptitle('Trigonometry: Right Triangles and Unit Circle', fontsize=12, fontweight='bold')
plt.tight_layout(); plt.show()
Key Identities¶
Fundamental:
sin²θ + cos²θ = 1
tan θ = sin θ / cos θ
sin(-θ) = -sin θ (odd); cos(-θ) = cos θ (even)
Addition formulas:
sin(α+β) = sin α cos β + cos α sin β
cos(α+β) = cos α cos β - sin α sin β
Double angle:
sin(2θ) = 2 sin θ cos θ
cos(2θ) = cos²θ - sin²θ = 1 - 2sin²θ
These identities appear throughout physics, signal processing, and ML (e.g., in positional encodings of transformers).
Summary¶
sin, cos, tan: right triangle ratios; unit circle: (cos θ, sin θ) for any angle
Fundamental identity: sin²θ + cos²θ = 1
sin is odd, cos is even; period 2π for both
Forward: ch102 (Sine and Cosine) deepens the analysis; ch103 (Unit Circle) connects to complex numbers and rotations.