Calculus

Tangent Line Calculator

The tangent line touches a curve at a single point and has the same slope as the curve there. This calculator evaluates f(a) for the point of tangency, estimates the slope f'(a) numerically, and assembles the tangent line in point-slope and slope-intercept forms.

Tangent Line Calculator

Equation of the tangent line to a curve at a point.

Try:
Answery = 4x − 4
  1. Functionf(x) = x^2
  2. Point of tangency(2, 4)
  3. Slopef'(2) ≈ 4
  4. Point-slope formy − 4 = 4(x − 2)
  5. Slope-intercept formy = 4x − 4

Two ingredients, assembled

A tangent line is the straight line that best matches a curve at one point — same position, same direction. Zoom far enough into a smooth curve and it becomes indistinguishable from its tangent, which is the geometric content of differentiation and the reason derivatives are useful at all.

This calculator builds that line. It evaluates the function to fix the point, estimates the slope there, and assembles the equation in both standard forms.

A line needs a point and a slope, and the two come from different operations. The point is the function evaluated at the given input; the slope is its derivative there. Neither is interesting alone — it is the pair that determines the line.

Reporting the point of tangency separately matters because it is the half that is easy to forget. A line with the right gradient through the wrong point is parallel to the tangent rather than equal to it, and nothing about the slope reveals the error.

How to use this calculator

  1. Type the function in terms of x Standard notation with ^ for powers and named functions written with brackets. Multiplication must be explicit.
  2. Enter the point Any finite number where the function is defined. The function is evaluated there before anything else happens.
  3. Check the point of tangency It is reported before the slope. If the function has no value there, the calculation stops with an explanation rather than producing a line.
  4. Take whichever form you need Point-slope shows the construction; slope-intercept is ready to plot. Both describe the same line.

The formula, and where it comes from

y − f(a) = f′(a)·(x − a) y = f′(a)·x + [f(a) − f′(a)·a]

Point-slope form is the direct expression of what a tangent is: start at the point where the curve is touched, and move away from it at the curve's own rate of change. Every symbol in it corresponds to one of the two ingredients.

Expanding the bracket and collecting gives slope-intercept form, where the intercept is whatever constant makes the line pass through the point of tangency. It is derived rather than measured, and it frequently lies far from the point itself.

The slope is the derivative at the point, estimated numerically rather than found symbolically. The function is sampled just above and just below the point and the rise divided by the run, with the step scaled to the size of the point so that precision holds for very large and very small inputs alike.

That numerical route is why the line is an extremely close approximation rather than an exact object. For a smooth function the slope is accurate to several significant figures, which is far beyond what any plot could distinguish.

What each input means

f(x) Function — form field “Function f(x)”
The curve to touch. It is compiled once and then evaluated at the point and at two nearby points for the slope.
a Point — form field “Point a”
Where the tangent touches. The function must be defined here and in a small neighbourhood either side.
f(a), f′(a) Point of tangency and slope
The height of the curve at the point and its rate of change there. Together they determine the line.

Worked examples

Every number below is produced by the same calculation engine the tool above runs. Nothing here is typed by hand, so the walkthrough cannot drift from what you get when you enter the same values yourself.

A parabola

The tangent to a squared function at 2. Both the height and the gradient come out as whole numbers.

Inputs Function f(x) = x^2, Point a = 2

  1. Function f(x) = x^2
  2. Point of tangency (2, 4)
  3. Slope f'(2) ≈ 4
  4. Point-slope form y − 4 = 4(x − 2)
  5. Slope-intercept form y = 4x − 4

Result y = 4x − 4

The curve is at height 4 and rising at a rate of 4, so the tangent has slope 4 and passes through that point. Its intercept comes out negative, well below the point of tangency — a consequence of the slope, not an error.

The tangent touches the parabola at exactly one place and lies below it everywhere else. That one-sided contact is typical of a curve bending consistently in one direction.

A sine curve at the origin

The tangent to sine at zero, where the curve is steepest and passes through the origin.

Inputs Function f(x) = sin(x), Point a = 0

  1. Function f(x) = sin(x)
  2. Point of tangency (0, 0)
  3. Slope f'(0) ≈ 1
  4. Point-slope form y − 0 = 1(x − 0)
  5. Slope-intercept form y = x

