Precalculus · Chapter 4

Chapter 4
Trigonometry of circles

Lectures 15–18  |  functions that come back around

In this chapter
  1. The unit circle, radians, and going round
  2. Graphs of sine and cosine: amplitude, period, phase
  3. Fitting a wave to real data
  4. Finding hidden frequencies: a finite Fourier transform

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.


Lecture 15 — The unit circle, radians, and going round

Cartoon: walking in a circleA stick figure stands in the middle of a ring of footprints, arms raised, claiming to be getting somewhere. I am gettingsomewhere.
periodically

Wrapping the line around the circle

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.

definition

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.

spot check

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.

Go round, and watch the wave come out

Drag the point around the circle, or focus the figure and walk it round with the arrow keys. Its height is \(\sin t\), and the trace on the right is that height plotted against \(t\). This is the single most important picture in the chapter: a wave is a circle, seen from the side.

0π/2 π3π/22π

Radians

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.

definition

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.

spot check

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

What one radian is A circle with a radius drawn, and an arc along the circumference of exactly the same length as the radius. The angle between the two radii bounding that arc is one radian, a little under sixty degrees. r r arc = r 1 rad one radian is the angle that wraps exactly one radius-worth of arc around the circle a whole circle is 2π r of arc, so it is 2π radians — about 6.28 1 rad ≈ 57.3°
The definition, drawn. Radians are not an arbitrary alternative to degrees; they are what you get when you measure an angle by the length of arc it produces, in units of the radius. Nothing is chosen.
idea — why not degrees?

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.

spot check

Convert \(90^{\circ}\) to radians.

decimals, fractions, pi and sqrt( ) are all fine

example 4.1 — converting, both ways

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\).

The special points

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
Exact coordinates on the unit circle The first quadrant of the unit circle with the terminal points for 0, 30, 45, 60 and 90 degrees marked and labelled with their exact coordinates. A right triangle is drawn under the 60 degree point, showing that its legs are one half and root three over two. (1, 0)(√3/2, 1/2)(√2/2, √2/2)(1/2, √3/2)(0, 1) each of these points is the corner of one of the two special triangles, scaled to have hypotenuse 1 30° and 60° come from the half-equilateral triangle 45° comes from the half-square 1/2 √3/2
The exact values are not a table to be memorised. Every point here is one of the two special triangles of Chapter 5, shrunk until its hypotenuse is 1, with its legs read off as coordinates. The other three quadrants are these same five points with signs attached.

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.

spot check

The terminal point of \(\tfrac{2\pi}{3}\) is in quadrant ; its reference number is ; so \(\cos\tfrac{2\pi}{3}\) is .

example 4.2 — reference numbers in action

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.

Four angles sharing one reference numberA unit circle with four radii drawn, at pi over six, five pi over six, four pi over three and seven pi over four. Each makes the same small angle with the nearest horizontal direction, so the four terminal points have the same coordinates apart from their signs. 5π/64π/37π/4π/6 (the reference)every one of these points hasthe same reference number π/6,so its coordinates are √3/2 and 1/2up to a sign, decided by the quadrantquadrant II: cos −, sin +quadrant III: both −quadrant IV: cos +, sin −
The reference number is the shortest angular distance from the terminal point to the horizontal axis. Find it, look up the value from the special triangles, then attach the sign the quadrant demands. That is the whole method, and it replaces memorising a table of sixteen entries.

Going round at a steady rate

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

circular motion $$\theta=\omega t,\qquad v=r\omega,\qquad \text{period } P=\frac{2\pi}{\omega},$$

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.

spot check

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

example 4.3 — a satellite, and a sunrise every ninety minutes

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.

example 4.4 — why geostationary satellites sit where they do

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.

example 4.5 — arc length on a big wheel

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.

history

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.

