Writing Trig Equations from Graphs

Read the maximum, minimum, period and a starting point from a wave and turn them into y = A sin(B(x - C)) + D or a cosine equation.

Advanced30 minLesson

Definition

In the previous lessons you went from an equation to a graph. Now we go the other way: you look at a wave (or read a description of one) and write its equation.
Every sine or cosine wave can be written in one of these forms:
y=Asin⁡(B(x−C))+Dy=Acos⁡(B(x−C))+Dy = A\sin(B(x - C)) + D \qquad y = A\cos(B(x - C)) + D
You only need four readings from the graph: the maximum, the minimum, the period and one starting point.
LetterWhat it meansHow to find it
DDmidline (vertical shift)D=max+min2D = \frac{\text{max} + \text{min}}{2}
AAamplitudeA=max−min2A = \frac{\text{max} - \text{min}}{2}
BBhow fast the wave repeatsB=2πperiodB = \frac{2\pi}{\text{period}}
CCphase shift (horizontal shift)where one cycle starts
**Choosing CC:**
  • Cosine starts at a maximum: CC = the xx of a maximum.
  • Sine starts on the midline going up: CC = the xx where the graph crosses the midline while rising.
The same graph has many correct equations. You can start at any maximum (add or subtract a whole period to CC), switch between sine and cosine (move CC by a quarter period), or use a negative AA (then cosine starts at a minimum). All of them draw the same wave.

Try it now

A sinusoid has a maximum of 88 and a minimum of 22. What is its midline?

Worked Examples

A graph has a maximum of 55 at x=0x = 0, a minimum of 11, and a period of 2π2\pi. Write its equation.
1

Find the midline D

D=5+12=62D = \frac{5 + 1}{2} = \frac{6}{2} → D=3D = 3
2

Find the amplitude A

A=5−12=42A = \frac{5 - 1}{2} = \frac{4}{2} → A=2A = 2
3

Find B from the period

B=2π2πB = \frac{2\pi}{2\pi} → B=1B = 1
4

Choose the form and C

The wave starts at a maximum at x=0x = 0, so use cosine with C=0C = 0

Common Mistakes

Using the maximum as the amplitude (max 77, min 33, so A=7A = 7)

Why it's wrong: The amplitude is measured from the midline, not from the x-axis. The wave is only 22 units above its midline y=5y = 5.

Correct: A=max−min2=7−32=2A = \frac{\text{max} - \text{min}}{2} = \frac{7 - 3}{2} = 2, and the 55 goes into DD.

Writing the period as B (period 1212, so B=12B = 12)

Why it's wrong: B is not the period. A bigger B makes the wave repeat faster, so the period gets shorter.

Correct: B=2πperiod=2π12=π6B = \frac{2\pi}{\text{period}} = \frac{2\pi}{12} = \frac{\pi}{6}.

Getting the sign of C wrong: a maximum at x=2x = 2 written as cos⁡(B(x+2))\cos(B(x + 2))

Why it's wrong: Inside the bracket the shift has the opposite sign. (x+2)(x + 2) moves the wave to the left.

Correct: A maximum at x=2x = 2 means cos⁡(B(x−2))\cos(B(x - 2)). Check: at x=2x = 2 the bracket is 00 and cos⁡(0)=1\cos(0) = 1.

Using sine and putting C at the maximum

Why it's wrong: Sine does not start at a maximum. At x=Cx = C the sine wave is on the midline, going up.

Correct: For sine take the midline crossing going up, which is a quarter period before the maximum. Or use cosine and take the maximum.

Interactive Visual

Function graph

y = sin(x)

Challenge 1 of 5

Move the sliders until your curve lies exactly on the dashed target curve.

How close

0 of 5 solved

-2π-π0π2π-4-2024xy

Tap or hover over the graph to read off values.

y = A·sin(B(x − C)) + DTarget curve

Function graph

y = cos(x)

Challenge 1 of 3

Move the sliders until your curve lies exactly on the dashed target curve.

How close

0 of 3 solved

  • A: smaller
  • B: right
  • C: right
  • D: bigger
-2π-π0π2π-4-2024xy

Tap or hover over the graph to read off values.

y = A·cos(B(x − C)) + DTarget curve

Function graph

0510152002468hoursmmax(2, 7)min(8, 3)(11, 5)max(14, 7)

Tap or hover over the graph to read off values.

water levelmidline y = 5

Interactive Sandbox

Interactive Grapher

-3π-2π-π0π2π3π-4-2024xy

Tap or hover over the graph to read off values.

Try these examples:

2cos(x) + 3

Expression Calculator

Try these:

History

No calculations yet

Practice Problems

18 problems
Problem 1 of 18
Easy
A sinusoid has a maximum of 88 and a minimum of 22. What is its midline?

Why It Matters

Anything that repeats in a smooth cycle can be described by a sine or cosine equation, and in real life you almost never get the equation first. You get data: a highest value, a lowest value and how long one cycle takes.
  • Ferris wheels: your height above the ground rises and falls every turn
  • Tides: the sea level goes between high and low tide about every 12 hours
  • Daylight: the number of daylight hours peaks in summer and repeats every 365 days
  • Springs and pendulums: a weight bounces up and down in a fixed time
  • Temperature: the average daily temperature follows a yearly wave
Once you can write the equation, you can predict: the height after 2 minutes, the water level at 6:00, the daylight on your birthday.

