Tangent Line Calculator
Find the equation of the tangent line to a function at a given point.
Common Functions
Use ^ for powers, * for multiply, sin/cos/exp/ln
What Is the Tangent Line Calculator?
The Tangent Line Calculator finds the equation of the tangent line to any differentiable function f(x) at a specified point x = a. It uses central difference numerical differentiation to compute f'(a) (the slope), builds the tangent line equation using point-slope form, and also finds the normal line (perpendicular to the tangent). The second derivative f''(a) is computed to determine concavity. An SVG graph shows f(x) and the tangent line together.
- ›Tangent equation: y − f(a) = f'(a)(x − a), rearranged to slope-intercept form
- ›Slope computed via central difference: f'(a) ≈ [f(a+h)−f(a−h)]/(2h)
- ›Normal line has slope −1/f'(a) and passes through (a, f(a))
- ›Concavity: f''(a) > 0 means concave up (minimum nearby); f''(a) < 0 means concave down
- ›Graph shows the curve and tangent line in the interval [a−3, a+3]
Formula
Tangent Line Formulas
Tangent line
y − f(a) = f'(a)(x − a)
Slope
f'(a) = lim [f(a+h)−f(a)]/h
Normal line
slope = −1/f'(a) ⊥ tangent
Num. derivative
f'(a) ≈ [f(a+h)−f(a−h)]/(2h)
2nd derivative
f''(a) → concavity at a
Concave up
f''(a) > 0; concave down: < 0
How to Use
- 1Enter the function f(x) using standard notation (x^2 for x², sin(x), exp(x), ln(x))
- 2Enter the point a at which to find the tangent line
- 3Click Find Tangent Line
- 4The tangent line equation, normal line, and slope are displayed
- 5The graph shows f(x) (solid) and the tangent line (dashed orange)
- 6Use Common Functions presets to load classic examples instantly
Example Calculation
Find the tangent line to f(x) = x² at a = 3:
f'(3) = 2×3 = 6 (slope of tangent)
Tangent: y − 9 = 6(x − 3)
y = 6x − 9
Normal: slope = −1/6
y − 9 = −(1/6)(x − 3) → y = −x/6 + 9.5
Tangent to f(x) = sin(x) at x = 0:
f'(0) = cos(0) = 1
Tangent: y = x (the classic small-angle approximation sin(x) ≈ x)
f''(0) = −sin(0) = 0 → inflection point
Tangent Lines and Linear Approximation
The tangent line is the best linear approximation to f near a. This is the foundation of calculus's power: locally, any smooth curve looks like a line. The approximation f(x) ≈ f(a) + f'(a)(x−a) is used everywhere, from physics (small oscillations), to engineering (linearizing control systems), to finance (option delta hedging). The error in the approximation grows as (x−a)².
Understanding Tangent Line
Tangent Line Examples for Common Functions
| f(x) | a | f(a) | f'(a) | Tangent Line | Concavity |
|---|---|---|---|---|---|
| x² | 2 | 4 | 4 | y = 4x − 4 | Up (f''=2) |
| x³ | 1 | 1 | 3 | y = 3x − 2 | Up (f''=6) |
| sin(x) | 0 | 0 | 1 | y = x | Inflection |
| cos(x) | π/2 | 0 | −1 | y = −x + π/2 | Down |
| eˣ | 0 | 1 | 1 | y = x + 1 | Up (f''=1) |
| ln(x) | 1 | 0 | 1 | y = x − 1 | Down |
| 1/x | 2 | 0.5 | −0.25 | y = −0.25x + 1 | Up |
| √x | 4 | 2 | 0.25 | y = 0.25x + 1 | Down |
Frequently Asked Questions
What is the equation of a tangent line?
- ›Point-slope form: y − f(a) = f'(a)(x − a)
- ›Slope-intercept: y = f'(a)x + [f(a) − a·f'(a)]
- ›For f(x)=x²: tangent at a=2 is y = 4x − 4
- ›For f(x)=sin(x): tangent at a=0 is y = x (famous small-angle approx.)
What is the normal line?
- ›Normal slope = −1/f'(a) (negative reciprocal)
- ›Normal passes through (a, f(a)) just like the tangent
- ›If tangent is horizontal (f'(a)=0), normal is vertical x=a
- ›Used in optics (angle of incidence = angle of reflection relative to normal)
What does the second derivative tell us about the tangent point?
- ›f''(a) > 0: concave up (∪); tangent line underestimates f
- ›f''(a) < 0: concave down (∩); tangent line overestimates f
- ›f''(a) = 0: possible inflection point (check sign change of f'')
- ›The error in linear approx. ≈ f''(a)/2 · (x−a)², proportional to curvature
How is the derivative computed numerically?
- ›Central difference: error ~ h²·f'''(a)/6 (vs forward: error ~ h·f''(a)/2)
- ›Second derivative: [f(a+h) − 2f(a) + f(a−h)] / h²
- ›Choice of h: too large → truncation error; too small → cancellation error
- ›h = 10⁻⁵ is optimal for double-precision floating-point arithmetic
What functions can I enter?
- ›Powers: x^2, x^0.5, 2^x
- ›Trig: sin(x), cos(pi*x), tan(x/2)
- ›Exponential/log: exp(x), ln(x+1), log(x)
- ›Compound: x^2*sin(x), exp(-x^2), sqrt(1-x^2)
- ›Note: sqrt of negative number → NaN; ln of non-positive → NaN
What is linear approximation and where is it used?
- ›Newton's method: xₙ₊₁ = xₙ − f(xₙ)/f'(xₙ), uses tangent line intersection with x-axis
- ›Small angle: sin(θ) ≈ θ for small θ (tangent to sin at 0)
- ›Compound interest: (1+r)ⁿ ≈ 1+nr for small r
- ›GPS: linearizes satellite distance equations to solve for position
Is this tangent line calculator free?
Yes, completely free with no registration required. All calculations run locally in your browser.