Tangent Line Calculator
Find the equation of the tangent line y = mx + b for a function at any point x = a, along with its slope.
Function f(x)
- 1
f(a) — function value at the point
f(2) = 4 - 2
Slope m = f′(a)
4Estimated via central finite difference: (f(a+h) − f(a−h)) ÷ (2h), h = 10⁻⁵. - 3
y-intercept b = f(a) − m × a
4 − 4 × 2 = -4
How does this calculator work?
The tangent line at x = a is y = f(a) + m(x − a), where the slope m is the derivative f′(a). Pick a function and a point, and this tool computes m numerically, then returns the line in y = mx + b form along with the point of tangency (a, f(a)).
Formula
How this is calculated
Choose a function f(x) from the list and enter the x-value a where you want the tangent. The tangent line is the straight line that just touches the curve at the point (a, f(a)) and shares the curve’s instantaneous slope there.
The slope m equals the derivative f′(a). This calculator estimates it numerically with a symmetric (central) difference, m ≈ (f(a+h) − f(a−h)) / (2h) with h = 1e-5, which is accurate for smooth functions. The line is then written in point-slope form y = f(a) + m(x − a) and simplified to slope-intercept form y = m·x + b, where b = f(a) − m·a.
Assumptions: f must be differentiable at a. Points outside a function’s domain (for example √x or ln(x) at x ≤ 0, or 1/x at x = 0) return no result. At sharp corners or vertical tangents the slope is undefined or very large, so treat extreme values with care.
Frequently asked questions
The slope equals the derivative of the function evaluated at the point, f′(a). It represents the instantaneous rate of change of the curve at x = a.
It uses a central finite difference: f′(a) ≈ (f(a+h) − f(a−h)) / (2h) with a tiny step h = 1e-5. This gives a very close approximation for smooth functions.
The chosen point may lie outside the function’s domain (such as ln(x) at x ≤ 0 or 1/x at x = 0), where the function or its derivative is undefined.
Also known as
TG we-Calculate Editorial Team. (2026). Tangent Line Calculator [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/tangent-line-calculator
TG we-Calculate Editorial Team. "Tangent Line Calculator." TG we-Calculate. 2026. https://we-calculate.com/calculator/tangent-line-calculator.
TG we-Calculate Editorial Team, "Tangent Line Calculator," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/tangent-line-calculator
@misc{wecalculate_tangent_line_calculator, title = {Tangent Line Calculator}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/calculator/tangent-line-calculator}}, year = {2026}, note = {TG we-Calculate} }
Did this calculator help you?
