Precalculus · F.TF.B.5

Writing an equation from a wave

A wave on a screen rises to a peak, falls to a trough and repeats. Which formula draws exactly that wave, and how much of the picture do you need to find it?

Where you are 8 in Trigonometric functions and their graphs

When you reach for it

The four earlier lessons read a wave off its formula: the Amplitude and reflection from A, the period from b, the phase shift from c and the midline from k in

\begin{aligned} y &= A\sin\bigl(b(x - c)\bigr) + k \quad\text{or} \\ y &= A\cos\bigl(b(x - c)\bigr) + k \end{aligned}

This lesson runs the reading backward. You have a picture of a wave, or a sentence about one, or a table of its values, and you want a formula that produces it. You need one whenever a wave has to be computed rather than looked at: its height at a time the picture does not show, or a formula to hand to a calculator. The lesson runs over two days. Part 1 (Examples 1 to 3) works from a graph. Part 2 (Examples 4 to 7) works from a description or a table and settles which of sine or cosine to use.

The procedure

Part 1: from a graph

Midline and amplitude. Find the highest value M and the lowest value m. The wave swings the same distance above and below its midline, so the midline sits halfway between and the amplitude is half the gap:

k = \frac{M + m}{2}, \qquad |A| = \frac{M - m}{2}

Period. The period P is the horizontal distance from one peak to the next. When only a peak and the next trough are visible, that distance is half a period, and a peak to the next midline crossing is a quarter period. Then, taking b positive,

b = \frac{2\pi}{P}

because a cycle of sine or cosine is 2\pi wide and b squeezes it to P.

Where a cycle starts. Each of the four basic shapes, a sine or a cosine with A positive or negative, starts its cycle at a point you can recognize on any graph:

ShapeSign of AAt x = c the wave is
cosineA > 0at a peak
cosineA < 0at a trough
sineA > 0on the midline, rising
sineA < 0on the midline, falling

Choose one such point on the graph. Its x-coordinate is c.

Why the formula matches the whole graph. Take the first row. At x = c the cosine’s input is 0 and \cos 0 = 1, so y = k + |A|, the top of the wave. The formula runs between k - |A| = m and k + |A| = M and repeats every \displaystyle \frac{2\pi}{b} = P. So formula and graph have the same top, bottom and period, and a peak in the same place. Those four facts leave no freedom in a wave y = A\cos\bigl(b(x - c)\bigr) + k with A > 0 and b > 0: the top and bottom give k and A, the period gives b, and a peak gives c up to a multiple of P, which (as shown below) does not change the wave. The graph is such a wave too, so it has these same letters, and the two agree at every x. The other rows work the same way, because -\cos starts at its lowest value and \pm\sin start on the midline.

More than one right answer. Any peak will do, and consecutive peaks are P apart, so c may be changed by any integer multiple of P. Any of the four rows will do as well. All of these formulas draw the same graph.

Part 2: from a description or a table, and choosing sine or cosine

A description such as “highest value 11 at time 1, lowest value 3 at time 4” carries the same numbers as the graph, so the same three readings apply. A frequency f, in cycles per unit of input, gives the period as \displaystyle P = \frac{1}{f}.

A table gives sampled points. Its largest and smallest entries are M and m only if the table actually lands on a peak and a trough. That is sure to happen when the steps divide a quarter period evenly and one entry falls on a peak, a trough or a midline crossing, since the features come a quarter period apart. The period is the smallest shift that carries every entry to an equal entry.

Choosing sine or cosine. Look for the feature with the simplest x-coordinate, often x = 0. A peak or trough there calls for \pm\cos; a midline crossing calls for \pm\sin. Either way c comes out 0 and the formula is shortest. The choice is only about convenience, because a cosine wave is a sine wave slid a quarter period, as the graphs of sine and cosine showed: \displaystyle \cos\theta = \sin\left(\theta + \frac{\pi}{2}\right) for every \theta.

Worked examples

Example 1

The lead wave

Find two equations for the wave in the figure, which has a highest point at (1, 11) and the next lowest point at (4, 3): one using cosine and one using sine.

y = 7
(1, 11)
(4, 3)
(7, 11)
-2
-1
1
2
3
4
5
6
7
8
3
7
11
x
y
Figure 1The wave of Example 1. The dashed line y = 7 is the midline, halfway between the highest and lowest values.
Solution

The highest value is M = 11 and the lowest is m = 3, so

k = \frac{11 + 3}{2} = 7, \qquad |A| = \frac{11 - 3}{2} = 4

