Skip to content

Tangent Line Calculator

Enter a function and the x-value of a point and get the equation of the tangent line there — and of the normal line perpendicular to it — in point-slope, slope-intercept and standard form, kept exact (fractions, √2, cos 1) wherever the algebra allows. A graph shows the curve with both lines, and a linear-approximation check shows how well the tangent stands in for the function nearby. Free, no sign-up.

Use + − * / ^ and brackets. 2x, x sin x and (x+1)(x−1) multiply. Functions: sin, cos, tan, sec, csc, cot, asin, acos, atan, sinh, cosh, tanh, exp, ln, log (base 10), sqrt, abs. Constants: pi and e.

A number or a constant such as 2, −1.5 or pi/4.

Compares the tangent line's value with the true f(x).

Results

(1, -1)

Point on the curve

1

Slope of the tangent, f′(a)

−1

Slope of the normal, −1/f′(a)

Tangent line

Point-slope form

y+1=x−1

Slope-intercept form

y=x−2

Standard form

x − y = 2

Normal line

Point-slope form

y+1=−(x−1)

Slope-intercept form

y=−x

Standard form

x + y = 0

Linear approximation

Near x = 1, the tangent line L(x) = f(1) + f′(1)(x − 1) is a good estimate of f(x).

-0.9

Tangent value L(x)

-0.869

True value f(x)

0.031

Error f(x) − L(x)

3.57%

Relative error

Graph

  • y = f(x)
  • Tangent line
  • Normal line
Graph of y = f(x), its tangent line and its normal line at x = 1-2-101234-3-2-101xy(1, -1)

How to Use the Tangent Line Calculator

  1. 1. Type the function. Use x as the variable: x^3 - 2x, sin(x), ln(x), e^(2x), sqrt(x). Products can be written without a star, so x sin x and 2x work.
  2. 2. Enter the point. Give the x-value as a number or a constant such as 2, -1.5 or pi/4. The calculator finds f(a) and the slope f′(a) from the symbolic derivative.
  3. 3. Read the lines. The tangent and normal lines are shown in point-slope, slope-intercept and (for rational lines) standard form. When f(a) or the slope has a closed form, the line stays exact; otherwise decimals are added.
  4. 4. Check the approximation. Enter a nearby x to compare the tangent line's value with the true f(x), and read the graph to see where the two part ways.

How the Tangent and Normal Lines Are Built

The tangent line to y = f(x) at x = a is the straight line through the point (a, f(a)) whose slope is the derivative there, m = f′(a). In point-slope form it is y − f(a) = f′(a)(x − a); multiplying out gives y = mx + b with b = f(a) − m·a. The normal line passes through the same point at right angles to the tangent, so its slope is −1/m. If the tangent is horizontal (m = 0) the normal is the vertical line x = a.

FormTangent lineNormal line
Point-slopey − f(a) = f′(a)(x − a)y − f(a) = −(x − a)/f′(a)
Slope-intercepty = f′(a)x + (f(a) − a·f′(a))y = −x/f′(a) + (f(a) + a/f′(a))
StandardAx + By = C with whole numbersAx + By = C with whole numbers

Worked Example: f(x) = x³ − 2x at x = 2

  1. f(2) = 8 − 4 = 4, so the point of tangency is (2, 4).
  2. f′(x) = 3x² − 2, so the slope is f′(2) = 12 − 2 = 10.
  3. Tangent, point-slope: y − 4 = 10(x − 2). Slope-intercept: y = 10x − 16. Standard form: 10x − y = 16.
  4. Normal slope = −1/10, so the normal is y − 4 = −(1/10)(x − 2), or y = −x/10 + 21/5, which is x + 10y = 42 in standard form.

Linear approximation. Near x = 2 the tangent line gives f(x) ≈ 4 + 10(x − 2). At x = 2.1 that is 5, while the true value is f(2.1) = 5.061: an error of 0.061, about 1.2%. Moving farther from x = 2 makes the error grow roughly with the square of the distance, which is why the estimate is only trusted close to the point.

Exact values. For f(x) = sin x at x = π/4 the slope is cos(π/4) = √2/2 ≈ 0.7071, and the tangent line is y = (√2/2)x + √2/2 − π√2/8, which is about y = 0.7071x + 0.1517. Keeping the √2 and π avoids rounding error compounding.

When There Is No Tangent Line

  • f is undefined at the point. There is nothing on the curve to touch, for example ln x at x = −1 or 1/x at 0.
  • A corner. |x| at 0 has slope −1 on the left and +1 on the right, so no single line fits. The calculator reports both one-sided slopes.
  • A vertical tangent. x^(1/3) at 0 climbs without bound; f′ does not exist, though the line x = 0 touches the curve. The same message appears for an endpoint such as √x at 0, where the curve exists on one side only.
  • A cusp. The slope of x^(2/3) at 0 runs off to −∞ from the left and +∞ from the right, so the two branches point the same way and no line fits.

Frequently Asked Questions

How do you find the equation of a tangent line?
Compute f(a) for the y-coordinate and the derivative f′(a) for the slope, then write y − f(a) = f′(a)(x − a). Expand it for slope-intercept form. The steps behind f′(a) are on the Derivative Calculator page.
What is a normal line?
The normal line is perpendicular to the tangent line at the point of tangency. Its slope is the negative reciprocal of the tangent's slope, −1/f′(a), and it is vertical (x = a) when the tangent is horizontal. Normal lines appear in optics and in finding the shortest distance from a point to a curve.
Can a tangent line cross the curve?
Yes. A tangent only has to match the curve's slope at the point of contact. The tangent to y = x³ at the origin is the x-axis, which passes from below the curve to above it, and a tangent can meet the same curve again elsewhere.
What does a horizontal tangent mean?
The derivative is 0 there, so the curve is momentarily flat. That is where local maxima and minima occur, though a flat tangent can also be an inflection, as with y = x³ at 0. The second derivative or the sign of f′ on each side tells them apart.
How is a tangent line different from a secant line?
A secant line passes through two points of the curve and has slope (f(b) − f(a))/(b − a), the average rate of change. The tangent is the limit of those secant lines as the second point slides to the first, which is why its slope is the derivative.
How accurate is the tangent line as an approximation?
Very accurate close to the point and increasingly poor as you move away. The error is roughly f″(a)/2 times the squared distance from the point, so a curve that bends sharply (large f″) needs a smaller step. The linear-approximation panel shows the actual error for any x you enter.

Related Tools

More in Math Calculators

See all Math Calculators