exercises 4.1
  1. Convert to radians: \(72^{\circ}\), \(225^{\circ}\), \(-330^{\circ}\). Convert to degrees: \(\tfrac{5\pi}{3}\), \(\tfrac{11\pi}{12}\), \(2.5\) rad.
  2. Find the terminal point and hence \(\sin t\) and \(\cos t\) for \(t=\tfrac{2\pi}{3}\), \(t=-\tfrac{\pi}{4}\) and \(t=\tfrac{11\pi}{6}\).
  3. Find all \(t\) in \([0,2\pi)\) with \(\sin t=-\tfrac{\sqrt2}{2}\), and all with \(\cos t=\tfrac12\).
  4. A circle has radius 8 cm. Find the arc length and sector area for a central angle of \(2.4\) rad, and for one of \(75^{\circ}\).
  5. A bicycle wheel of radius 35 cm turns at 130 revolutions per minute. Find the angular velocity in rad/s and the bicycle's speed in km/h.
  6. A vinyl record turns at \(33\tfrac13\) revolutions per minute. Find the period, the angular velocity, and the speed of a point 14 cm from the centre. Why does a point near the label move more slowly than one near the rim, despite completing a turn in the same time?
  7. Show that \(\sin(t+2\pi k)=\sin t\) for every integer \(k\), directly from the wrapping picture rather than from a formula.
  8. Compute \(\sin\theta/\theta\) for \(\theta=0.5,0.1,0.02\) radians. Then repeat with \(\theta\) in degrees. Explain in two sentences why radians is the sensible unit for calculus.
  1. \(\tfrac{2\pi}{5}\), \(\tfrac{5\pi}{4}\), \(-\tfrac{11\pi}{6}\); and \(300^{\circ}\), \(165^{\circ}\), \(143.2^{\circ}\).
  2. \(\left(-\tfrac12,\tfrac{\sqrt3}{2}\right)\), so \(\cos=-\tfrac12\), \(\sin=\tfrac{\sqrt3}{2}\).   \(\left(\tfrac{\sqrt2}{2},-\tfrac{\sqrt2}{2}\right)\).   \(\left(\tfrac{\sqrt3}{2},-\tfrac12\right)\).
  3. \(\sin t=-\tfrac{\sqrt2}{2}\) at \(t=\tfrac{5\pi}{4},\tfrac{7\pi}{4}\) (quadrants III and IV). \(\cos t=\tfrac12\) at \(t=\tfrac{\pi}{3},\tfrac{5\pi}{3}\).
  4. \(s=8(2.4)=19.2\) cm and \(A=\tfrac12(64)(2.4)=76.8\) cm². For \(75^{\circ}=1.309\) rad: \(s=10.47\) cm, \(A=41.9\) cm².
  5. \(130\) rpm \(=130(2\pi)/60=13.61\) rad/s. Speed \(=0.35(13.61)=4.77\) m/s \(=17.2\) km/h.
  6. \(P=1.8\) s, \(\omega=2\pi/1.8=3.49\) rad/s, \(v=0.14(3.49)=0.489\) m/s. Both points share \(\omega\) but \(v=r\omega\), so the speed is proportional to the distance from the centre — which is exactly why the outer grooves of a record hold more music per revolution.
  7. Adding \(2\pi k\) means wrapping \(k\) extra whole laps around the circle before stopping, which lands on the same terminal point. Since \(\sin t\) is defined as the height of that point, and the point has not moved, the value cannot change.
  8. Radians: \(0.9589\), \(0.99833\), \(0.99993\) — heading to 1. Degrees: \(0.01745\), \(0.01745\), \(0.01745\) — heading to \(\pi/180\). In radians the small-angle behaviour of sine is simply \(\sin\theta\approx\theta\), so no conversion factor infects the derivative; in degrees every formula in calculus would carry a stray \(\pi/180\).

Lecture 16 — Graphs of sine and cosine: amplitude, period, phase

Cartoon: tuning a guitar by listening for beatsA stick figure holds a guitar. A speech bubble contains the throbbing sound of two nearly matching notes. wah wah wah
the slower the wobble, the closer you are. zero wobble means in tune.

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.

