Math
Trigonometric graph calculator
Choose a function and the four constants A, B, C and D to draw the transformed graph over its parent curve, with every feature a textbook asks for. Or pick “Any expression” and type your own function of x.
π works: pi/2, π/3.
Examples: 3cos(x/2), sin²x, x·sin x, tan(x) − 1. x is in radians.
┄ y = sin(x) ━ y = 2 sin(2x − π/2) + 1
Pale curves: the parent graph y = sin(x) and the midline y = 1. Dots: the key points in the table.
| x | Bx − C | y |
|---|---|---|
| π/4 | 0 | 1 |
| π/2 | π/2 | 3 |
| 3π/4 | π | 1 |
| π | 3π/2 | −1 |
| 5π/4 | 2π | 1 |
Show the working, step by step
Match the equation to y = A·f(Bx − C) + D.
A = 2, B = 2, C = π/2, D = 1
The amplitude is |A|, half the distance from the lowest point to the highest.
amplitude = |2| = 2
The period of sin is 2π; dividing by |B| squeezes or stretches it.
period = 2π ÷ |2| = π
The phase shift is C ÷ B (right if positive). Write Bx − C as B(x − C/B) to see it.
phase shift = π/2 ÷ 2 = π/4
D moves the whole graph up or down; the midline is y = D.
y = 1
The general form
y = A·sin(Bx − C) + D
| Constant | Effect | Formula |
|---|---|---|
| A | Vertical stretch; a negative A flips the graph upside down | amplitude = |A| (sin and cos only) |
| B | Horizontal squeeze; a larger B means more cycles | period = 2π ÷ |B| (π ÷ |B| for tan, cot) |
| C | Horizontal shift | phase shift = C ÷ B, right if positive |
| D | Vertical shift | midline y = D |
The same four constants work for cos, tan, csc, sec and cot. Some books write the shift inside as B(x − h), in which case h is the phase shift directly; enter C = B·h here.
A worked example
The default is y = 2 sin(2x − π/2) + 1, so A = 2, B = 2, C = π/2 and D = 1.
- Amplitude = |2| = 2: the curve rises 2 above and falls 2 below its midline.
- Period = 2π ÷ 2 = π: one full wave every π.
- Phase shift = (π/2) ÷ 2 = π/4 to the right.
- Midline y = 1, so the range is [1 − 2, 1 + 2] = [−1, 3].
- One cycle starts at x = π/4 on the midline, peaks at (π/2, 3), crosses the midline at 3π/4, bottoms out at (π, −1) and returns to the midline at 5π/4.
Those five key points, a quarter period apart, are all you need to sketch any sine or cosine graph by hand. This particular curve is the same as y = 1 − 2cos 2x, which shows that a phase shift can turn a sine into a cosine.
Tangent, cotangent, secant and cosecant
These have no amplitude, and they have vertical asymptotes where their denominator is zero. For y = 2 tan(2x − π/2) + 1 the period is π/2, the asymptotes are at x = (π/2 + π/2 + kπ) ÷ 2, which is every multiple of π/2, and each branch passes through the midline y = 1 halfway between two asymptotes. The secant and cosecant graphs are U-shaped branches that touch the peaks and troughs of the matching cosine and sine curves, so their range leaves out the band between D − |A| and D + |A|.
Graphing your own expression
Pick “Any expression in x” to plot things like sin(x) + sin(2x)/2,
x·sin x or sin²x. The calculator reports the highest and lowest values in
the window, the x-intercepts, and the period when there is one. The default sum
sin x + ½ sin 2x repeats every 2π and reaches a maximum of 1.29904 at x = π/3. For general
functions of x, not just trig ones, use the graphing calculator.
Common mistakes
- Phase shift of C instead of C/B. Factor out B first.
- Sign of the shift. sin(x + π/3) moves left by π/3, not right.
- Amplitude for tan. There is none; say “vertical stretch” instead.
Common questions
How do I find the period of a trig function?
Divide the parent period by |B|. sin and cos (and csc, sec) repeat every 2π, tan and cot every π. So y = 3 sin(4x) has period 2π ÷ 4 = π/2, and y = tan(x/2) has period π ÷ ½ = 2π.
Why is the phase shift C/B and not C?
Because B multiplies x as well. Factor it out: sin(2x − π/2) = sin(2(x − π/4)), so the graph of sin 2x moves π/4 to the right, not π/2. If the equation is written as sin(Bx + C), the shift is −C/B, to the left for positive C.
Does tan x have an amplitude?
No. Amplitude is half the distance from the maximum to the minimum, and tan, cot, sec and csc are unbounded. For them, A is still a vertical stretch: in y = 2 tan x the point at π/4 is at height 2 instead of 1.
Where are the asymptotes of y = tan(Bx − C)?
Where cos(Bx − C) = 0, which is Bx − C = π/2 + kπ, so x = (C + π/2 + kπ) ÷ B. For y = tan x they are at x = ±π/2, ±3π/2 and so on. sec shares tan’s asymptotes; csc and cot have theirs where sin(Bx − C) = 0.
Is x in degrees or radians?
Radians, and the axis is labelled in multiples of π/2 when the window is 8π wide or less. To think in degrees, remember π = 180°: a period of π is a period of 180°.
Related calculators
-
Trig functions calculator
Values of all six functions at a single angle.
-
Trig equation solver
Solve where a trig graph meets a line or another curve.
-
Graphing calculator
Plot any function of x, trig or not.
-
Tangent calculator
tan θ at one angle, with the asymptotes explained.
-
Sine calculator
sin θ on the unit circle, the picture the sine wave comes from.