Calculus, Linear Algebra & Discrete Math Derivatives & Differentiation Point-slope form of the tangent line, y = f(a) + f′(a)(x − a)

Tangent Line & Normal Line Calculator

Pick a curve and a point on it, and this calculator returns the tangent line, the normal line perpendicular to it, and the linear approximation of the function near that point. It differentiates your expression symbolically to get the slope, converts the point-slope form into slope-intercept form, and then measures how far the straight-line estimate drifts from the true curve as you move away. The table beside the result shows that drift explicitly, which is the honest way to judge whether a linearisation is good enough for the job.

Calculator

This calculator runs in your browser. Enable JavaScript for live results — the inputs, formula and worked example below remain fully readable without it.

Inputs this calculator takes, with typical values
InputWhat to enterExample
Function f(x)Use ^ for powers, * for multiplication (2*x, 2x and a plain space all work, so x sin(x) is read as a product), and the function names sin, cos, tan, sec, csc, cot, asin, acos, atan, sinh, cosh, tanh, exp, ln, log (base 10), sqrt, cbrt and abs. The constants pi and e are recognised.sqrt(x)
Point of tangency aThe x coordinate where the line touches the curve.4
Approximate f at x =A nearby point where you want the linear approximation and its error.4.1

It returns

  • Slope of the tangent — The derivative evaluated at the point of tangency.
  • Tangent line
  • Normal line
  • f at the point of tangency
  • Linear approximation at your x
  • Approximation error — How far the straight-line estimate sits from the true value of f.

The formula

y=f(a)+f(a)(xa)
y=f(a)1f(a)(xa)

In plain text: y = f(a) + f′(a)·(x − a)

  • ax coordinate of the point of tangency (units of x)
  • f(a)Height of the curve at that point (units of f)
  • f′(a)Slope of the curve there, and of the tangent line (units of f per unit of x)
  • yHeight of the tangent line at any x (units of f)

The same expression written as L(x) is the linearisation of f at a — the first-order Taylor polynomial about that point.

Updated Category Derivatives & Differentiation Verified against published test cases Reading time 10 min

What a tangent line is, and what it is for

The tangent line at a point is the straight line that touches the curve there and matches its slope. It is the best straight-line description of the function near that point, and it is the object the derivative was invented to produce.

Two facts determine any line: a point it passes through and its slope. For the tangent, the point is (a, f(a)) and the slope is f′(a). Substituting those into the point-slope form y − y₁ = m(x − x₁) gives y = f(a) + f′(a)(x − a), which is the whole formula. Everything else on this page is bookkeeping around that one line.

The practical use is approximation. Rearranged as L(x) = f(a) + f′(a)(x − a), the tangent becomes a cheap stand-in for a function you cannot evaluate easily. Engineers linearise a nonlinear model around an operating point precisely this way, and the resulting linear system is what control theory analyses. Physicists linearise the pendulum equation by replacing sin θ with θ, which is the tangent line to sine at the origin.

The normal line is the perpendicular through the same point. Its slope is −1/f′(a), because perpendicular slopes multiply to −1. Normals matter in optics for reflection angles, in geometry for distance-to-curve problems, and in graphics for surface shading.

Reading the formula term by term

f(a) anchors the line at the right height. Without it the line would pass through the origin instead of touching the curve.

f′(a) sets the direction. It comes from differentiating your expression symbolically and then substituting a — the same operation the derivative calculator performs. If the derivative fails to exist at a, no tangent line of finite slope exists there, and the calculator says so rather than printing a number.

(x − a) measures displacement from the point of tangency. Note that the whole correction term vanishes when x = a, which is why the tangent and the curve agree exactly at that one point and only approximately elsewhere.

The calculator converts the point-slope form into slope-intercept form for display, computing b = f(a) − m·a. Both forms describe the same line; point-slope is easier to derive and slope-intercept is easier to compare with other lines.

Two special cases matter. When f′(a) = 0, the tangent is horizontal, the normal is vertical, and no slope-intercept form exists for the normal — the calculator writes it as x = a. When f′(a) is infinite, as at cbrt(x) at the origin, the tangent itself is vertical and the roles reverse.

