Tangent Function tan(x): Graph, Asymptotes, Derivative and Integral
The tangent function tan(x) = sin(x)/cos(x): its graph, vertical asymptotes, period π, derivative sec²(x), integral ln|sec x| + C and examples.
Trigonometric functions Updated 3 min read
At a glance
- Domain
- x \ne \frac{\pi}{2} + k\pi
- Range
- (-\infty, \infty)
- Derivative
- \sec^2 x
- Integral
- \ln\lvert\sec x\rvert + C
- Period
- \pi
- Asymptotes
- x = \frac{\pi}{2} + k\pi, k an integer
On this page
The tangent function is the ratio \tan x = \frac{\sin x}{\cos x}. Geometrically, it is the slope of the line from the origin to the point at angle x on the unit circle. Unlike sine and cosine, it is unbounded and has a vertical asymptote every time cosine hits zero.
Definition of tan x
In a right triangle this is \frac{\text{opposite}}{\text{adjacent}}. Because the line through the origin at angle x has slope \tan x, tangent is how you convert an angle into a slope, and arctangent converts a slope back into an angle.
Graph of y = tan x
Key values of tangent
| x | -\frac{\pi}{3} | -\frac{\pi}{4} | 0 | \frac{\pi}{6} | \frac{\pi}{4} | \frac{\pi}{3} | \frac{\pi}{2} |
|---|---|---|---|---|---|---|---|
| \tan x | -\sqrt{3} | -1 | 0 | \frac{\sqrt{3}}{3} | 1 | \sqrt{3} | undefined |
Properties of the tangent function
- Domain. All real numbers except x = \frac{\pi}{2} + k\pi.
- Range. All real numbers.
- Period. \tan(x + \pi) = \tan x, so the period is \pi, not 2\pi.
- Zeros. \tan x = 0 at x = k\pi, the same zeros as sine.
- Odd symmetry. \tan(-x) = -\tan x.
- Always increasing. On each branch the slope \sec^2 x is at least 1, so the graph never levels off.
- One-sided limits. \lim_{x \to \pi/2^-}\tan x = \infty and \lim_{x \to \pi/2^+}\tan x = -\infty. See limits at infinity for more on asymptotes.
- Identity. 1 + \tan^2 x = \sec^2 x, found by dividing \sin^2 x + \cos^2 x = 1 by \cos^2 x.
Derivative of tan x
Apply the quotient rule to \frac{\sin x}{\cos x}:
At x = 0 the slope is \sec^2 0 = 1, which matches the graph crossing the origin at a 45 degree angle.
Integral of tan x
Write \tan x = \frac{\sin x}{\cos x} and let u = \cos x, so du = -\sin x\,dx:
The two forms are equal because -\ln|\cos x| = \ln\frac{1}{|\cos x|}.
Worked examples
Example 1: chain rule. \frac{d}{dx}\tan(3x) = 3\sec^2(3x).
Example 2: a power of tangent. \frac{d}{dx}\tan^2 x = 2\tan x\sec^2 x.
Example 3: an integral using the identity. Since \tan^2 x = \sec^2 x - 1,
Example 4: a definite integral. \int_0^{\pi/4}\sec^2 x\,dx = \tan\frac{\pi}{4} - \tan 0 = 1.
Common mistakes
- Thinking the period is 2\pi. Tangent repeats every \pi, because \sin and \cos both change sign after a half turn and the signs cancel.
- Writing \int\tan x\,dx = \sec^2 x. That is backward: \sec^2 x is the derivative. The integral needs a logarithm.
- Dropping the absolute value. \ln|\cos x| needs the bars because \cos x is negative on parts of the domain.
- Ignoring the asymptotes. You cannot integrate \tan x across x = \frac{\pi}{2} with the Fundamental Theorem; that would be an improper integral, and it diverges.
How tangent connects to other topics
Tangent pairs with secant in derivatives and integrals, so its siblings on reciprocal trig functions are worth learning together. Its inverse, arctangent, is the antiderivative of \frac{1}{1+x^2}, and the substitution x = \tan\theta is a workhorse of trig substitution. For all six trig derivatives in one place, read derivatives of trig functions.
Practice it now
Sine, cosine and tangent
Solve real problems on this topic with instant feedback, hints and a step-by-step walkthrough for every answer. Free, no sign-up needed to start.
Practice this lesson