The tangent line to a curve at a point is the straight line that best approximates the curve right at that point. It touches the curve without crossing it (for smooth functions) and has exactly the same slope as the curve at the point of contact. That slope is the derivative of the function, and finding it is the central task of differential calculus. Tangent lines matter practically because they let you approximate complex function values using simple linear arithmetic, they define the direction of motion for a moving object, and they form the basis of Newton's method for finding roots. This calculator takes any function of x written in standard notation, such as x^2, and an x value at which to find the tangent. It returns the slope of the tangent (which equals the derivative at that point), the complete tangent line equation in y = mx + c form, the coordinates of the point of tangency, and the normal line equation for the perpendicular line at the same point. Slope is computed by central difference numerical differentiation with h = 1e-7, giving highly accurate results for smooth functions. Use standard operators +, -, *, / and ^ for powers, plus functions like sin, cos, tan, exp, log, sqrt, and abs. The default example uses f(x) = x^2 at x = 2, giving slope = 4 and tangent y = 4x - 4.
Calculate.co.nz is proud to be partnered with Health Based Building, a leader in sustainable and health-conscious building innovation. With over a century of experience, they develop high-performance systems like Foreverbreathe Specification, Magnum Board, and Foreverbreathe Paints to support energy-efficient, non-toxic living environments. Their commitment to healthier homes aligns with our belief that informed choices lead to better outcomes for Kiwi households.
4
slope of tangent (derivative at x)
Tangent liney = 4x - 4
Point (x, f(x))(2, 4)
Normal liney = -0.25x + 4.5
Slope uses central difference numerical differentiation. Use ^ for powers and * for multiplication.
How it works
The derivative (slope of the tangent) is estimated by central difference: f'(x) is approximately (f(x+h) - f(x-h)) / (2h) with h = 1e-7. The function value f(x) is the y coordinate of the point of tangency. The tangent line equation uses point-slope form: y = slope * x + (f(x) - slope * x), giving the y-intercept c. The normal line is perpendicular with slope = -1/slope (or described as a vertical line if the tangent is horizontal). Positive c is shown as y = mx + c; negative c is shown as y = mx - |c|.
Worked example
For f(x) = x^2 at x = 2: the function value is f(2) = 4, so the point of tangency is (2.00, 4.00). The derivative is f'(x) = 2x, so f'(2) = 4. The tangent line equation is y = 4x + (4 - 4 * 2) = y = 4x - 4. The normal slope is -1/4 = -0.25 and the normal line is y = -0.25x + (4 + 0.25 * 2) = y = -0.25x + 4.50. These match the defaults pre-filled above.