The midline is y = 7, the dashed line. From the peak at x = 1 to the trough at x = 4 is half a period, so P = 2 \cdot 3 = 6 and \displaystyle b = \frac{2\pi}{6} = \frac{\pi}{3}.

Cosine starts at a peak, and there is one at x = 1, so c = 1:

y = 4\cos\left(\frac{\pi}{3}(x - 1)\right) + 7

Sine starts on the midline, rising. The wave rises through the midline a quarter period, \displaystyle \frac{6}{4} = \frac{3}{2}, before the peak, at \displaystyle x = 1 - \frac{3}{2} = -\frac{1}{2}. So \displaystyle c = -\frac{1}{2}:

y = 4\sin\left(\frac{\pi}{3}\left(x + \frac{1}{2}\right)\right) + 7

Check at the trough x = 4: the first input is \displaystyle \frac{\pi}{3} \cdot 3 = \pi and \cos\pi = -1; the second is \displaystyle \frac{\pi}{3} \cdot \frac{9}{2} = \frac{3\pi}{2} and \displaystyle \sin\frac{3\pi}{2} = -1. Both give y = -4 + 7 = 3.

Example 2

Starting at a trough

Find an equation for the wave in the figure, with lowest point \displaystyle \left(\frac{\pi}{6}, -4\right) and next highest point \displaystyle \left(\frac{2\pi}{3}, 2\right).

y = -1
\displaystyle \left(\frac{\pi}{6}, -4\right)
\displaystyle \left(\frac{2\pi}{3}, 2\right)
\displaystyle \frac{\pi}{2}
\pi
-4
2
x
y
Figure 2The wave of Example 2, with its midline y = -1 dashed.
Solution

Here M = 2 and m = -4, so \displaystyle k = \frac{2 + (-4)}{2} = -1 and \displaystyle |A| = \frac{2 - (-4)}{2} = 3. Trough to peak is \displaystyle \frac{2\pi}{3} - \frac{\pi}{6} = \frac{\pi}{2}, half a period, so P = \pi and \displaystyle b = \frac{2\pi}{\pi} = 2.

The first marked point is a trough, and -\cos starts at a trough, so take A = -3 and \displaystyle c = \frac{\pi}{6}:

y = -3\cos\left(2\left(x - \frac{\pi}{6}\right)\right) - 1

Starting at the peak instead gives a positive cosine with \displaystyle c = \frac{2\pi}{3}:

y = 3\cos\left(2\left(x - \frac{2\pi}{3}\right)\right) - 1

Check the second at the trough: \displaystyle 2\left(\frac{\pi}{6} - \frac{2\pi}{3}\right) = -\pi, and 3\cos(-\pi) - 1 = -4.

Example 3

Otabek’s piston

Otabek graphs the height h, in centimeters, of an engine piston’s top above a fixed mark against time t in milliseconds. The graph crosses h = 11 going up at (2, 11), peaks at (7, 16) and bottoms out at (17, 6). Find an equation, the number of cycles each second, and the height at t = 30.

(2, 11)
(7, 16)
(17, 6)
5
10
15
20
25
30
6
11
16
t
h
Figure 3Otabek’s graph of the piston’s height in Example 3.
Solution

With M = 16 and m = 6, the midline is k = 11 and the amplitude is 5, so the point (2, 11) is on the midline. From that rising crossing to the peak is a quarter period, 7 - 2 = 5, so P = 20 milliseconds and \displaystyle b = \frac{2\pi}{20} = \frac{\pi}{10}. A rising midline crossing is where a positive sine starts, so c = 2:

h = 5\sin\left(\frac{\pi}{10}(t - 2)\right) + 11

One cycle takes 20 milliseconds, so there are \displaystyle \frac{1000}{20} = 50 cycles each second.

At t = 30 the input is \displaystyle \frac{\pi}{10} \cdot 28 = \frac{14\pi}{5}. Removing one full turn, \displaystyle \sin\frac{14\pi}{5} = \sin\frac{4\pi}{5} \approx 0.5878, so h \approx 5(0.5878) + 11 \approx 13.9 centimeters.

Example 4

Donncha’s trace: four ways to start

Donncha watches a voltage trace on an oscilloscope. It reaches its lowest value, -1.5 volts, at t = 1 millisecond and its next highest value, 2.5 volts, at t = 3. Write the trace as each of the four basic shapes, then pick the simplest.

Solution

The midline is \displaystyle k = \frac{2.5 + (-1.5)}{2} = 0.5 and \displaystyle |A| = \frac{2.5 - (-1.5)}{2} = 2. Lowest to highest is half a period, so P = 4 milliseconds and \displaystyle b = \frac{2\pi}{4} = \frac{\pi}{2}. There are \displaystyle \frac{1000}{4} = 250 cycles each second.

