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.
- Height at the point.
f(4) = √4 = 2, so the point of tangency is(4, 2). - Derivative. Write
√x = x^0.5and apply the power rule:f′(x) = 0.5·x^(−0.5) = 1/(2√x). - Slope at the point.
f′(4) = 1/(2·2) = 0.25. - Point-slope form.
y = 2 + 0.25(x − 4). - Slope-intercept form. Expand:
y = 2 + 0.25x − 1 = 0.25x + 1. - Normal line. Slope
−1/0.25 = −4, soy = 2 − 4(x − 4) = −4x + 18. - 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
| f(x) | a | f(a) | f′(a) | Tangent line | Familiar form |
|---|---|---|---|---|---|
sqrt(x) | 4 | 2 | 0.25 | y = 0.25x + 1 | √(4+h) ≈ 2 + h/4 |
sin x | 0 | 0 | 1 | y = x | sin x ≈ x |
cos x | 0 | 1 | 0 | y = 1 | cos x ≈ 1 |
e^x | 0 | 1 | 1 | y = x + 1 | e^x ≈ 1 + x |
ln x | 1 | 0 | 1 | y = x − 1 | ln(1+h) ≈ h |
1/x | 1 | 1 | −1 | y = −x + 2 | 1/(1+h) ≈ 1 − h |
x^2 | 3 | 9 | 6 | y = 6x − 9 | (3+h)² ≈ 9 + 6h |
tan x | 0 | 0 | 1 | y = x | tan 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 numberf′(a). Leavingxin 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. Fory = x³ata = 1the tangent meets the curve again atx = −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 ascbrt(x)at the origin the line exists but has no slope, and at a cusp such asx^(2/3)the two one-sided slopes run to opposite infinities.
Linearisation, Newton's method and the next term
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 h² to order h³. 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.