Real World Applications

Hours of Daylight

Astronomers and solar engineers model the length of the day with a cosine wave that repeats every year.

Example:

In a northern city the longest day (day 172172, around June 21) has 1616 hours of daylight and the shortest has 88. A model is y=4cos⁡(2π365(d−172))+12y = 4\cos\left(\frac{2\pi}{365}(d - 172)\right) + 12.

1Try It Yourself

Another city has 1515 hours of daylight on its longest day and 99 hours on its shortest. The pattern repeats every 365365 days.

What value of B goes into the model y=Acos⁡(B(d−C))+Dy = A\cos(B(d - C)) + D?

Step 1: Write the mathematical expression

Use B=2πperiodB = \frac{2\pi}{\text{period}}:

Ferris Wheels

Ride designers use the height equation to check how fast riders climb and how long they spend near the top.

Example:

A wheel 5050 m across with its center 3030 m high turns once every 1212 minutes. Boarding at the bottom gives h(t)=−25cos⁡(π6t)+30h(t) = -25\cos\left(\frac{\pi}{6}t\right) + 30.

2Try It Yourself

You board the wheel above (5050 m across, center 3030 m high, one turn every 1212 minutes) at the bottom at t=0t = 0.

How high are you after 22 minutes (in m)?

Step 1: Write the mathematical expression

Put t=2t = 2 into h(t)=−25cos⁡(π6t)+30h(t) = -25\cos\left(\frac{\pi}{6}t\right) + 30:

A Weight on a Spring

Engineers model vibrations (car suspensions, bridges, sensors) with the same equations as a weight bouncing on a spring.

Example:

A weight bounces between 44 cm and 1616 cm above a table and needs 22 seconds for one full bounce.

3Try It Yourself

The weight above is let go at its highest point (1616 cm) at t=0t = 0. One full bounce takes 22 seconds, the lowest point is 44 cm.

How high is the weight after 13\frac{1}{3} of a second (in cm)?

Step 1: Write the mathematical expression

Use y=6cos⁡(πt)+10y = 6\cos(\pi t) + 10 with t=13t = \frac{1}{3}:

Key Takeaways

  • 1Midline: D=max+min2D = \frac{\text{max} + \text{min}}{2}; amplitude: A=max−min2A = \frac{\text{max} - \text{min}}{2}
  • 2From the period: B=2πperiodB = \frac{2\pi}{\text{period}} (from a maximum to the next minimum is half a period)
  • 3Cosine: CC is the xx of a maximum; sine: CC is where the wave crosses the midline going up
  • 4A wave that starts at a minimum is a cosine with a negative AA
  • 5One graph has many correct equations: add whole periods to CC, move a quarter period to switch sine and cosine, or flip the sign of AA and move half a period
  • 6Always check one point (a maximum or a minimum) in your finished equation

Frequently Asked Questions

Both are correct. Use the one that makes CC easiest: cosine if you can read a maximum clearly, sine if you can read where the wave crosses the midline going up.
Both are correct. Use the one that makes CC easiest: cosine if you can read a maximum clearly, sine if you can read where the wave crosses the midline going up.
Not necessarily. Check a maximum and a minimum in both equations. If they give the same values at the same xx, they draw the same wave. For example y=3sin⁡(2x)+1y = 3\sin(2x) + 1 and y=3cos⁡(2(x−π4))+1y = 3\cos\left(2\left(x - \frac{\pi}{4}\right)\right) + 1 are the same graph.
Measure the horizontal distance between two neighboring maxima (one full period), or between a maximum and the next minimum (half a period) and double it.
The recipe does not change: B=2πperiodB = \frac{2\pi}{\text{period}} with the period in the same unit as xx. A tide with period 1212 hours has B=π6B = \frac{\pi}{6}, a yearly pattern has B=2π365B = \frac{2\pi}{365}.

Glossary

Midline
The horizontal line y=Dy = D halfway between the maximum and the minimum of the wave
Amplitude
The distance from the midline to a maximum: max−min2\frac{\text{max} - \text{min}}{2}
Period
The horizontal length of one full cycle; B=2πperiodB = \frac{2\pi}{\text{period}}
Phase shift
The horizontal shift CC: where a cycle of the basic sine or cosine wave starts
Sinusoidal model
An equation y=Asin⁡(B(x−C))+Dy = A\sin(B(x - C)) + D or y=Acos⁡(B(x−C))+Dy = A\cos(B(x - C)) + D that describes a real repeating quantity

Formula Card

General forms

y=Asin⁡(B(x−C))+Dy = A\sin(B(x - C)) + D, y=Acos⁡(B(x−C))+Dy = A\cos(B(x - C)) + D

Every sine or cosine wave fits one of these forms

Midline

D=max+min2D = \frac{\text{max} + \text{min}}{2}

The average of the highest and lowest value

Amplitude

A=max−min2A = \frac{\text{max} - \text{min}}{2}

Half of the total height of the wave

B from the period

B=2πperiodB = \frac{2\pi}{\text{period}}

The period is the distance between two maxima

Starting point C

cos⁡\cos: C=xmaxC = x_{\text{max}}; sin⁡\sin: C=xmidline, upC = x_{\text{midline, up}}

Cosine starts at a maximum, sine on the midline going up

Today's challengeOne problem, three tries

More in This Topic