Each shape needs its own starting point. The trough at t = 1 gives -\cos with c = 1. The peak at t = 3 gives \cos with c = 3. The rising midline crossing is halfway from trough to peak, at t = 2, giving \sin with c = 2. The falling crossing comes a quarter period before the trough, at t = 0, giving -\sin with c = 0:

\begin{aligned} V &= -2\cos\left(\frac{\pi}{2}(t - 1)\right) + 0.5 \\ V &= 2\cos\left(\frac{\pi}{2}(t - 3)\right) + 0.5 \\ V &= 2\sin\left(\frac{\pi}{2}(t - 2)\right) + 0.5 \\ V &= -2\sin\left(\frac{\pi}{2}t\right) + 0.5 \end{aligned}

All four draw the same trace. The last has no shift at all, so it is the one to use.

Example 5

From a table

Zvonimir records these values of a sinusoid. Find an equation with c = 0.

xy
0-1
12
25
32
4-1
52
65
72
8-1
Solution

The values repeat every 4 steps, so P = 4 and \displaystyle b = \frac{\pi}{2}. Half a period apart, a sinusoid sits the same distance above and below its midline, because \cos(\theta + \pi) = -\cos\theta. The pairs x = 0, 2 and x = 1, 3 give \displaystyle \frac{-1 + 5}{2} = \frac{2 + 2}{2} = 2, so k = 2. Then x = 1 is a midline crossing, and x = 0 and x = 2, a quarter period on either side, are a trough and a peak: M = 5, m = -1 and |A| = 3. At x = 0 the wave is at a trough, where -\cos starts:

y = -3\cos\left(\frac{\pi}{2}x\right) + 2

Check at x = 2: -3\cos\pi + 2 = 5. A sine form needs the rising crossing at x = 1, giving \displaystyle y = 3\sin\left(\frac{\pi}{2}(x - 1)\right) + 2, the same wave with a shift to carry.

Example 6

Zvonimir’s signal generator

Zvonimir sets a signal generator to swing between -3 and 5 volts at 200 cycles each second. At t = 0 the voltage is 1 volt and rising. Find an equation with t in milliseconds, and the voltage at t = 2.

Solution

The midline is \displaystyle k = \frac{5 + (-3)}{2} = 1 and the amplitude is \displaystyle \frac{5 - (-3)}{2} = 4. One cycle takes \displaystyle \frac{1}{200} of a second, which is 5 milliseconds, so \displaystyle b = \frac{2\pi}{5}. At t = 0 the voltage is 1, on the midline, and rising, which is where a positive sine starts:

V = 4\sin\left(\frac{2\pi}{5}t\right) + 1

At t = 2: \displaystyle V = 4\sin\frac{4\pi}{5} + 1 \approx 4(0.5878) + 1 \approx 3.35 volts.

Example 7

Why the two answers agree

Show that the two equations of Example 1 are the same function.

Solution

Write \displaystyle \theta = \frac{\pi}{3}(x - 1). By the distributive property,

\begin{aligned} \frac{\pi}{3}\left(x + \frac{1}{2}\right) &= \frac{\pi}{3}(x - 1) + \frac{\pi}{3} \cdot \frac{3}{2} \\ &= \theta + \frac{\pi}{2} \end{aligned}

so the sine equation is \displaystyle y = 4\sin\left(\theta + \frac{\pi}{2}\right) + 7. Since \displaystyle \sin\left(\theta + \frac{\pi}{2}\right) = \cos\theta for every \theta, this is y = 4\cos\theta + 7, the cosine equation. The shift by a quarter period, \displaystyle \frac{3}{2}, became the \displaystyle \frac{\pi}{2} that turns sine into cosine.

Boundaries

  • The procedure needs a true sinusoid: every peak at the same height, every trough at the same depth, peaks equally spaced and each trough exactly halfway between its two peaks. A wave whose peaks shrink, or that rises faster than it falls, has no equation of this form.
  • The formula is only as exact as the readings. Read points that are labeled or fall on grid lines.
  • A table gives M and m only if it contains a peak and a trough. A table that steps past them shows values that are too small, and the midline and amplitude come out wrong (Exercise 21).
  • With x in degrees, a cycle is 360 wide and \displaystyle b = \frac{360}{P}.
  • The answer is never unique: c may change by any integer multiple of P, and \pm\sin and \pm\cos all work.
  • A physical model is an approximation. A real piston’s height is close to a sine wave but not exactly one, because the rod linking it to the crankshaft tilts as it turns.

Where this goes next

