Tangent Line Calculator

  • Free
  • No sign-up
  • Works on phones
  • Shows the working
Differential#4

Tangent & Normal Line Generator

Slope \(m = f'(x_0)\) plus the equations of the tangent and normal lines.

This tangent line calculator gives you the equation of the line that touches \( y = f(x) \) at a chosen point, along with its slope and the equation of the normal line (the perpendicular line through the same point). Both lines come out in slope-intercept form, \( y = mx + b \), ready to copy into your answer.

It is useful for homework checks, graph sketching and linear approximation problems. It’s free and needs no sign-up.

How to use the tangent line calculator

  1. Type the function in the \( f(x) \) box. Use ^ for powers, sqrt(x), sin(x), cos(x), ln(x), e^(x) and pi. Implicit multiplication works: 2x^2 and x ln(x) are fine.
  2. Enter the x-coordinate of the point of tangency in \( x_0 \). Expressions such as pi/3 or e are accepted.
  3. Press Compute lines. The output lists the point \( (x_0, f(x_0)) \), the slope \( m \), the tangent line and the normal line.

Formula

The tangent line at \( x = a \) passes through \( (a, f(a)) \) with slope \( f'(a) \):

$$y = f(a) + f'(a)(x - a)$$

The normal line passes through the same point with the negative reciprocal slope:

$$y = f(a) - \frac{1}{f'(a)}(x - a)$$

The calculator differentiates \( f \) symbolically, evaluates \( f(a) \) and \( f'(a) \), then expands both lines into \( y = mx + b \) form. When a number has a recognizable exact form (a fraction, \( \sqrt3 \), a multiple of \( \pi \)), it is shown that way.

Worked example

Example 1. Find the tangent and normal lines to \( f(x) = x^3 - 2x^2 + 1 \) at \( x = 2 \).

  • Point: \( f(2) = 8 - 8 + 1 = 1 \), so the point is \( (2, 1) \).
  • Slope: \( f'(x) = 3x^2 - 4x \), so \( m = f'(2) = 12 - 8 = 4 \).
  • Tangent: \( y = 1 + 4(x - 2) \), which simplifies to \( y = 4x - 7 \).
  • Normal: slope \( -\frac14 \), so \( y = 1 - \frac14(x - 2) \), or \( y = -\frac14x + \frac32 \).

These are the lines the calculator above shows for its default input.

Example 2. Find the tangent to \( f(x) = \ln x \) at \( x = e \). The point is \( (e, 1) \) and the slope is \( \frac1e \), so

$$y = 1 + \frac1e(x - e) = \frac{x}{e}$$

The tangent passes through the origin. The normal has slope \( -e \):

$$y = -ex + e^2 + 1$$

Type ln(x) with \( x_0 \) = e to check both.

Reading the output: special cases

  • Horizontal tangent. When the slope is 0, the tangent is \( y = f(a) \) and the normal is vertical, so the calculator writes it as \( x = a \). Try cos(x) at 0: the tangent is \( y = 1 \) and the normal is \( x = 0 \).
  • No tangent line. If \( f \) or \( f' \) is undefined at your point, for example ln(x) at 0 or sqrt(x) at 0, the calculator reports that \( f \) is not differentiable there instead of giving a line.
  • Decimals. Irrational slopes that aren’t a recognizable closed form are shown as decimals rounded to about 8 significant figures.
  • Implicit curves. The calculator needs \( y \) as a function of \( x \). For a circle or other implicit curve, find the slope with implicit differentiation first, then use the point-slope form.

The tangent line is also the best linear estimate of the function near the point. The linear approximation guide shows how to use it for quick numerical estimates (the linear approximation calculator does the arithmetic), and the full hand method, with more examples, is in how to find the equation of a tangent line.

Related guides

Further reading

FAQ

How do you find the equation of a tangent line?

Find the point \( (a, f(a)) \), compute the slope \( f'(a) \), and substitute both into \( y - f(a) = f'(a)(x - a) \). The calculator does all three steps and simplifies the result.

What is the normal line?

The normal line is perpendicular to the tangent at the point of tangency. Its slope is \( -\frac{1}{f'(a)} \), and it is vertical when the tangent is horizontal.

Can the tangent line calculator find where the tangent is horizontal?

Not directly; it works at a point you choose. To find horizontal tangents, solve \( f'(x) = 0 \), which is what the critical points calculator does.

Is the tangent line calculator free?

Yes. It’s free to use as often as you like, with no account required.

Embed this calculator on your website

Teachers, tutors and bloggers are welcome to use this calculator for free. Copy the code below and paste it into any page (in WordPress, use a "Custom HTML" block). The small script makes the calculator grow to fit its answer; if your site removes scripts, it still works at a fixed height. Please keep the credit link.

More calculators

See all calculators