The idea: four numbers, four jobs

A cosine wave with all its knobs has the form

y = a·cos(bx + c) + d

Without them, y = cos x starts at its peak of 1 at x = 0, comes down through the midline at π/2 and repeats every 2π. Each coefficient changes one thing you can read straight off the graph; the others stay where they were.

Four small plots, cos x in grey in each. a: 2 cos x in blue, twice as tall, dashed lines at y = 2 and −2. b: cos 2x, two waves where there was one, a bracket of length π. c: cos(x + π/2), the same wave moved π/2 to the left. d: cos x + 1, moved up 1 onto the midline y = 1
a sets the height, b the width of one wave, c slides it sideways and d slides it up and down.
coefficientwhat it controlsformula
aamplitude: how far the wave goes above and below its middle|a|
bperiod: how long one wave is2π/|b|
cphase shift: where a cycle startsx = −c/b
dmidline: the middle heighty = d

a: the amplitude

cos u stays between −1 and 1, so a·cos u stays between −|a| and |a|. |a| is the amplitude: how far a peak is above the midline. a = 2 doubles the height, a = ½ halves it, and a negative a turns the wave upside down: where cos x has a peak, −cos x has a trough. a = 0 leaves only the flat line y = d. a does not change the period or the shift. (Demo 2: a, the amplitude)

b: the period

cos u repeats every 2π in u. With u = bx, one whole wave needs bx to grow by 2π, so x has to grow by 2π/|b|:

period = 2π / |b|

b = 2 fits two waves where cos x had one (period π); b = ½ stretches one wave over 4π. So |b| counts how many waves fit into 2π. With b = kπ/16 the period is 32/k: b = π gives period 2.

b = 0 makes bx + c = c for every x, so the graph is the flat line y = a·cos c + d. A negative b mirrors the graph in the y-axis. Cosine is even, cos(−u) = cos u, so cos(−x) is exactly cos x: with c = 0 the sign of b changes nothing. (Demo 1: b from π to −π in steps of π/16: the wave flattens out as b gets close to 0, is the line y = 1 at b = 0 (cos 0 = 1), then comes back exactly as before.)

c: the phase shift

A cycle starts where the inside is 0: bx + c = 0, so at x = −c/b. That is the phase shift. A positive c/b moves the graph to the left, a negative one to the right. Factor out b to see it: a·cos(bx + c) = a·cos(b(x + c/b)), so the shift is c/b, not c.

cos 2x in grey and cos(2x + π/2) in blue on x from −π to π. A teal arrow shows the blue wave starting π/4 to the left of the grey one; a dashed red line at −π/2 marks the wrong answer −c
cos(2x + π/2) = cos(2(x + π/4)): the wave moves π/4 to the left, not π/2.

(Demo 5: the shift is −c/b, not −c) A quarter period to the right turns cosine into sine, cos(x − π/2) = sin x, and half a period turns it upside down, cos(x + π) = −cos x. (Demo 4: c slides it sideways (cos → sin)) Adding 2π to c changes nothing: it is one whole cycle.

d: the midline

d is added to every y, so the whole wave slides up or down without changing shape. The midline y = d is halfway between the peaks and the troughs, and the values run over the range [d − |a|, d + |a|]. (Demo 3: d, the midline) Sliding and stretching any graph is the subject of Function Transformations.

Reading a, b, c, d off a graph

read off the graphgives
highest and lowest yd = (max + min)/2, |a| = (max − min)/2
distance from one peak to the next|b| = 2π / period
where a cycle starts (at a peak)c = −b·xstart

Example, Demo 6: y = 2 cos(½x − π/4) + 1 has max 3 and min −1, so d = 1 and a = 2; one wave is 4π long, so b = 2π/4π = ½; a cycle starts at x = π/2, so c = −½·π/2 = −π/4.

Sine and cosine are one wave

Sine is cosine shifted right by a quarter period: sin x = cos(x − π/2). So every a·sin(bx + c) + d is also a·cos(bx + c − π/2) + d, and everything on this page holds for sine too, with the cycle starting on the midline instead of at a peak. See Sine Waves: What a, b, c, d Do. Why the two are the same wave is clearest on The Unit Circle: cos is the x of a point going round, sin its height, and the x leads the height by a quarter turn.

tan x = sin x / cos x has an asymptote wherever cos x = 0: see Tangent Graphs: What a, b, c, d Do. Multiply the wave by a decaying exponential and it dies out inside an envelope: see Damped Oscillation: What A, γ, ω, φ Do.

Two cosine waves of the same wavelength that meet add up point by point: in step they make one wave twice as tall, half a wavelength apart they cancel. Two sources in a ripple tank do both at once: see Wave Interference: Two Coherent Sources.

What the page leaves out

tan and the other trig functions, writing p·sin x + q·cos x as one wave R·sin(x + φ), sums of waves (Fourier series), angles in degrees, and graphs that need a bigger window than x ∈ [−2π, 2π], y ∈ [−4, 4]. For a cubic instead of a wave, see Cubic Functions: What a, b, c, d Do.