Writing the equation is the step that turns a wave into a model. Height on a turning wheel builds the formula from a wheel’s size and speed, Tides, daylight and sound fits waves to repeating data, and Modeling things that repeat uses such a formula to predict and to answer questions about times the data never showed.

Exercises

Part 1: from a graph

Exercises 1 and 2 use the first figure, Exercises 3 and 4 the second.

(2, 9)
(6, 1)
2
4
6
8
10
1
5
9
x
y
Figure 4The wave for Exercises 1 and 2.
(0, -6)
\displaystyle \left(\frac{\pi}{3}, 2\right)
\displaystyle \frac{\pi}{3}
\displaystyle \frac{2\pi}{3}
2
x
y
Figure 5The wave for Exercises 3 and 4.
  1. Find an equation using cosine for the wave in the first figure.
  2. Find an equation using sine, with c = 0, for the wave in Exercise 1.
  3. Find an equation with c = 0 for the wave in the second figure.
  4. Find an equation using cosine with A > 0 for the wave in Exercise 3.
  5. A graph has a highest point at (-1, 6) and the next lowest point at (4, 0). Find an equation using cosine.
  6. A graph has a lowest point at \displaystyle \left(\frac{\pi}{4}, 1\right) and the next highest point at \displaystyle \left(\frac{3\pi}{4}, 7\right). Find an equation with c = 0.
  7. A graph crosses its midline y = -2 going up at x = 3 and next reaches its highest value, 1, at x = 5. Find an equation using sine.
  8. A graph has a highest point at (17, 4) and the next lowest point at (24, -2). Find a cosine equation with 0 \le c < P.
  9. Otabek graphs a larger engine. The piston’s height is highest, 18 centimeters, at t = 5 milliseconds and next lowest, 8 centimeters, at t = 17. Find a cosine equation, the number of cycles each second, and the height at t = 0.

Part 2: from a description or a table

  1. A sinusoid has highest value 10 at x = 0, lowest value -4, and period 12. Find an equation.
  2. A sinusoid crosses its midline y = -1 going down at x = 0, has amplitude 5 and period 4\pi. Find an equation.
  3. Donncha’s trace reaches 1.2 volts, its highest, at t = 0.5 milliseconds and -0.4 volts, its next lowest, at t = 1.5. Find an equation with c = 0 and the number of cycles each second.
  4. Zvonimir’s generator runs at 400 cycles each second between -2 and 6 volts and is at its lowest at t = 0. Find an equation with t in milliseconds.
  5. Find the voltage at t = 1 millisecond for the generator in Exercise 13.
  6. A table of a sinusoid lists x = 0, 1, 2, 3, 4, 5, 6 with y = 3, 6, 3, 0, 3, 6, 3. Find an equation.
  7. A table of a sinusoid lists x = 0, 2, 4, 6, 8, 10, 12 with y = -2, -5, -8, -5, -2, -5, -8. Find an equation using cosine.
  8. Find an equation using a positive sine for the table in Exercise 16.
  9. A table of a sinusoid lists \displaystyle x = 0, \frac{\pi}{8}, \frac{\pi}{4}, \frac{3\pi}{8}, \frac{\pi}{2} with y = 1, 4, 1, -2, 1. Find an equation.
  10. Zvonimir writes \displaystyle y = 2\cos\left(\frac{\pi}{4}(x - 1)\right) and Donncha writes \displaystyle y = 2\sin\left(\frac{\pi}{4}(x + 1)\right) for the same graph. Show that both are right.

Reasoning

  1. Using y = A\cos\bigl(b(x - c)\bigr) + k with A > 0 and b > 0, explain why a peak and the next trough are exactly half a period apart.
  2. Zvonimir samples y = 2\sin x + 1 at x = 0, 1, 2, 3, 4, 5, 6 and takes the largest and smallest entries as M and m. What midline and amplitude does he get, and why are they wrong?
  3. Explain why c may be changed by any integer multiple of the period without changing the graph.
  4. Prove that for b > 0 and \displaystyle P = \frac{2\pi}{b}, the wave y = A\cos\bigl(b(x - c)\bigr) + k is the same as \displaystyle y = A\sin\left(b\left(x - c + \frac{P}{4}\right)\right) + k.
  5. A sketch shows peaks at x = 1 and x = 5 and a trough between them at x = 4. Explain why no equation y = A\sin\bigl(b(x - c)\bigr) + k fits it.
Answers

