Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools

How to Graph a Sine or Cosine Function

Every sine or cosine graph is the basic wave stretched, squeezed and shifted. Read the four parameters from y=Asin⁡(B(x−C))+Dy = A\sin\big(B(x - C)\big) + D, then plot five key points a quarter-period apart and join them.

Recognize the task

"Graph y=3sin⁡(2x−π)+1y = 3\sin(2x - \pi) + 1", "state the amplitude, period and phase shift", "write an equation for this graph". Test: a sine or cosine with numbers in front, inside or added.
The four parameters are explained in the graphs lesson: amplitude, period, phase shift and midline; the plotting is the key-point method.

Steps

StepOn y=3sin⁡(2x−π)+1y = 3\sin(2x - \pi) + 1
1Factor B out of the bracket. The phase shift is only visible in the form B(x−C)B(x - C).y=3sin⁡(2(x−π2))+1y = 3\sin\big(2(x - \tfrac{\pi}{2})\big) + 1
2Read the four parameters. Amplitude ∣A∣|A|, period 2π∣B∣\frac{2\pi}{|B|}, phase shift CC (right if positive), midline y=Dy = D. A negative AA flips the wave.amplitude 33, period π\pi, shift π2\frac{\pi}{2} right, midline y=1y = 1
3Mark one period starting at the shift. Split it into four equal steps.from x=π2x = \frac{\pi}{2} to 3π2\frac{3\pi}{2}, step π4\frac{\pi}{4}
4Plot the five key points. Sine: midline, max, midline, min, midline. Cosine: max, midline, min, midline, max. Heights are D±∣A∣D \pm |A|.(π2,1)(\tfrac{\pi}{2}, 1), (3π4,4)(\tfrac{3\pi}{4}, 4), (π,1)(\pi, 1), (5π4,−2)(\tfrac{5\pi}{4}, -2), (3π2,1)(\tfrac{3\pi}{2}, 1)
5Join with a smooth wave and repeat each period.one full wave, then copies left and right

Worked examples

Example 1 · a reflected cosine

negative A
y=−2cos⁡x2y = -2\cos\frac{x}{2}: amplitude 22, period 4π4\pi
starts at a minimum
(0,−2)(0, -2), (π,0)(\pi, 0), (2π,2)(2\pi, 2), (3π,0)(3\pi, 0), (4π,−2)(4\pi, -2)

Example 2 · equation from a graph

reverse
max 55, min −1-1, period 88, a maximum at x=0x = 0
A=5−(−1)2=3A = \frac{5 - (-1)}{2} = 3, D=2D = 2, B=2π8B = \frac{2\pi}{8}
y=3cos⁡πx4+2y = 3\cos\frac{\pi x}{4} + 2

Example 3 · the trace

all four parameters
y=3sin⁡(2x−π)+1y = 3\sin(2x - \pi) + 1
amplitude 33, period π\pi, shift π2\frac{\pi}{2} right, midline y=1y = 1

See it happen

y = 1.0 sin(1.00x − 0) + 0.0
y = 1.0 sin(1.00x - 0) + 0.0-2π-3π/2-π-π/20π/2π3π/22πD — midline y = 0.0A — |A| = 1.0max = D + |A| = 1.0min = D - |A| = -1.0B — period = 2π
Function
Reset
Reads as
amplitude 1.0, period 2π, shift 0, midline 0.0
Outside the function — acts on the output, moves the curve vertically
Aamplitude|A| tall
Dvertical shiftmidline
Inside the function — acts on the input x, moves the curve horizontally
Bperiod2π/|B|
Cphase shiftshift C/B
Guided walk
Amplitude |A|
1.0
Period
2π
C itself
0
Shift C/B
0
Midline D
0.0
Max / min
1.0 / -1.0
Explanations
Aamplitude — half the height, from midline to peak
Bperiod — how many cycles fit the window
Cphase shift — how far sideways, by C/B
Dvertical shift — where the midline sits
y = A f(Bx - C) + D. Four letters, four separate jobs. Move one slider and exactly one feature of the curve responds; each is drawn on the graph in its own colour. Outside the function, A and D act on the value it returns, so they work vertically. Inside, B and C act on the input x, so they work horizontally.
Move one parameter at a time: AA stretches the wave vertically, BB squeezes it horizontally, CC slides it sideways, DD lifts it. Each of the four steps of the method undoes one of those moves.

Common mistakes

Phase shift read before factoring

✗ sin⁡(2x−π)\sin(2x - \pi): shift π\pi
✓ 2(x−π2)2(x - \frac{\pi}{2}): shift π2\frac{\pi}{2}

Period as B

✗ period of sin⁡2x\sin 2x is 22
✓ 2π2=π\frac{2\pi}{2} = \pi

Amplitude negative

✗ amplitude of −2cos⁡x-2\cos x is −2-2
✓ amplitude 22; the minus sign reflects the graph