How to Graph Tangent Functions

Learn how to graph tangent functions step by step. Covers the period π, vertical asymptotes, undefined points, transformations, and the shape of y = tan(x).

What Is the Tangent Function?

The tangent function is defined as tan(x) = sin(x)/cos(x). Because it is a ratio, it is undefined wherever cos(x) = 0, which occurs at x = π/2 + nπ for every integer n. The graph of y = tan(x) consists of infinitely many identical S-shaped branches separated by vertical asymptotes at each of those undefined points. Unlike sine and cosine, which are bounded between -1 and 1, the tangent function is unbounded: it ranges from negative infinity to positive infinity within each branch. This makes the tangent graph look fundamentally different from the smooth sinusoidal waves of sine and cosine.

Period and Asymptotes

The fundamental period of y = tan(x) is π, not 2π. This means the pattern repeats every π units, half as often as sine or cosine. Each branch of the tangent graph is bounded by two consecutive vertical asymptotes spaced π apart. The asymptotes for y = tan(x) are at x = π/2 + nπ: at x = ±π/2, ±3π/2, ±5π/2, and so on. Between any two consecutive asymptotes, the tangent function increases from negative infinity to positive infinity, passing through zero exactly midway between them. Always draw the asymptotes first as dashed vertical lines, then sketch the S-shaped branch between each pair.

Key Points in One Period

To graph one period of y = tan(x), focus on the interval (-π/2, π/2). The five key values to plot are: x = -π/4 gives y = -1; x = 0 gives y = 0; x = π/4 gives y = 1. The curve approaches negative infinity as x approaches -π/2 from the right and positive infinity as x approaches π/2 from the left. Three plotted points (-π/4, -1), (0, 0), (π/4, 1) combined with the asymptote lines fully define the shape of one tangent branch. Plot this pattern and repeat it by shifting π units left and right to fill the graph.

General Form: y = A tan(Bx - C) + D

The general tangent function y = A tan(Bx - C) + D transforms the parent curve in four ways. The coefficient A stretches the graph vertically, making the S-shape steeper. Unlike sine and cosine, A is not called an "amplitude" for tangent because the function is unbounded. The period changes to π/|B|. The phase shift is C/B to the right, moving the central zero-crossing and all asymptotes. The vertical shift D moves the central zero-crossing (and the entire graph) up or down by D units. The asymptotes shift accordingly to x = C/B ± π/(2|B|) + nπ/|B| for each integer n.

Graphing Transformed Tangent Functions

To graph y = A tan(Bx - C) + D: first determine the period P = π/|B| and phase shift S = C/B. The central zero-crossing of each branch is at x = S + nP for integer n, with y = D. The asymptotes are at x = S ± P/2 + nP. The point at one-quarter period from center has y = D + A, and one-quarter period in the other direction has y = D - A. For example, y = 2 tan(2x) has period π/2, asymptotes at x = π/4 + nπ/2, and passes through (0, 0) with the value 2 at x = π/8 and -2 at x = -π/8. Scale accordingly and draw the smooth S-branches between each pair of asymptotes.

Cotangent and Comparison

The cotangent function cot(x) = cos(x)/sin(x) is the reciprocal of tangent. Its graph also has vertical asymptotes and the same period π, but the asymptotes occur where sin(x) = 0 (at x = nπ) rather than where cos(x) = 0. Between each pair of asymptotes, the cotangent decreases from positive infinity to negative infinity, opposite in direction to tangent. The cotangent has a zero crossing at the midpoint between each pair of its asymptotes. When graphed side by side, the tangent and cotangent curves are reflections of each other across vertical lines at the asymptote positions of tangent.

Applications and Common Errors

The tangent function appears in trigonometry when calculating slopes of lines at given angles (the slope of a line is the tangent of its angle with the x-axis), in physics for calculating components of forces and velocities, and in navigation and surveying for determining heights and distances. A frequent error when graphing is assuming the period is 2π (like sine and cosine); remember that for tangent, the period is π. Another mistake is omitting the vertical asymptotes or drawing the curve as if it crosses them. The curve must approach but never touch the asymptote lines, shooting off to infinity on each side.

Try These Calculators

Put what you learned into practice with these free calculators.

Try It Yourself

Put what you learned into practice with our free graphing calculator.

Related Graphs