Worked example: the tangent to √x at x = 4, and using it to estimate √4.1

Take f(x) = √x and a = 4, the default setup.

  1. Height at the point. f(4) = √4 = 2, so the point of tangency is (4, 2).
  2. Derivative. Write √x = x^0.5 and apply the power rule: f′(x) = 0.5·x^(−0.5) = 1/(2√x).
  3. Slope at the point. f′(4) = 1/(2·2) = 0.25.
  4. Point-slope form. y = 2 + 0.25(x − 4).
  5. Slope-intercept form. Expand: y = 2 + 0.25x − 1 = 0.25x + 1.
  6. Normal line. Slope −1/0.25 = −4, so y = 2 − 4(x − 4) = −4x + 18.
  7. Estimate √4.1. L(4.1) = 2 + 0.25(0.1) = 2.025.

The true value is √4.1 = 2.0248456731, so the linear approximation is high by 0.0001543269 — about seven thousandths of one percent. That is the whole appeal of linearisation: two multiplications replace a square root and cost four correct decimal places.

Watch what happens as you move further out. At x = 5 the tangent predicts 2.25 while the true value is 2.2360680, an error of 0.0139320. The distance from the point of tangency grew by a factor of ten and the error grew by a factor of about ninety — close to the factor of one hundred that the squared-distance rule predicts. The remaining discrepancy is because that rule is itself an approximation, exact only in the limit as the step goes to zero.

How far the tangent line can be trusted

The error grows roughly with the square of the distance. Taylor's theorem gives the exact statement: f(x) − L(x) = f″(ξ)(x − a)²/2 for some point ξ between a and x. So the error depends on two things — how far you have moved, squared, and how sharply the function curves in between.

Flat functions linearise beautifully; curved ones do not. For √x near 4, f″ = −1/(4x^1.5) = −0.03125, which is small, and the approximation holds to four decimals across a whole unit. For e^x near 0, f″ = 1, and the same half-unit step produces an error of 0.149 — a thousand times worse, which is the fifth test vector on this page. The second derivative calculator gives you the number that predicts this.

The error column in the table is the honest check. Rather than trusting a rule of thumb, read the table: it evaluates both the curve and its tangent at nine points spanning your range and reports the gap at each. If the gap at the far end is bigger than your tolerance, the linearisation is not good enough and you need a quadratic or higher term from a Taylor polynomial.

The tangent can cross the curve. At an inflection point it does exactly that, sitting above the curve on one side and below it on the other. Everywhere else the sign of f″ tells you which side the line is on: above a concave-down curve, below a concave-up one.

Tangent lines to common functions at convenient points

Each row is the tangent at the stated point, followed by the standard approximation it produces. Every value here is reproducible with this calculator.
f(x)af(a)f′(a)Tangent lineFamiliar form
sqrt(x)420.25y = 0.25x + 1√(4+h) ≈ 2 + h/4
sin x001y = xsin x ≈ x
cos x010y = 1cos x ≈ 1
e^x011y = x + 1e^x ≈ 1 + x
ln x101y = x − 1ln(1+h) ≈ h
1/x11−1y = −x + 21/(1+h) ≈ 1 − h
x^2396y = 6x − 9(3+h)² ≈ 9 + 6h
tan x001y = xtan x ≈ x

The small-angle approximations sin x ≈ x and tan x ≈ x are tangent lines at the origin, which is why they are stated in radians and fail in degrees.

Mistakes that produce the wrong line

  • Using f(a) where f′(a) belongs. The height sets the intercept and the derivative sets the slope. Swapping them produces a line that neither touches the curve nor matches its direction.
  • Forgetting to evaluate the derivative at a. f′(x) is a function; the tangent needs the single number f′(a). Leaving x in the slope gives a curve, not a line.
  • Writing the normal slope as −f′(a). It is the negative reciprocal, −1/f′(a). For a slope of 0.25 the normal slope is −4, not −0.25.
  • Extrapolating far from the point. Linear approximation is a local statement. Doubling the distance roughly quadruples the error, and the table on this page shows exactly where your tolerance runs out.
  • Assuming a tangent line touches the curve only once. It touches with matching slope at a, but it may cross the curve elsewhere. For y = x³ at a = 1 the tangent meets the curve again at x = −2.
  • Ignoring points where the derivative fails to exist. At a corner such as abs(x) at the origin there is no tangent line at all. At a vertical tangent such as cbrt(x) at the origin the line exists but has no slope, and at a cusp such as x^(2/3) the two one-sided slopes run to opposite infinities.

