Lectures 15–18 | functions that come back around
A great deal of what happens, happens again. Days, tides, seasons, heartbeats, orbits, a guitar string, the alternating current in the wall, the flu. Chapter 2 gave us tools for curves that go somewhere; this chapter is about curves that come back.
You have almost certainly met sine and cosine before as ratios of sides in a right triangle. That definition is genuinely useful and we will return to it in Chapter 5 — but it is the wrong starting point for this chapter, because a triangle has no way to express going round again. So we start with a circle, where repetition is built in, and the triangle will fall out as a special case later.
Take the unit circle — centre at the origin, radius 1 — and take the real number line. Lay the line's zero at the point \((1,0)\) and wrap the positive direction anticlockwise around the circle, the negative direction clockwise. Every real number \(t\) now lands somewhere on the circle, at a point we call the terminal point of \(t\).
The wrapping is a function, and it is spectacularly not one-to-one: since the circumference is \(2\pi\), the numbers \(t\), \(t+2\pi\), \(t+4\pi\) and \(t-2\pi\) all land on the same point. That failure of invertibility is not a defect here. It is repetition, and it is the whole reason we are using a circle.
If the terminal point of \(t\) is \((x,y)\), then $$\cos t = x,\qquad \sin t = y,\qquad \tan t=\frac{y}{x}=\frac{\sin t}{\cos t}\ (x\neq0).$$ That is the definition. Cosine is the horizontal coordinate, sine is the vertical one, and everything else in this chapter is a consequence.
The terminal point of some number \(t\) is \((0.6,\,-0.8)\). What is \(\sin t\)?
decimals, fractions, pi and sqrt( ) are all fine
Two facts follow immediately and for free. First, since \((x,y)\) is on the unit circle, \(x^{2}+y^{2}=1\), so $$\cos^{2}t+\sin^{2}t=1$$ for every \(t\) — the Pythagorean identity, which is just the equation of the circle in new clothes. Second, both functions are trapped between \(-1\) and \(1\), because a point on the unit circle cannot have a coordinate bigger than the radius.
Notice that nothing above mentioned degrees. The input \(t\) was a distance travelled along the circle, and that is the natural way to measure an angle.
An angle of one radian subtends an arc equal in length to the radius. In general, for a circle of radius \(r\), $$\theta=\frac{s}{r},$$ where \(s\) is the arc length. A full turn is \(2\pi\) radians, so \(180^{\circ}=\pi\) radians.
Rearranged, this gives two formulas worth having: arc length \(s=r\theta\) and sector area \(A=\tfrac12r^{2}\theta\), both valid only in radians.
On a circle of radius 5 cm, how long is the arc cut off by a central angle of 2 radians (in cm)?
decimals, fractions, pi and sqrt( ) are all fine
The 360 is an accident of Babylonian base-60 arithmetic and the length of the year. It is a perfectly good unit, and it is the wrong one for mathematics, because it drags an arbitrary constant into every formula.
Here is the cleanest evidence. Compute \(\sin\theta/\theta\) for small \(\theta\) in radians: at \(0.1\) it is \(0.99833\), at \(0.01\) it is \(0.9999833\), at \(0.001\) it is \(0.99999983\). The ratio marches to exactly 1, which says that for small angles \(\sin\theta\approx\theta\) — the two are interchangeable. In degrees the same limit is \(\pi/180=0.01745\ldots\), a number with no meaning attached to it.
That \(\sin\theta\approx\theta\) is the first term of the polynomial approximation from Lecture 11, and in radians its coefficient is 1. Every calculus formula about trigonometry is clean in radians and cluttered in degrees. This is the same principle that made \(e\) the natural base for exponentials: choose units that make the rate of change come out as 1, and the mathematics stops fighting you.
Convert \(90^{\circ}\) to radians.
decimals, fractions, pi and sqrt( ) are all fine
Convert \(150^{\circ}\), \(-45^{\circ}\) and \(1^{\circ}\) to radians, and \(\tfrac{7\pi}{6}\), \(3\) radians to degrees.
Multiply by \(\pi/180\) going one way, by \(180/\pi\) coming back.
\(150^{\circ}=\dfrac{150\pi}{180}=\dfrac{5\pi}{6}\). \(-45^{\circ}=-\dfrac{\pi}{4}\). \(1^{\circ}=0.01745\) rad.
\(\dfrac{7\pi}{6}=\dfrac{7(180)}{6}=210^{\circ}\). \(3\) rad \(=\dfrac{540}{\pi}=171.9^{\circ}\) — just short of a half turn, which is a useful thing to have a feel for, since \(\pi\approx3.14\).
Three terminal points can be found exactly, using nothing but Chapter 0. At \(t=\pi/4\) the point is on the diagonal, so \(x=y\), and \(x^{2}+x^{2}=1\) gives \(x=\tfrac{\sqrt2}{2}\). At \(t=\pi/3\) and \(t=\pi/6\) an equilateral triangle cut in half gives the rest. Everything else on the standard table is these three plus a sign.
| \(t\) | 0 | \(\pi/6\) | \(\pi/4\) | \(\pi/3\) | \(\pi/2\) |
|---|---|---|---|---|---|
| \(\cos t\) | 1 | \(\tfrac{\sqrt3}{2}\) | \(\tfrac{\sqrt2}{2}\) | \(\tfrac12\) | 0 |
| \(\sin t\) | 0 | \(\tfrac12\) | \(\tfrac{\sqrt2}{2}\) | \(\tfrac{\sqrt3}{2}\) | 1 |
For any other \(t\), find its reference number — the shortest distance from its terminal point to the horizontal axis, along the circle — look that up in the table, and then attach the sign the quadrant demands. In the second quadrant \(x<0\) and \(y>0\), so cosine is negative and sine is positive; in the third both are negative; in the fourth, cosine positive and sine negative.
The terminal point of \(\tfrac{2\pi}{3}\) is in quadrant ; its reference number is ; so \(\cos\tfrac{2\pi}{3}\) is .
Find \(\sin\dfrac{5\pi}{6}\), \(\cos\dfrac{4\pi}{3}\), \(\tan\dfrac{7\pi}{4}\) and \(\cos\dfrac{13\pi}{6}\).
\(\dfrac{5\pi}{6}\) is in quadrant II, reference \(\dfrac{\pi}{6}\). Sine is positive there, so \(\sin\dfrac{5\pi}{6}=\dfrac12\).
\(\dfrac{4\pi}{3}\) is in quadrant III, reference \(\dfrac{\pi}{3}\). Cosine is negative there, so \(\cos\dfrac{4\pi}{3}=-\dfrac12\).
\(\dfrac{7\pi}{4}\) is in quadrant IV, reference \(\dfrac{\pi}{4}\), where sine is negative and cosine positive: \(\tan=\dfrac{-\sqrt2/2}{\sqrt2/2}=-1\).
\(\dfrac{13\pi}{6}=2\pi+\dfrac{\pi}{6}\) — one full lap and a bit, landing on the same point as \(\dfrac{\pi}{6}\). So \(\cos\dfrac{13\pi}{6}=\dfrac{\sqrt3}{2}\). Subtracting whole laps first is always the right opening move.
If a point moves around a circle of radius \(r\) at a constant rate, we describe it with the angular velocity \(\omega\), measured in radians per unit time. In time \(t\) it sweeps an angle \(\theta=\omega t\) and covers an arc \(s=r\theta\), so its speed along the rim is
and the position at time \(t\) is \(\big(r\cos\omega t,\ r\sin\omega t\big)\): two waves, ninety degrees out of step, describing one circle.
A point on a wheel of radius 3 m turns at \(\omega=2\) rad/s. What is its speed along the rim, in m/s?
decimals, fractions, pi and sqrt( ) are all fine
The International Space Station orbits at about 400 km above the Earth's surface (radius 6,371 km) at 7.67 km/s. Find its angular velocity, its orbital period, and how many sunrises the crew sees in a day.
Orbital radius \(r=6371+400=6771\) km. From \(v=r\omega\): $$\omega=\frac{7.67}{6771}=1.133\times10^{-3}\ \text{rad/s}.$$
Period \(P=\dfrac{2\pi}{\omega}=5546\) s \(=92.4\) minutes.
In 24 hours that is \(86400/5546=15.6\) orbits, so the crew sees about 15 or 16 sunrises a day. This is true and is one of the odder facts about living up there: the day-night cycle that the human body is built around arrives sixteen times as fast, and the station runs on Greenwich time by convention because nothing outside the window agrees with anything.
A communications satellite must stay above the same point on the equator, so its period must equal one rotation of the Earth, 23 h 56 min. Given that the orbital speed at radius \(r\) satisfies \(v^{2}=GM/r\) with \(GM=398{,}600\) km\(^3\)/s\(^2\), find the required radius.
From \(P=2\pi/\omega\) with \(P=86{,}164\) s we get \(\omega=7.292\times10^{-5}\) rad/s. Since \(v=r\omega\) and \(v^{2}=GM/r\): $$r^{2}\omega^{2}=\frac{GM}{r}\quad\Longrightarrow\quad r^{3}=\frac{GM}{\omega^{2}},$$ so \(r=\sqrt[3]{398600/(7.292\times10^{-5})^{2}}=42{,}164\) km — an altitude of 35,793 km, and a rim speed of 3.07 km/s.
There is exactly one such altitude, which is why that ring of space is valuable property and increasingly crowded. The mathematics that fixes it is one substitution long.
A Ferris wheel of diameter 135 m completes one revolution in 30 minutes. Find its angular velocity in radians per minute, the distance a capsule travels in 4 minutes, and the capsule's speed.
\(\omega=\dfrac{2\pi}{30}=0.2094\) rad/min.
In 4 minutes it sweeps \(\theta=0.8378\) rad, so with \(r=67.5\) m the arc is \(s=r\theta=56.5\) m.
Speed: \(v=r\omega=14.1\) m/min, about \(0.24\) m/s — a slow walk, which is why nobody has to stop the wheel to let you on.
Hipparchus of Rhodes, around 150 BCE, built the first trigonometric table — not of sines but of chords, the straight distance across a circle between two points. He needed it to predict where the planets would be, and the entire apparatus was invented to answer astronomical questions.
The sine itself came from India: Aryabhata, around 500 CE, tabulated the half-chord and called it jya. Arabic translators wrote it phonetically as jiba, which in unvowelled script looks identical to jaib, meaning a fold or pocket in a garment. Twelfth-century Latin translators read it that way and wrote sinus. So the word "sine" means a fold of cloth, by mistake, and has done for eight hundred years.
Unroll the circle and you get the graph. Because the terminal point returns to where it started after \(2\pi\), both curves repeat with period \(2\pi\), forever, in both directions.
A function is periodic with period \(P\) if \(f(x+P)=f(x)\) for all \(x\), and \(P\) is the smallest positive number with that property. Sine and cosine have period \(2\pi\); tangent, as we will see, has period \(\pi\).
A function \(f\) has period 4, and \(f(1)=7\). What is \(f(9)\)?
decimals, fractions, pi and sqrt( ) are all fine
Two features are worth reading off the graphs before we transform anything. Sine is odd — \(\sin(-t)=-\sin t\), because reflecting the terminal point across the horizontal axis flips the height. Cosine is even, since that reflection leaves the horizontal coordinate alone. And the two curves are the same shape, quarter of a turn apart: \(\cos t=\sin(t+\tfrac{\pi}{2})\).
What is the period of \(y=5\sin(3x)\)?
decimals, fractions, pi and sqrt( ) are all fine
These are exactly the transformations of Lecture 4, with nothing new added — \(A\) and \(c\) act on the output, \(k\) and \(b\) intercept the input. What is new is that each one has a physical name, because each one is something you can hear or measure. Amplitude is loudness. Frequency is pitch. Phase is timing. Midline is the level things are oscillating about.
For \(y=3\sin\!\left(2x-\tfrac{\pi}{3}\right)+1\), find the amplitude, period, phase shift and midline, and the \(x\)-values of the first crest for \(x>0\).
First factor the inside so the phase shift is visible — this is the step everybody skips and regrets: $$y=3\sin\!\left(2\left(x-\tfrac{\pi}{6}\right)\right)+1.$$
Amplitude 3; period \(2\pi/2=\pi\); phase shift \(\pi/6\) to the right; midline \(y=1\). The wave runs between \(-2\) and \(4\).
A sine crests when its input is \(\pi/2\), so \(2(x-\pi/6)=\pi/2\) gives \(x=\pi/6+\pi/4=\tfrac{5\pi}{12}\). Crests repeat every period, at \(\tfrac{5\pi}{12}+\pi n\).
Had we read the phase shift as \(\pi/3\) straight off the unfactored form, we would have been wrong by a factor of \(k\). The inside change acts on \(x\) after the stretch.
A tide gauge shows high water of 4.2 m and low water of 0.8 m, with successive high tides 12.4 hours apart. The first high tide of the day is at 3:00. Write a model for the water depth \(h(t)\), \(t\) in hours after midnight.
Midline \(c=\dfrac{4.2+0.8}{2}=2.5\); amplitude \(A=\dfrac{4.2-0.8}{2}=1.7\); period \(P=12.4\), so \(k=\dfrac{2\pi}{12.4}=0.5067\).
Cosine crests at its input zero, so anchoring at the high tide is easiest: $$h(t)=1.7\cos\big(0.5067(t-3)\big)+2.5.$$
Check: \(h(3)=4.2\) ✓, and \(h(9.2)=1.7\cos(\pi)+2.5=0.8\) ✓, a low tide 6.2 hours after high.
Use cosine when you know where the maximum is and sine when you know where the midline crossing is. They are the same function, and picking the convenient one saves a phase calculation.
A sketch is not a plot. You are not computing a hundred values; you are extracting four numbers from the formula and drawing the shape they describe. The routine is always the same.
What is the range of \(y=-2\cos x+1\)? Give the lowest value, then the highest.
2 numbers, separated by a comma: lowest, then highest
Sketch \(y=3\sin(2x-\tfrac{\pi}{2})+1\) on \([0,2\pi]\), stating amplitude, period, phase shift, midline and range.
Factor the inside first: \(2x-\tfrac{\pi}{2}=2\left(x-\tfrac{\pi}{4}\right)\), so $$y=3\sin\!\left(2\left(x-\tfrac{\pi}{4}\right)\right)+1.$$
Amplitude 3. Period \(\tfrac{2\pi}{2}=\pi\). Phase shift \(\tfrac{\pi}{4}\) to the right. Midline \(y=1\). Range \([-2,4]\).
One period runs from \(x=\tfrac{\pi}{4}\) to \(x=\tfrac{\pi}{4}+\pi=\tfrac{5\pi}{4}\). Quartering it gives steps of \(\tfrac{\pi}{4}\), so the key points are at \(\tfrac{\pi}{4},\tfrac{\pi}{2},\tfrac{3\pi}{4},\pi,\tfrac{5\pi}{4}\) with heights \(1,4,1,-2,1\).
The interval asked for is \([0,2\pi]\), which is two full periods, so the shape simply repeats — and note that the graph does not start at the midline, because \(x=0\) is a quarter-period before the phase shift.
Sketch \(y=-2\cos\!\left(\tfrac{x}{2}\right)\) on \([0,4\pi]\).
Amplitude 2, and \(A<0\) so the curve is flipped. \(k=\tfrac12\), so the period is \(\tfrac{2\pi}{1/2}=4\pi\) — the interval asked for is exactly one period. No phase shift, midline \(y=0\), range \([-2,2]\).
A cosine normally starts at its maximum. Flipped, it starts at its minimum, so the key points at \(0,\pi,2\pi,3\pi,4\pi\) have heights \(-2,0,2,0,-2\).
Check the ends: \(y(0)=-2\cos0=-2\) and \(y(4\pi)=-2\cos(2\pi)=-2\). ✓
\(\tan t=\sin t/\cos t\) behaves quite differently. It is zero wherever sine is, and undefined wherever cosine is — at \(t=\pm\pi/2,\pm3\pi/2,\ldots\) — where it has vertical asymptotes. Between consecutive asymptotes it climbs from \(-\infty\) to \(+\infty\), and it repeats every \(\pi\), not every \(2\pi\), because the ratio \(y/x\) is unchanged when both coordinates flip sign.
The three reciprocals are \(\csc t=1/\sin t\), \(\sec t=1/\cos t\) and \(\cot t=1/\tan t\). They exist mostly for the convenience of not writing fractions, and each has asymptotes wherever its partner has a zero.
Find the period and all asymptotes of \(y=\tan\!\left(2x\right)\) and of \(y=\sec\!\left(x-\tfrac{\pi}{4}\right)\).
\(\tan(2x)\): the period is \(\pi/2\). Asymptotes wherever \(2x=\tfrac{\pi}{2}+\pi n\), so \(x=\tfrac{\pi}{4}+\tfrac{\pi}{2}n\).
\(\sec\!\left(x-\tfrac{\pi}{4}\right)\): asymptotes wherever the cosine inside is zero, \(x-\tfrac{\pi}{4}=\tfrac{\pi}{2}+\pi n\), so \(x=\tfrac{3\pi}{4}+\pi n\). Period \(2\pi\).
The rule in both cases: find where the denominator vanishes. An asymptote is a zero in disguise.
Sketch \(y=\tan\!\left(x-\tfrac{\pi}{4}\right)\) on \(\left[-\tfrac{\pi}{2},\tfrac{3\pi}{2}\right]\), marking the asymptotes.
Tangent has period \(\pi\) and no amplitude — it takes every real value on each branch, so the range is all of \(\mathbb{R}\).
The asymptotes are wherever the cosine underneath vanishes: \(x-\tfrac{\pi}{4}=\tfrac{\pi}{2}+n\pi\), giving $$x=\tfrac{3\pi}{4}+n\pi = \ldots,\ -\tfrac{\pi}{4},\ \tfrac{3\pi}{4},\ \tfrac{7\pi}{4},\ \ldots$$
Between consecutive asymptotes sits a zero, halfway along: at \(x=\tfrac{\pi}{4}\) and \(x=\tfrac{5\pi}{4}\).
The domain is everything except the asymptotes. Sketching tangent is asymptote-first: draw the forbidden vertical lines, mark the zero between each pair, then sweep one rising branch through each gap.
Sums of sinusoids are where this becomes interesting. Add waves whose frequencies are whole-number multiples of a base frequency and you get a new shape that still repeats with the base period — that is a musical note with its harmonics, and it is why a violin and a flute playing the same pitch sound different. Add two waves of nearly the same frequency and something else happens.
Two notes of 330 Hz and 332 Hz are played together. How many beats (throbs) per second do you hear?
decimals, fractions, pi and sqrt( ) are all fine
A guitar string is played against a 440 Hz reference and a throb is heard three times per second. What are the possible frequencies of the string? After tightening it slightly, the throb slows to once per second. What is the frequency now, and which way should the next adjustment go?
The beat rate is the difference of the frequencies, so the string is at \(437\) Hz or \(443\) Hz. From the beat alone you cannot tell which — a genuine ambiguity, and the reason tuning by ear requires the next step.
Tightening raises the pitch, and the beat slowed. So the string was below the reference, at 437 Hz, and is now at 439 Hz. Keep tightening: the throb will slow to nothing as it reaches 440.
Notice how sensitive this method is. A skilled ear detects a beat of about 0.5 Hz, which means hearing a pitch difference of one part in a thousand — far better than anyone can judge two notes played separately. The interference does the measuring.
Everything we have added so far has been built by hand from a few pure waves. Lecture 18 runs the process backwards: given a complicated repeating signal, find which pure waves it was made of.
That reversal is one of the most consequential ideas in applied mathematics. Every sound you have ever heard through a phone was taken apart into frequencies, had the ones you cannot hear discarded, and was reassembled. Every JPEG does the same to an image. Every noise-cancelling headphone, every radio tuner, every MRI machine is doing this. The forward direction — adding waves — is what a musical instrument does. The backward direction is what an ear does, and what the next two lectures are about.
Three more graphs you should now be able to draw from memory, transform on sight, and state the domain and range of.
| function | domain | range | features |
|---|---|---|---|
| \(y=\sin x\) | all reals | \([-1,1]\) | period \(2\pi\); odd; starts on the midline |
| \(y=\cos x\) | all reals | \([-1,1]\) | period \(2\pi\); even; starts at its maximum |
| \(y=\tan x\) | all reals except \(\tfrac{\pi}{2}+n\pi\) | all reals | period \(\pi\); odd; vertical asymptotes at every excluded value |
That makes the running collection: power functions, roots and reciprocals from Chapter 2; exponentials and logarithms from Chapter 3; and now the three trigonometric graphs. Every one of them obeys the same five transformations from Lecture 4, so learning a new graph never means learning a new set of rules — only a new shape to apply the old rules to.
Lecture 6 fitted a line to data. This lecture fits a wave, and the procedure is pleasantly concrete: a sinusoid has four numbers in it, and every one of them can be read off a graph with a ruler.
Given data that visibly repeats:
The model is then \(y=A\cos\big(k(x-b)\big)+c\).
Data peaks at 18 and bottoms out at 2. What are the midline \(c\) and the amplitude \(A\)? Give \(c\), then \(A\).
2 numbers, separated by a comma: midline, then amplitude
Nothing here is optimal in the least-squares sense — we are reading four numbers off a picture, not minimising anything. That turns out to matter less than you might expect, because for genuinely seasonal data these four estimates land close to the best fit, and they cost about a minute.
Below are the monthly mean temperatures for New York from the daily series you met in Lecture 3. You are shown January to September. Fit a sinusoid from those nine months only, then predict October, November and December — and afterwards check against what actually happened.
| month | Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep |
|---|---|---|---|---|---|---|---|---|---|
| °F | 34.2 | 37.4 | 45.0 | 57.7 | 69.9 | 74.1 | 78.7 | 75.0 | 64.4 |
From the nine shown months: \(\max=78.7\) in July (month 7), \(\min=34.2\) in January (month 1).
Midline \(c=\dfrac{78.7+34.2}{2}=56.45\). Amplitude \(A=\dfrac{78.7-34.2}{2}=22.25\). Period \(P=12\) months, so \(k=\dfrac{2\pi}{12}=\dfrac{\pi}{6}\). Peak at \(b=7\).
$$T(t)=22.25\cos\!\left(\frac{\pi}{6}(t-7)\right)+56.45$$Predictions and reality:
| month | predicted | actual | error |
|---|---|---|---|
| October | 56.5 | 50.1 | −6.4 |
| November | 45.3 | 46.3 | +1.0 |
| December | 37.2 | 37.5 | +0.3 |
Two of the three are within a degree. October is off by more than six.
A model's errors are data too. Ours are small in winter and spring, small in December, and large and negative in autumn — the real temperature drops faster after the summer peak than it rose before it. The year is not symmetric, and a single cosine is symmetric by construction: it insists that the climb to the peak and the fall from it are mirror images.
So the residuals are telling us something physical (oceans and land release heat at different rates) and something mathematical: one sinusoid is not enough. To capture an asymmetric annual cycle we need to add a second wave, with two cycles per year, which can steepen one side and flatten the other. And a third, and so on.
Which raises the obvious question: how would you know what second wave to add? Guessing is hopeless. Lecture 18 gives the procedure that computes it.
A café's weekly iced-coffee sales peak at 620 cups in the first week of August (week 31) and bottom out at 140 cups in the first week of February (week 5). Model the sales, and estimate the sales in week 20.
Peak and trough are 26 weeks apart, which is half a period, so \(P=52\) and \(k=\dfrac{2\pi}{52}=0.1208\).
Midline \(\dfrac{620+140}{2}=380\); amplitude \(\dfrac{620-140}{2}=240\). Anchor a cosine at the peak: $$S(w)=240\cos\big(0.1208(w-31)\big)+380.$$
Week 20: \(S(20)=240\cos(0.1208(-11))+380=240\cos(-1.329)+380=240(0.2393)+380=437\) cups.
Is this a good model? It has the right shape and will be roughly right, but a café is not a planet. A heatwave, a competitor opening, or a viral drink will all beat the model badly, and no amount of trigonometry anticipates them. Seasonality is a component of the data, not the whole of it.
Much real data is a wave riding on a line. Atmospheric carbon dioxide oscillates annually as the northern forests leaf out and die back, while climbing relentlessly year on year. Subscriber counts wobble with the seasons while trending up. The fix is simply to add the two models.
A series climbs by 24 units per year on top of its seasonal wave. With \(t\) in months, what is the slope of the trend line?
decimals, fractions, pi and sqrt( ) are all fine
Monthly atmospheric CO₂ at Mauna Loa was about 417.0 ppm in January 2022 and about 421.0 ppm in January 2023, with a seasonal swing of roughly 6 ppm peaking in May and bottoming in September. Build a model for months after January 2022, and estimate the reading for May 2023.
Trend: 4 ppm per year, so \(L(t)=417.0+\dfrac{4}{12}t=417.0+0.3333t\).
Season: amplitude \(3\) (half of the 6 ppm swing), period 12, peak in May, which is \(t=4\) months after January: $$S(t)=3\cos\!\left(\frac{\pi}{6}(t-4)\right).$$
Model \(C(t)=417.0+0.3333t+3\cos\!\left(\tfrac{\pi}{6}(t-4)\right)\).
May 2023 is \(t=16\): \(C(16)=417.0+5.33+3\cos(2\pi)=417.0+5.33+3=425.3\) ppm.
The decomposition is the point. The wave is the Earth breathing in and out once a year; the line is what we are doing to it. Separating a signal into a trend plus a seasonal part plus a remainder is the standard first move in time-series analysis, and you have just done it with the contents of two lectures.
Lecture 16 added pure waves together to build complicated shapes. Lecture 17 ran into the limits of a single wave. This lecture does the hard direction: given a repeating signal, find out which pure waves it is made of.
It sounds like it should require heavy machinery. It requires multiplication and addition.
Here is the idea in one sentence: to test whether a signal contains a particular frequency, multiply the signal by a test wave of that frequency and add up the products.
Why does that work? If the signal really does contain that frequency, then signal and test wave rise and fall together; their product is positive when both are positive and positive again when both are negative, so the sum builds up. If the signal does not contain that frequency, the two drift in and out of step, the products are positive about as often as negative, and the sum collapses to nearly nothing.
This is exactly what a tuning fork does. Hold a 440 Hz fork near a piano, play a chord, and the fork hums if the chord contains an A. It is a physical correlator: it responds to the component of the sound that matches its own frequency and ignores everything else.
Your ear is a bank of thousands of these, laid along the cochlea, each tuned to a different frequency. Hearing a chord as separate notes is a Fourier analysis performed by biology, in real time, without arithmetic. We are about to do the same thing with a table of numbers.
Suppose a repeating signal is sampled \(n\) times per cycle, giving \(y_0,y_1,\dots,y_{n-1}\). For each whole number \(k\) define $$a_k=\frac{2}{n}\sum_{i=0}^{n-1}y_i\cos\!\left(\frac{2\pi k i}{n}\right),\qquad b_k=\frac{2}{n}\sum_{i=0}^{n-1}y_i\sin\!\left(\frac{2\pi k i}{n}\right),$$ and let \(a_0=\dfrac1n\sum y_i\), the plain average. The amplitude at frequency \(k\) is \(\sqrt{a_k^{2}+b_k^{2}}\), and the signal can be rebuilt as $$y(i)\approx a_0+\sum_k\left[a_k\cos\!\left(\tfrac{2\pi ki}{n}\right)+b_k\sin\!\left(\tfrac{2\pi ki}{n}\right)\right].$$
Every term is one multiplication and one addition. There is no calculus anywhere in it. The version you meet later looks almost identical, with the sums replaced by their smooth counterparts once the samples become infinitely close together.
At some frequency, \(a_k=3\) and \(b_k=-4\). What is the amplitude at that frequency?
decimals, fractions, pi and sqrt( ) are all fine
Two cosine and sine terms are needed at each frequency rather than one, because a wave at frequency \(k\) can be shifted to any phase, and \(a_k\cos+b_k\sin\) can produce any phase. The pair \((a_k,b_k)\) encodes both how much of that frequency is present and where its peak sits.
A quantity is sampled twelve times per cycle:
74.2, 73.0, 67.8, 33.8, 16.0, 43.2, 58.2, 86.9, 59.8, 33.8, 24.0, 29.3
Compute the amplitude at each frequency \(k=1,\dots,6\) and say what the signal is made of.
The test-wave values are the same twelve numbers over and over. For \(k=1\), \(\cos(2\pi i/12)\) runs through \(1,\ 0.866,\ 0.5,\ 0,\ -0.5,\ -0.866,\ -1,\ -0.866,\ -0.5,\ 0,\ 0.5,\ 0.866\).
Multiplying term by term and summing, then doubling and dividing by 12:
| \(k\) | \(a_k\) | \(b_k\) | amplitude |
|---|---|---|---|
| 1 | −0.013 | 0.000 | 0.01 |
| 2 | 16.200 | 25.259 | 30.01 |
| 3 | 0.000 | 0.000 | 0.00 |
| 4 | 0.000 | −0.029 | 0.03 |
| 5 | 8.013 | 0.000 | 8.01 |
| 6 | 0.000 | 0.000 | 0.00 |
Two frequencies are present and nothing else: a large component at \(k=2\) with amplitude 30, and a smaller one at \(k=5\) with amplitude 8. The average \(a_0\) is 50.
And that is exactly right — the signal was built as \(50+30\cos\!\left(\tfrac{2\pi\cdot2i}{12}-1\right)+8\cos\!\left(\tfrac{2\pi\cdot5i}{12}\right)\). Twelve numbers went in; the recipe came out. The frequencies that are absent produce zeros not by luck but by cancellation, which is the whole mechanism.
Two twelve-month series of search interest, each scaled to a maximum of 100, are given below. Compute the first three Fourier amplitudes for each, compare their spectra, rebuild each signal from three terms, and forecast next October.
| month | J | F | M | A | M | J | J | A | S | O | N | D |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| pumpkin spice | 4 | 3 | 3 | 4 | 5 | 6 | 9 | 22 | 74 | 100 | 58 | 18 |
| influenza | 88 | 72 | 45 | 22 | 10 | 5 | 4 | 6 | 14 | 32 | 58 | 80 |
Averages: \(a_0=25.5\) for pumpkin spice, \(36.33\) for influenza. The coefficients:
| \(k\) | pumpkin spice | influenza | ||||
|---|---|---|---|---|---|---|
| \(a_k\) | \(b_k\) | amp | \(a_k\) | \(b_k\) | amp | |
| 1 | −3.34 | −36.48 | 36.63 | 40.94 | −4.87 | 41.22 |
| 2 | −22.75 | 2.17 | 22.85 | 9.33 | −2.31 | 9.62 |
| 3 | 2.17 | 10.83 | 11.05 | 0.83 | 0.17 | 0.85 |
Both have a dominant annual cycle, as expected. But look at how the amplitudes fall off. Influenza goes \(41.2,\ 9.6,\ 0.9\) — the first harmonic carries almost everything, so flu season is nearly a pure annual sine wave. Pumpkin spice goes \(36.6,\ 22.9,\ 11.0\) — the higher harmonics refuse to die away.
That difference is the mathematics detecting something real. Flu rises and falls over months. Pumpkin spice is a spike: nothing all year, then an explosion in September and a collapse in November. Sharp features need high frequencies, and a spike needs a great many of them.
Rebuilding from three terms:
| month | pumpkin data | 1 term | 3 terms |
|---|---|---|---|
| Sep | 74 | 58.8 | 74.2 |
| Oct | 100 | 62.0 | 95.6 |
| Nov | 58 | 55.4 | 62.8 |
One term gets the season and badly flattens the peak. Three terms recover the October spike to within 5%, from nothing but twelve numbers and some arithmetic.
Forecast for next October: the model is periodic, so it repeats — about 96 on the same scale. Which is a forecast worth stating carefully. It assumes next year behaves like this one, and it carries no information about trend, about a new product, or about anything that has never happened before. What it does capture, honestly and cheaply, is the shape of the season.
Sampling twelve times per cycle lets you detect frequencies up to \(k=6\), and no further. The reason is the aliasing you met in Lecture 3: a wave that completes more than half a cycle between consecutive samples is indistinguishable from a slower one. This is the Nyquist limit, and it is a hard wall, not a matter of technique.
A signal is sampled 24 times per cycle. What is the highest frequency \(k\) you can detect?
decimals, fractions, pi and sqrt( ) are all fine
It is why CD audio samples 44,100 times per second: human hearing tops out near 20 kHz, and you need more than twice that. It is why a security camera at 30 frames per second cannot tell you how fast a propeller is spinning. And it is why monthly data can never reveal a weekly pattern, no matter how many months you collect.
A one-second audio clip is sampled and its spectrum shows large amplitudes at 220, 440 and 660 Hz, with small ones at 880 and 1100. What is being played, and what does the pattern of amplitudes describe?
The frequencies are \(220\times1,2,3,4,5\) — a single note of pitch 220 Hz (the A below middle C) together with its harmonics. The pitch you hear is the lowest one, the fundamental.
The relative sizes of the harmonics are the timbre: the thing that makes a clarinet, a violin and a human voice singing the same note sound utterly different. A clarinet suppresses the even harmonics; a violin keeps them. Change nothing but the amplitudes in the spectrum and you change the instrument while keeping the note.
This is also how audio compression works. An MP3 computes the spectrum, discards the components the ear cannot detect — too quiet, or masked by a louder neighbour — and stores what remains. The discarded information is gone forever, which makes it exactly the kind of deliberately non-invertible function from Lecture 5.
Joseph Fourier, studying how heat spreads through a solid, claimed in 1807 that any function could be written as a sum of sines and cosines. The claim was audacious, and to the leading mathematicians of the day plainly false: Lagrange, on the committee reviewing the work, objected that a sum of smooth waves could not possibly produce a function with a corner in it. The paper was rejected.
Fourier was mostly right, and settling how right took a century and forced mathematicians to sharpen the very definitions of function, convergence and integral. The precise conditions carry names — Dirichlet, Riemann, Lebesgue — and much of modern analysis grew out of the attempt to answer a question about heat.
Then in 1965 Cooley and Tukey published an algorithm computing these sums in \(n\log n\) operations instead of \(n^{2}\). For a million samples that is a speed-up of about fifty thousand. The Fast Fourier Transform is why all of this happens in real time on a phone, and it is a serious candidate for the most consequential algorithm of the twentieth century.
Lecture 13 made the point that logarithms move a problem to a world where it is easy. The Fourier transform is the same manoeuvre, and the most powerful instance of it. In the time world, removing a hum from a recording is hopeless. In the frequency world it is deletion of one number. Blurring an image is an awkward operation on pixels and a multiplication on frequencies.
So the pattern completes: coordinates translated geometry into algebra, logarithms translated multiplication into addition, and the Fourier transform translates a signal into its ingredients. In every case someone noticed that the hard problem was easy on the other side, and built the bridge. Chapter 7 builds one more, when a change of basis turns an awkward matrix into a diagonal one — and that, it will turn out, is what the Fourier transform was all along.
Sine and cosine are the coordinates of a point going round a circle, which is why they repeat and why \(\cos^{2}+\sin^{2}=1\) is free. Four numbers — amplitude, period, phase, midline — describe any single wave, and you can read all four off a graph of real data. And any repeating signal, however jagged, can be taken apart into pure waves by multiplying and adding.
Chapter 5 returns to the triangle, where sine and cosine started historically, and uses it to measure things nobody can reach: the height of a building from its shadow, the size of the Earth, the distance to the Moon. It ends on a sphere, where the angles of a triangle add to more than \(180^{\circ}\) and the geometry of Chapter 1 quietly stops being true.
Next: Chapter 5 — Geometry of triangles.