Other correct equations exist for most of these: c may change by a multiple of P, or another of the four shapes may be used.

  1. \displaystyle y = 4\cos\left(\frac{\pi}{4}(x - 2)\right) + 5. Here k = 5, |A| = 4, \displaystyle \frac{P}{2} = 4, so P = 8 and \displaystyle b = \frac{\pi}{4}; the peak is at x = 2.
  2. \displaystyle y = 4\sin\left(\frac{\pi}{4}x\right) + 5. The rising crossing is a quarter period, 2, before the peak at 2, so at x = 0.
  3. y = -4\cos 3x - 2. Here k = -2, |A| = 4, \displaystyle P = \frac{2\pi}{3}, b = 3, and the trough is at x = 0.
  4. \displaystyle y = 4\cos\left(3\left(x - \frac{\pi}{3}\right)\right) - 2, starting at the peak.
  5. \displaystyle y = 3\cos\left(\frac{\pi}{5}(x + 1)\right) + 3. Here k = 3, |A| = 3, P = 10.
  6. y = -3\sin 2x + 4. Here k = 4, |A| = 3, P = \pi, b = 2; the falling crossing is \displaystyle \frac{\pi}{4} before the trough, at x = 0.
  7. \displaystyle y = 3\sin\left(\frac{\pi}{4}(x - 3)\right) - 2. Here |A| = 1 - (-2) = 3 and \displaystyle \frac{P}{4} = 2, so P = 8.
  8. \displaystyle y = 3\cos\left(\frac{\pi}{7}(x - 3)\right) + 1. Here P = 14, and the peak at 17 means peaks also at 17 - 14 = 3.
  9. \displaystyle h = 5\cos\left(\frac{\pi}{12}(t - 5)\right) + 13; P = 24 milliseconds, so about 41.7 cycles each second; \displaystyle h(0) = 5\cos\frac{5\pi}{12} + 13 \approx 14.3 centimeters.
  10. \displaystyle y = 7\cos\left(\frac{\pi}{6}x\right) + 3. Here k = 3, |A| = 7, \displaystyle b = \frac{2\pi}{12}.
  11. \displaystyle y = -5\sin\frac{x}{2} - 1, since \displaystyle b = \frac{2\pi}{4\pi} = \frac{1}{2}.
  12. V = 0.8\sin(\pi t) + 0.4; 500 cycles each second. Here k = 0.4, |A| = 0.8, P = 2, and the rising crossing is a quarter period before the peak, at t = 0.
  13. \displaystyle V = -4\cos\left(\frac{4\pi}{5}t\right) + 2. Here \displaystyle P = \frac{1000}{400} = 2.5 milliseconds and \displaystyle b = \frac{2\pi}{2.5}.
  14. \displaystyle V = -4\cos\frac{4\pi}{5} + 2 \approx 5.24 volts.
  15. \displaystyle y = 3\sin\left(\frac{\pi}{2}x\right) + 3. Period 4, midline 3, rising at x = 0.
  16. \displaystyle y = 3\cos\left(\frac{\pi}{4}x\right) - 5. Period 8, peak at x = 0.
  17. \displaystyle y = 3\sin\left(\frac{\pi}{4}(x - 6)\right) - 5. The wave rises through -5 at x = 6.
  18. y = 3\sin 4x + 1. Period \displaystyle \frac{\pi}{2}, so b = 4; rising through the midline at x = 0.
  19. Both are right: \displaystyle \frac{\pi}{4}(x + 1) = \frac{\pi}{4}(x - 1) + \frac{\pi}{2}, and \displaystyle \sin\left(\theta + \frac{\pi}{2}\right) = \cos\theta.
  20. Peaks are where b(x - c) = 2\pi n and troughs where b(x - c) = \pi + 2\pi n, n any integer. From the peak x = c, the next trough is at \displaystyle x = c + \frac{\pi}{b} = c + \frac{P}{2}.
  21. Largest entry 2.82 (at x = 2), smallest -0.92 (at x = 5), so midline about y = 0.95 and amplitude about 1.87, instead of 1 and 2. No whole-number sample lands on a peak or trough.
  22. Replacing c by c + nP subtracts bnP = 2\pi n from the input, and cosine and sine repeat every 2\pi.
  23. The sine’s input is \displaystyle b\left(x - c + \frac{P}{4}\right), which by the distributive property is \displaystyle b(x - c) + \frac{bP}{4}, that is, \displaystyle b(x - c) + \frac{\pi}{2}. Since \displaystyle \sin\left(\theta + \frac{\pi}{2}\right) = \cos\theta for every \theta, the two agree at every x.
  24. Peaks at 1 and 5 force P = 4, and on a sinusoid the trough lies halfway between, at x = 3. A trough at 4 means the curve falls for 3 units and rises for 1, which no sine or cosine does.
kg1128 · updated 2026-10-20 · CC-BY-SA-4.0