Newton's method is the tangent line applied to root finding. Take a guess, draw the tangent, and follow it to where it hits the axis: that gives x₁ = x₀ − f(x₀)/f′(x₀), which is the tangent-line formula solved for y = 0. Repeating it converges quadratically near a simple root, and the Newton-Raphson calculator runs the iteration for you.

The next term buys a lot of accuracy. Adding f″(a)(x − a)²/2 turns the tangent line into the tangent parabola, and the error drops from order to order . That is the second-order Taylor polynomial, and for the √x example it cuts the error at x = 5 from 0.0139 to 0.0017. Work it through: P₂(5) = 2 + 0.25(1) − 0.03125(1)²/2 = 2.234375 against √5 = 2.2360680.

Tangents to implicit curves work the same way. If your curve is given as an equation rather than as y = f(x), use implicit differentiation to get the slope and then feed it into the same point-slope form.

In more dimensions the tangent line becomes a tangent plane. Its coefficients are the partial derivatives, and the formula generalises to z = f(a,b) + f_x(a,b)(x−a) + f_y(a,b)(y−b). The gradient, from the gradient vector calculator, collects those partials into one object.

Frequently asked questions

How do I write the tangent line in point-slope form?

Use y = f(a) + f′(a)(x − a), substituting the two numbers this calculator reports as f at the point of tangency and slope of the tangent. For √x at a = 4 that is y = 2 + 0.25(x − 4). The slope-intercept form shown in the results, y = 0.25x + 1, is the same line expanded.

What is the difference between the tangent line and the linearisation?

They are the same object under two names. When you think of it as a line in the plane you call it the tangent; when you use it as a formula to estimate f(x) for x near a you call it the linearisation, written L(x). This page reports both the line and the value L(x) at the point you choose.

Why is the normal line vertical in my result?

Because the tangent came out horizontal, with slope zero. A perpendicular to a horizontal line is vertical, and a vertical line has no slope, so it cannot be written as y = mx + b. The calculator writes it as x = a instead, which is the correct equation.

How far from the point can I trust the approximation?

Read the error column of the table rather than guessing. As a rule the error scales with the square of the distance and with the size of the second derivative, so a function that barely curves stays accurate over a wide range while a sharply curving one does not. For √x near 4 the error is under 0.0002 at a distance of 0.1 and about 0.014 at a distance of 1.

Can a tangent line touch the curve at more than one point?

Yes. Tangency is a local condition — it fixes the height and slope at one point and says nothing about the rest of the curve. The tangent to y = x³ at x = 1 is y = 3x − 2, and that line meets the curve again at x = −2, crossing rather than touching there.

What happens at a corner or a cusp?

No tangent line exists at a corner, because the slope approaching from the left differs from the slope approaching from the right — abs(x) at the origin is the standard case. At a vertical tangent such as cbrt(x) at the origin the two one-sided slopes agree in sign but are infinite, so the tangent is the line x = 0 and there is no finite slope to report; the calculator leaves the slope blank. A true cusp, such as x^(2/3) at the origin, is different again: the one-sided slopes run to opposite infinities, so no tangent line exists there at all.

Why does my calculator disagree about the slope of tan x at 0?

Almost certainly a degree-versus-radian issue. In radians d/dx tan x = sec² x, which is 1 at the origin, giving the small-angle rule tan x ≈ x. In degrees the slope would be π/180, about 0.01745. This calculator works entirely in radians.

How do I get a tangent to a curve given by an equation rather than y = f(x)?

Use implicit differentiation to find dy/dx at your point, then substitute that slope and the point into y = y₀ + m(x − x₀). The implicit differentiation calculator on this site reports the slope and the normal slope directly for equations such as x² + y² = 25.

References