The tangent line to \( y = f(x) \) at \( x = a \) is the straight line that touches the curve at that point with the same slope as the curve. Its equation is
$$y = f(a) + f'(a)\,(x - a)$$
That single formula is all you need. Everything else in this guide is about finding the two ingredients, the point \( f(a) \) and the slope \( f'(a) \), in different situations.
Why the slope is the derivative
Pick a second point on the curve, a little way along at \( x = a + h \). The line through \( (a, f(a)) \) and \( (a + h, f(a + h)) \) is a secant line, with slope
$$\frac{f(a+h) - f(a)}{h}$$
Now slide the second point toward the first by letting \( h \to 0 \). The secant lines pivot and settle into a single limiting line, the tangent line, and their slopes approach the derivative \( f'(a) \). That limit is the definition of the derivative, so the slope of the tangent line is \( f'(a) \) by definition, not by coincidence.
Seeing it with numbers. For \( f(x) = x^2 \) at \( a = 3 \), the secant slope is
$$\frac{(3+h)^2 - 9}{h} = \frac{6h + h^2}{h} = 6 + h$$
As \( h \to 0 \) this approaches 6, so the tangent line at \( (3, 9) \) has slope 6. The power rule gives the same thing instantly: \( f'(x) = 2x \), so \( f'(3) = 6 \).
Three steps
- Point: compute \( y_0 = f(a) \), giving \( (a, y_0) \).
- Slope: compute \( m = f'(a) \).
- Line: plug into point-slope form, \( y - y_0 = m(x - a) \), and simplify if asked.
The formula at the top is just step 3 with \( y_0 \) moved to the right side. Point-slope form is usually the safest to write first; convert to slope-intercept form \( y = mx + b \) only if the question asks for it.
Example 1: a cubic
Find the tangent to \( f(x) = x^3 - 3x \) at \( x = 2 \).
- Point: \( f(2) = 8 - 6 = 2 \), so \( (2, 2) \).
- Slope: \( f'(x) = 3x^2 - 3 \), so \( m = f'(2) = 9 \).
- Line: \( y - 2 = 9(x - 2) \), i.e. \( y = 9x - 16 \).
Example 2: trig
\( f(x) = \sin x \) at \( x = 0 \): point \( (0, 0) \), slope \( \cos 0 = 1 \). Tangent line: \( y = x \). This is why \( \sin x \approx x \) for small angles.
Example 3: exponential
\( f(x) = e^x \) at \( x = 0 \): point \( (0,1) \), slope \( e^0 = 1 \), tangent \( y = x + 1 \).
Example 4: logarithm
\( f(x) = \ln x \) at \( x = 1 \): point \( (1, 0) \), slope \( \frac11 = 1 \), tangent \( y = x - 1 \).
Example 5: using the chain rule
Find the tangent to \( y = (2x + 1)^3 \) at \( x = 0 \). The point is \( (0, 1) \). By the chain rule, \( y' = 3(2x+1)^2\cdot2 = 6(2x+1)^2 \), so the slope at 0 is 6. The tangent line is \( y = 6x + 1 \). Forgetting the inner factor of 2 is the usual error here; it would give a slope of 3 and the wrong line.
Example 6: using the product rule
Find the tangent to \( y = xe^x \) at \( x = 1 \). First the point: \( y(1) = 1\cdot e = e \), so the tangent passes through \( (1, e) \). For the slope, the product rule gives \( y' = e^x + xe^x \), and at \( x = 1 \) that is \( e + e = 2e \). Point-slope form gives \( y - e = 2e(x - 1) \), which simplifies to \( y = 2ex - e \).
Notice that the answer contains \( e \) as an exact constant. Unless the question asks for decimals, leave values like \( e \), \( \pi \) and \( \sqrt2 \) exact, and round only at the very end if you must.
The normal line
The normal line is perpendicular to the tangent at the same point. Its slope is the negative reciprocal, \( -\frac{1}{m} \):
$$y - y_0 = -\frac{1}{f'(a)}(x - a)$$
For Example 1: \( y - 2 = -\frac19(x - 2) \), i.e. \( y = -\frac19x + \frac{20}{9} \).
Special cases: if \( f'(a) = 0 \), the tangent is horizontal (\( y = y_0 \)) and the normal is vertical (\( x = a \)).
Horizontal tangent lines
“Where is the tangent horizontal?” means “solve \( f'(x) = 0 \)”. For \( x^3 - 3x \), \( 3x^2 - 3 = 0 \) gives \( x = \pm1 \). Those are the critical points.
Tangent lines parallel to a given line
Parallel lines have equal slopes, so “find the tangent to \( y = x^3 \) parallel to \( y = 12x + 1 \)” means “solve \( f'(x) = 12 \)”. Here \( 3x^2 = 12 \) gives \( x = \pm2 \), with points \( (2, 8) \) and \( (-2, -8) \). There are two tangent lines:
$$y = 12x - 16 \qquad\text{and}\qquad y = 12x + 16$$
For a tangent perpendicular to a given line, set \( f'(x) \) equal to the negative reciprocal of that line’s slope instead.
Tangent lines through a point not on the curve
This is a favorite exam question. Find the tangent lines to \( y = x^2 \) that pass through \( (1, -3) \), a point below the parabola. You do not know the point of tangency, so call it \( (a, a^2) \). The slope there is \( 2a \), and the tangent line is \( y = a^2 + 2a(x - a) \). For it to pass through \( (1, -3) \),
$$\begin{aligned} -3 &= a^2 + 2a(1 - a) \\ -3 &= -a^2 + 2a \\ 0 &= a^2 - 2a - 3 = (a - 3)(a + 1) \end{aligned}$$
So \( a = 3 \) or \( a = -1 \). The tangent at \( (3, 9) \) is \( y = 6x - 9 \), and the tangent at \( (-1, 1) \) is \( y = -2x - 1 \). Both pass through \( (1, -3) \), as you can check by plugging in \( x = 1 \).
Tangent lines for implicit curves
For curves like \( x^2 + y^2 = 25 \), find the slope with implicit differentiation, then use the same point-slope formula.
For example, at \( (3, 4) \), differentiating gives \( 2x + 2y\,y' = 0 \), so \( y' = -\frac{x}{y} = -\frac34 \). The tangent line is \( y - 4 = -\frac34(x - 3) \), or \( y = -\frac34x + \frac{25}{4} \). Geometrically, it is perpendicular to the radius from the origin to \( (3, 4) \), which has slope \( \frac43 \), exactly as you would expect for a circle.
Why tangent lines are useful
Near \( x = a \), the tangent line is an excellent approximation of the curve. That’s linear approximation: for example \( \sqrt{4.1} \approx 2.025 \) using the tangent to \( \sqrt x \) at 4. It is also the engine behind Newton’s method.
In physics, the slope of the tangent line to a position graph is instantaneous velocity. In economics, the tangent to a cost curve gives marginal cost. Whenever you need “the rate right now” rather than an average over an interval, you are asking for a tangent slope.
Common mistakes
- Leaving \( x \) in the slope. The slope is the number \( f'(a) \), not the function \( f'(x) \). Writing \( y - 2 = (3x^2 - 3)(x - 2) \) gives a curve, not a line.
- Plugging \( a \) into the wrong function. The \( y \)-coordinate is \( f(a) \), not \( f'(a) \).
- Getting the normal slope wrong. It is \( -\frac1m \), not \( \frac1m \) or \( -m \).
- Using degrees with trig functions. Derivative formulas like \( (\sin x)' = \cos x \) assume radians.
- Sign errors when simplifying. In \( y - y_0 = m(x - a) \), distribute \( m \) over both terms and watch negative values of \( a \).
Tangent and normal line calculator
Tangent & Normal Line Generator
Slope \(m = f'(x_0)\) plus the equations of the tangent and normal lines.
You can also slide a tangent line along any curve in the 2D visual lab, or use the dedicated tangent line calculator page.
Practice problems
Try these before checking the answers.
- \( y = x^2 + 3x \text{ at } x = 1 \)
- \( y = \sqrt{x} \text{ at } x = 9 \)
- \( y = \cos x \text{ at } x = \frac\pi2 \)
- \( y = \frac1x \text{ at } x = 2 \)
- \( y = e^{2x} \text{ at } x = 0 \)
- The normal line to \( y = x^2 \) at \( (1, 1) \)
Answers: (1) \( y = 5x - 1 \); (2) \( y = \frac{x}{6} + \frac32 \); (3) \( y = -x + \frac\pi2 \); (4) \( y = -\frac{x}{4} + 1 \); (5) \( y = 2x + 1 \); (6) \( y = -\frac{x}{2} + \frac32 \).
For (4), the point is \( \left(2, \frac12\right) \) and the slope is \( -\frac{1}{x^2} \) at 2, which is \( -\frac14 \). For (6), the tangent slope is 2, so the normal slope is \( -\frac12 \).
FAQ
What’s the difference between a tangent line and a secant line?
A secant line passes through two points of the curve; its slope is an average rate of change. The tangent line is the limit of secant lines as the two points merge. Its slope is the derivative.
Can a tangent line cross the curve?
Yes, at inflection points, for example \( y = x^3 \) at the origin, where the tangent is \( y = 0 \).
Can a tangent line be vertical?
Yes. \( y = x^{1/3} \) has a vertical tangent at the origin, where the derivative grows without bound. A vertical tangent has no slope, so write it as \( x = a \), here \( x = 0 \).
Is the tangent line the same as the derivative?
No. The derivative \( f'(x) \) is a function that gives the slope at every point. The tangent line is one specific line at one point, and it uses a single value of the derivative, \( f'(a) \).
How do I convert the tangent line to slope-intercept form?
Start from point-slope form, distribute the slope, and move the constant to the right side. In Example 1, \( y - 2 = 9(x - 2) \) becomes \( y - 2 = 9x - 18 \), and adding 2 to both sides gives \( y = 9x - 16 \). The slope stays the same; only the constant term changes. Both forms describe the same line, so either is correct unless the question specifies one.
Further reading
- Tangent Lines and Rates of Change (Paul’s Online Math Notes) — how secant slopes approach the tangent slope, worked numerically.
- Interpretation of the Derivative (Paul’s Online Math Notes) — the derivative as a tangent slope, a rate of change and a velocity.
Calculators for this topic
Keep learning
Optimization Problems in Calculus: 4 Solved Examples
Solve calculus optimization problems in 6 steps. Worked examples: the largest fenced area, the open box, the cheapest can and the closest point on a curve.
Related Rates: Step-by-Step Strategy and Classic Problems
Solve related rates problems in 6 steps. Worked classics: the sliding ladder, the expanding balloon, the draining cone and the moving shadow.