Result y = x

The slope comes out as 1 and the point is the origin, so the tangent is the line y = x. That is the geometric statement behind the small-angle approximation: near zero, sine and its argument are nearly the same.

Here the curve crosses the tangent rather than staying on one side of it, because the curvature changes sign at this point. Touching does not mean staying on one side.

A cubic between its turning points

The tangent to a cubic at 1, on the descending stretch between its maximum and minimum.

Inputs Function f(x) = x^3 - 3*x, Point a = 1

  1. Function f(x) = x^3 - 3*x
  2. Point of tangency (1, -2)
  3. Slope f'(1) ≈ 0
  4. Point-slope form y − -2 = 0(x − 1)
  5. Slope-intercept form y = -2

Result y = -2

The slope is zero here, so the tangent is horizontal. That identifies the point as a turning point — the minimum of this cubic — without any second-derivative test.

A horizontal tangent is the defining feature of a stationary point, which is why setting the derivative to zero is how such points are found in the first place.

Reading the result

Touching is local, not global

The tangent matches the curve at one point and generally departs from it immediately either side. It may also cross the curve elsewhere, which does not stop it being the tangent at the point in question.

A horizontal tangent marks a turning point

A slope of zero means the curve is momentarily neither rising nor falling. That is the condition defining maxima, minima and points of inflection with a flat spot.

The intercept can be far from the point

It is where the tangent meets the vertical axis, which may be a long way from where it touches the curve. A steep tangent at a distant point produces a large intercept as a matter of course.

When you would use this

Approximating a function near a point

The tangent is the best linear approximation to the curve nearby, which is what linearisation means. Substituting a value close to the point into the line estimates the function there without evaluating it.

Locating stationary points

Trying values and watching for the slope to pass through zero brackets a maximum or a minimum, which is useful when solving the derivative algebraically is awkward.

Assumptions and limitations

What this calculator assumes

  • The function is defined at the point and in a small neighbourhood either side.
  • It is differentiable there; the calculation returns a value regardless, so smoothness is the caller's responsibility.
  • The slope is estimated numerically rather than derived symbolically.
  • The tangent is taken with respect to x, so vertical tangents cannot be represented.

Where it stops being the right tool

  • The slope is an estimate, so the line is very close to the true tangent rather than exact.
  • A vertical tangent has no slope and cannot be produced in either standard form.
  • One point at a time, and no normal line is reported alongside the tangent.
  • Nothing flags a corner or a cusp, where a plausible line is still returned despite no tangent existing.

Common mistakes

Using the point's x-value as the y-value

Why it happens. The point is entered as a single number, so it can read as a coordinate pair rather than as an input to the function. The height has to be computed, not assumed.

How to avoid it. Read the point-of-tangency line. It gives both coordinates, and the second is rarely equal to the first.

Confusing the tangent with a secant

Why it happens. Both are straight lines meeting a curve, and a secant through two nearby points looks almost identical to the tangent.

How to avoid it. A tangent touches at one point with the curve's own slope; a secant cuts through two. The limit of secants as the points converge is the tangent.

Asking for a tangent where the function is undefined

Why it happens. The expression parses and the point is a valid number, so nothing about the input looks wrong.

How to avoid it. Check the point of tangency first. If the function has no value there, the calculation stops and says so rather than returning a line.

Key terms

Frequently asked questions

How is the slope of the tangent found?

Numerically, from a central-difference estimate: the function is sampled slightly above and below the point and the rise divided by the run. The step is scaled to the size of the point, so accuracy holds across very different magnitudes.

What forms of the line are returned?

Both point-slope, which shows how the line is built from the point and the gradient, and slope-intercept, which is ready to plot. Expanding the bracket in the first gives the second.

What if the function is undefined at the point?

The calculation stops and reports that no tangent line exists there. Without a height at the point there is nothing for the line to pass through, so the slope alone would not determine it.

Can the tangent cross the curve?

Yes. Tangency is a local condition about matching direction at one point, not a promise about the rest of the curve. At a point where the curvature changes sign, the tangent passes through rather than resting against.