definition

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\).

spot check

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})\).

The four knobs

the general sinusoid $$y=A\sin\big(k(x-b)\big)+c$$
spot check

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.

The sine graph, with four knobs

The dashed curve is the parent \(y=\sin x\); the solid one is what your sliders build. Read the amplitude, period, phase shift and midline off the line underneath as you go.

The cosine graph

The dashed curve is the parent \(y=\cos x\); the solid one is what your sliders build. Read the amplitude, period, phase shift and midline off the line underneath as you go.

The tangent graph

The dashed curve is the parent \(y=\tan x\); the solid one is what your sliders build. Read the amplitude, period, phase shift and midline off the line underneath as you go. Tangent has no amplitude and no maximum — \(A\) simply steepens it. Watch the asymptotes move when you change \(k\) or \(b\).

example 4.6 — reading a formula

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.

example 4.7 — writing a formula from a description

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.

The fitted tide model over one dayA wave oscillating between 0.8 and 4.2 metres about a midline of 2.5, with high tide at three in the morning, low tide just after nine, and the next high tide at about quarter past three in the afternoon. midline 2.5 mhigh 4.2 mlow 0.8 mhigh again3:009:0015:0021:001234hours after midnight
Anchoring a cosine at the high tide makes the phase shift the time of high water, with no further calculation. The period of 12.4 hours is why each high tide arrives a little later than the last — the tide follows the Moon, not the Sun.

Sketching one by hand

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.

how to sketch a sinusoid
  1. Factor the inside so the formula reads \(A\sin\big(k(x-b)\big)+c\). Do this first, every time.
  2. Amplitude \(|A|\), and note whether \(A<0\) flips it.
  3. Period \(P=\dfrac{2\pi}{k}\) — or \(\dfrac{\pi}{k}\) for tangent.
  4. Phase shift \(b\), and midline \(y=c\). The range is \([c-|A|,\,c+|A|]\).
  5. Divide one period into four and mark the five key points: midline, maximum, midline, minimum, midline for a sine; maximum, midline, minimum, midline, maximum for a cosine. Join them, then repeat the shape across your interval.
spot check

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

example 4.8 — sketching a sine

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\).

Sketch of y = 3 sin(2(x − π/4)) + 1One full period drawn from pi over four to five pi over four, oscillating between minus two and four about the midline y equals one, with the five key points marked. π/43π/45π/47π/42π-3-2-112345startmaxmin
The five key points of one period: start on the midline, up to the maximum, back to the midline, down to the minimum, back to the midline. Plot those and join them; everything else is copy and paste.

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.

example 4.9 — sketching a flipped cosine

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\).

Sketch of y = −2 cos(x/2)One full period drawn from zero to four pi. Because of the minus sign the curve starts at its minimum of minus two, rises to a maximum of two at two pi, and returns. π2π3π4π-3-2-1123minmax
A negative amplitude flips the curve, so a cosine that normally starts at its maximum starts at its minimum instead. The period is stretched to \(4\pi\) because \(k=\tfrac12\).

Check the ends: \(y(0)=-2\cos0=-2\) and \(y(4\pi)=-2\cos(2\pi)=-2\). ✓

Tangent, and the others

\(\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.

spot check
Where does \(y=\tan t\) have vertical asymptotes?

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.

example 4.10 — where does it blow up?

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.

example 4.11 — sketching a tangent

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}\).

Sketch of y = tan(x − π/4)Two full branches of a tangent curve, each climbing from far below to far above, separated by vertical dashed asymptotes at minus pi over four, three pi over four and seven pi over four. −π/20π/2π3π/2-4-3-2-11234zerozero
Tangent is drawn asymptote-first. Mark the vertical lines where the cosine underneath is zero, put a point on the axis midway between each pair, and sweep a branch through it from bottom-left to top-right.

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.

Adding waves: harmonics and beats

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 nearby frequencies added together, producing beats A rapidly oscillating wave whose amplitude swells and collapses to nothing once per second, with the envelope drawn as a slow curve above and below. they cancel here 8 Hz + 9 Hz
Two tones one cycle per second apart. Twice per cycle of the difference they are in step and reinforce; in between they are opposed and cancel. The result is a single tone that throbs once a second — and that throb is exactly how a guitar is tuned by ear.
spot check

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

example 4.12 — tuning by ear

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.

idea

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.

for your toolbox

Three more graphs you should now be able to draw from memory, transform on sight, and state the domain and range of.

functiondomainrangefeatures
\(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 realsperiod \(\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.

exercises 4.2
  1. Give the amplitude, period, phase shift and midline: (a) \(y=5\sin(3x)\); (b) \(y=-2\cos\!\left(\tfrac{x}{2}\right)+4\); (c) \(y=\tfrac12\sin\!\left(4x+\pi\right)-1\).
  2. Sketch two full periods of \(y=3\cos\!\left(2\left(x-\tfrac{\pi}{4}\right)\right)\), marking the crests, troughs and midline crossings.
  3. Write an equation for a sinusoid with amplitude 6, period 8, midline \(y=-2\), and a minimum at \(x=1\).
  4. Daylight in a northern city runs from 7.8 hours at the winter solstice to 16.6 hours at the summer solstice. Write a model for daylight as a function of the day of the year, taking day 172 as the summer solstice.
  5. Find all asymptotes and the period of \(y=\tan\!\left(x+\tfrac{\pi}{6}\right)\) and of \(y=\csc(3x)\).
  6. Two tuning forks at 512 Hz and 516 Hz are struck together. Describe what is heard, including the beat rate, and say what the perceived pitch is.
  7. Explain why \(y=\sin x+\sin(2x)\) is periodic with period \(2\pi\), but \(y=\sin x+\sin(\pi x)\) is not periodic at all.
  8. The graph of a sinusoid passes through a maximum at \((2,9)\) and the next minimum at \((7,1)\). Find its amplitude, period, midline and an equation.
  1. (a) \(A=5\), \(P=\tfrac{2\pi}{3}\), no shift, midline 0. (b) \(A=2\) (flipped), \(P=4\pi\), no shift, midline 4. (c) Factor: \(\tfrac12\sin\!\left(4\left(x+\tfrac{\pi}{4}\right)\right)-1\), so \(A=\tfrac12\), \(P=\tfrac{\pi}{2}\), shift \(\tfrac{\pi}{4}\) left, midline \(-1\).
  2. Period \(\pi\), shifted \(\tfrac{\pi}{4}\) right. Crests at \(x=\tfrac{\pi}{4}+\pi n\) with \(y=3\); troughs at \(x=\tfrac{3\pi}{4}+\pi n\); crossings midway between.
  3. \(k=\tfrac{2\pi}{8}=\tfrac{\pi}{4}\). A minimum at \(x=1\) suggests a flipped cosine anchored there: \(y=-6\cos\!\left(\tfrac{\pi}{4}(x-1)\right)-2\).
  4. Midline \(\tfrac{16.6+7.8}{2}=12.2\), amplitude \(4.4\), period 365: \(D(t)=4.4\cos\!\left(\tfrac{2\pi}{365}(t-172)\right)+12.2\) hours.
  5. \(\tan\!\left(x+\tfrac{\pi}{6}\right)\): period \(\pi\), asymptotes at \(x=\tfrac{\pi}{3}+\pi n\). \(\csc(3x)\): period \(\tfrac{2\pi}{3}\), asymptotes wherever \(\sin 3x=0\), that is \(x=\tfrac{\pi}{3}n\).
  6. A tone throbbing four times per second. The perceived pitch is the average, 514 Hz, while the loudness swells and dies at the difference frequency of 4 Hz.
  7. In the first, both components complete a whole number of cycles in \(2\pi\) (one and two), so the sum repeats. In the second the periods are \(2\pi\) and \(2\); their ratio is \(\pi\), an irrational number, so no common multiple exists and the pattern never exactly recurs.
  8. Maximum 9 and minimum 1 give midline 5 and amplitude 4. Max to the next min is half a period, so \(P=10\) and \(k=\tfrac{\pi}{5}\). Anchoring the cosine at the maximum: \(y=4\cos\!\left(\tfrac{\pi}{5}(x-2)\right)+5\).

Lecture 17 — Fitting a wave to real data

Cartoon: a seasonal model that gets October wrongA stick figure points at a smooth seasonal curve while the plotted autumn points fall well below it. My model saysOctober is warm.
October, falling off the bottom of the graph, disagrees

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.

fitting a sinusoid in four steps

Given data that visibly repeats:

  1. Midline \(c=\dfrac{\max+\min}{2}\).
  2. Amplitude \(A=\dfrac{\max-\min}{2}\).
  3. Period \(P\) = the gap between consecutive peaks; then \(k=\dfrac{2\pi}{P}\).
  4. Phase: locate one peak at \(x=b\) and anchor a cosine there.

The model is then \(y=A\cos\big(k(x-b)\big)+c\).

spot check

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.

lab — predict the autumn

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.

monthJanFebMarAprMayJunJulAugSep
°F34.237.445.057.769.974.178.775.064.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:

monthpredictedactualerror
October56.550.1−6.4
November45.346.3+1.0
December37.237.5+0.3

Two of the three are within a degree. October is off by more than six.

Monthly mean temperatures with a fitted sinusoid Twelve monthly averages plotted as dots, with a smooth cosine curve through them. The curve fits closely except in autumn, where the data falls below the curve, most noticeably in October. 35506580 JFMAMJJASOND °F October falls short
The fitted wave against all twelve months. It is right to within a degree or two almost everywhere — and wrong by six degrees in October, in a way that is not random.
idea — read the residuals, not just the fit

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.

spot check
A fitted wave has residuals that are negative every autumn, year after year. What does that tell you?
example 4.13 — iced coffee

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.

Trend plus season

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.

spot check

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

example 4.14 — separating the two parts

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.

exercises 4.3
  1. A wheel-mounted reflector is 0.9 m above the ground at its highest and 0.1 m at its lowest, completing a revolution every 1.6 s. Write its height as a function of time, starting at the top.
  2. Average monthly rainfall in a monsoon region peaks at 340 mm in July and falls to 12 mm in January. Fit a sinusoid and estimate the September figure. Then give one reason the estimate is likely to be poor.
  3. The number of daylight hours in a city is 14.9 at the summer solstice and 9.3 at the winter solstice. Estimate the daylight on 1 April (day 91), taking day 172 as the summer solstice.
  4. Using the temperature model of the lab, predict the mean temperature for the following January and February, and compare with the actual values of 34.2 and 37.4.
  5. For the same model, compute the residuals for all twelve months and state in which season the fit is worst. What single feature of the data is the model unable to represent?
  6. A dataset has a seasonal swing of amplitude 8 and a linear trend rising by 5 units per year, starting at 100. Write the model and find the first time the value exceeds 130.
  7. Two students fit the same seasonal data. One anchors a cosine at the peak; the other anchors a sine at a rising midline crossing. Show that the two models are identical, and say which you would rather compute.
  8. Explain why reading the period from peak to peak is more reliable than reading it from one midline crossing to the next, when the data is noisy.
  1. Midline 0.5, amplitude 0.4, \(k=\tfrac{2\pi}{1.6}=3.927\): \(h(t)=0.4\cos(3.927t)+0.5\) metres.
  2. Midline 176, amplitude 164, period 12, peak at month 7: \(R(m)=164\cos\!\left(\tfrac{\pi}{6}(m-7)\right)+176\). September gives \(R(9)=164\cos\!\left(\tfrac{\pi}{3}\right)+176=258\) mm. It will be poor because monsoon rainfall is not sinusoidal at all — it switches on and off, so the real curve has a plateau and steep edges, and a symmetric wave cannot reproduce that.
  3. Midline 12.1, amplitude 2.8: \(D(t)=2.8\cos\!\left(\tfrac{2\pi}{365}(t-172)\right)+12.1\). At \(t=91\): \(\cos(-1.394)=0.176\), so \(D=12.6\) hours.
  4. The model is periodic, so it predicts exactly what it predicted a year earlier: 34.2 for January (month 13) and 37.2 for February. The January value is exact by construction — it was one of the two numbers used to build the model — and February is off by 0.2.
  5. Residuals (actual minus model): \(0,\ +0.2,\ -0.3,\ +1.2,\ +2.3,\ -1.6,\ 0,\ -0.7,\ -3.2,\ -6.4,\ +1.0,\ +0.3\). The fit is worst in autumn, badly so in October. The model cannot represent the asymmetry of the year: it forces the cooling limb to mirror the warming limb, whereas the real autumn cools faster than the real spring warms.
  6. \(V(t)=100+5t+8\cos\!\left(\tfrac{2\pi}{1}t\right)\) with \(t\) in years, if the peak is at \(t=0\). The trend alone reaches 130 at \(t=6\), and the seasonal term can bring it forward: the value first exceeds 130 near \(t=4.6\) years, at a seasonal peak.
  7. Since \(\cos\theta=\sin\!\left(\theta+\tfrac{\pi}{2}\right)\), a cosine anchored at the peak and a sine anchored a quarter period earlier produce the same curve; the two models differ only by \(\tfrac{P}{4}\) in the phase constant. The cosine version is easier, because peaks are easier to locate on real data than midline crossings.
  8. A peak is a turning point, so noise moves the measured value but barely moves its location; near a midline crossing the curve is at its steepest, so a small vertical error in the data translates into a large horizontal error in where the crossing seems to be. Measure timings where the curve is flat, not where it is steep.

Lecture 18 — Finding hidden frequencies: a finite Fourier transform

Cartoon: hearing three notes at onceOne stick figure thinks beside a spectrum of spikes of different heights while another asks how three notes can be heard at once. How do you hearthree notes at once?
“Arithmetic, apparently.”

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.

Correlation as a detector

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.

spot check
A signal contains exactly the frequency of the test wave, and the two peak together. The products (signal × test wave) are…
idea

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.

the finite Fourier coefficients

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.

spot check

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.

example 4.15 — a mystery signal, taken apart

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.0130.0000.01
216.20025.25930.01
30.0000.0000.00
40.000−0.0290.03
58.0130.0008.01
60.0000.0000.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.

lab — pumpkin spice and influenza

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.

monthJFMAMJJASOND
pumpkin spice433456922741005818
influenza887245221054614325880

Averages: \(a_0=25.5\) for pumpkin spice, \(36.33\) for influenza. The coefficients:

\(k\)pumpkin spiceinfluenza
\(a_k\)\(b_k\)amp\(a_k\)\(b_k\)amp
1−3.34−36.4836.6340.94−4.8741.22
2−22.752.1722.859.33−2.319.62
32.1710.8311.050.830.170.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:

monthpumpkin data1 term3 terms
Sep7458.874.2
Oct10062.095.6
Nov5855.462.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.

Spectra of the two search series Bar charts of the first three Fourier amplitudes. Influenza shows one tall bar and two very short ones. Pumpkin spice shows three bars of decreasing but substantial height. influenza 41.29.60.9 k=1k=2k=3 one cycle a year is nearly the whole story pumpkin spice 36.622.911.0 k=1k=2k=3 a sharp spike needs many frequencies
The same analysis applied to two seasonal signals. The shape of the spectrum tells you the shape of the signal: slowly decaying amplitudes mean sharp features, rapidly decaying ones mean a smooth wave.
Pumpkin spice data rebuilt from one and from three Fourier terms Twelve monthly data points forming a sharp autumn spike, a single smooth sine wave that badly underestimates the peak, and a three-term reconstruction that tracks the spike closely. 50100 JAJAN one term three terms the data
One sinusoid finds the season and flattens the spike to 62. Three find the spike. This is the fix for the October problem of Lecture 17, arrived at by computation rather than guesswork.

What you cannot see

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.

spot check

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.

example 4.16 — notes are peaks

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.

history

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.

idea — the translation, one last time

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.

exercises 4.4
  1. A signal is sampled four times per cycle: \(3,7,3,-1\). Compute \(a_0\), \(a_1\) and \(b_1\), and write the signal as a single cosine with a phase.
  2. Show that for the constant signal \(y_i=5\) every \(a_k\) and \(b_k\) with \(k\ge1\) is zero. Explain the result in one sentence without computing.
  3. A twelve-sample signal has \(a_0=20\), amplitude 12 at \(k=1\) and amplitude 3 at \(k=4\), with everything else zero. Describe the signal in words, and give its maximum possible value.
  4. Using the influenza coefficients from the lab, rebuild the value for January (\(i=0\)) from one term and from three, and compare with the actual 88.
  5. Why is the amplitude at frequency \(k\) defined as \(\sqrt{a_k^{2}+b_k^{2}}\) rather than \(a_k+b_k\)? Relate your answer to Lecture 15.
  6. Data is collected once a month for three years. Give two periodic phenomena that this sampling could detect and two that it could not, and name the principle involved.
  7. A spectrum shows peaks at 300, 600 and 900 Hz. A second shows peaks at 300, 450 and 600 Hz. Which is more likely to be a single musical note, and why?
  8. Explain, in terms of the correlation argument, why a test wave at a frequency the signal does not contain produces a sum near zero rather than a random number.
  1. \(a_0=\tfrac{3+7+3-1}{4}=3\). With \(n=4\) the cosine test values are \(1,0,-1,0\) and the sine values \(0,1,0,-1\): \(a_1=\tfrac24\big(3-3\big)=0\) and \(b_1=\tfrac24\big(7+1\big)=4\). So \(y_i=3+4\sin\!\left(\tfrac{\pi i}{2}\right)\), which as a cosine is \(3+4\cos\!\left(\tfrac{\pi i}{2}-\tfrac{\pi}{2}\right)\).
  2. Each sum becomes \(5\) times the sum of the test-wave values, and a full cycle of a sine or cosine sums to zero. In words: a constant contains no oscillation, so it correlates with nothing.
  3. A signal averaging 20, with a strong once-per-cycle wave of amplitude 12 and a small ripple four times per cycle of amplitude 3. Its maximum is at most \(20+12+3=35\), achieved only if the two components peak together.
  4. One term: \(36.33+40.94(1)-4.87(0)=77.3\). Three terms: add \(9.33-2.31(0)\) and \(0.83+0.17(0)\), giving \(77.3+9.33+0.83=87.4\), against the actual 88. Two extra harmonics close almost the whole gap.
  5. Because \(a_k\) and \(b_k\) are the horizontal and vertical parts of the same oscillation, exactly as \(\cos t\) and \(\sin t\) are the two coordinates of one point on the circle. The size of that point is its distance from the origin, which is the Pythagorean combination, not the sum.
  6. Detectable: an annual cycle, and a six-monthly one — anything with a period of two months or more. Undetectable: a weekly pattern and a daily one, since both complete many cycles between samples. The principle is the Nyquist limit.
  7. The first, since 300, 600 and 900 are whole-number multiples of 300 — a fundamental with its harmonics. The second set has no common fundamental in the same simple pattern and is more likely two or three separate notes sounding together.
  8. Over a whole number of cycles, a mismatched test wave spends exactly as much time in step with the signal as out of step, so the positive and negative products cancel term for term. The near-zero is produced by cancellation, which is why it is reliably near zero rather than merely small on average.

Where this chapter leaves you

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.