Slope of Tangent Line Calculator: The Derivative, the Equation and the Steps
Enter a function and a point. You get the slope, the full tangent line equation, the curve plotted with the line, and the working shown. Corners, cusps, vertical tangents and asymptotes are named, not guessed at.
How to use the slope of tangent line calculator
- Tangent Line. Type f(x) and the x value you want the tangent at. You get f′(x) evaluated there, the point of tangency, and the line written in point slope and slope intercept form.
- Secant Line. Type f(x) and two x values. You get the slope of the secant between them, which is the average rate of change over that interval and the thing the tangent slope is the limit of.
Functions are typed the ordinary way: x^2, x^3 - 2x, sqrt(x), abs(x), sin(x), ln(x), exp(x), cbrt(x). The x value takes pi and e as well as numbers and fractions, so sin(x) at pi works as typed.
What you get back
- The slope of the tangent line, which is the derivative evaluated at your point.
- The full equation of the tangent line, in point slope form and solved for y. Most people searching for the slope want the line, so both are printed without asking.
- The point of tangency, worked out from your function rather than assumed.
- The normal line, under More results, since it is the question that usually follows the tangent. It is the perpendicular of the tangent, so the perpendicular slope calculator handles the same step on a straight line.
- The curve and the tangent drawn together, so you can see the line resting against the graph instead of taking the algebra on trust.
- A named answer when there is no tangent line. Corner, cusp, vertical tangent or a point outside the domain, each identified and explained rather than returned as an error.
A tangent line is not “a line that touches once”
This is the definition most people bring from geometry, where it is true for circles, and it is what several of the biggest calculator sites still print. It is wrong for curves in general, and believing it makes four later topics harder than they need to be.
When the derivative is finite, the tangent at x = a is the line through (a, f(a)) whose slope is f′(a). A limiting direction of the secants can also be vertical, and then the tangent is the line x = a with no number for a slope. Either way the definition says nothing about how many times the line meets the curve.
- The tangent to y = x³ at x = 0 is the x-axis, and it crosses the curve at the point of tangency. Try
x^3at0. - The tangent to y = sin(x) at x = π/2 is the line y = 1, which touches the curve again at every other peak, infinitely often.
- A straight line is its own tangent at every one of its points.
The useful way to hold it: the tangent line is the best straight line approximation to the curve near that point. Near, not everywhere. What happens further along the curve is not part of the definition.
Where the formula comes from: secant to tangent
A secant line joins two points on the curve, and its slope is something you already know how to work out:
m = (f(b) − f(a)) / (b − a)
Write the second point as a + h and it becomes the difference quotient, (f(a + h) − f(a)) / h. Now slide the second point towards the first. The secant pivots, and the slopes it passes through settle on a single number. That number is the derivative:
f′(a) = lim(h → 0) (f(a + h) − f(a)) / h
Use the Secant tab to watch it happen. Put x^2 with x values 1 and 3 and the secant slope is 4. Move the second value to 1.5 and it is 2.5. To 1.1 and it is 2.1. To 1.01 and it is 2.01. The tangent slope at x = 1 is 2, and the secants are walking towards it.
Why h cannot simply be 0. Setting h = 0 gives 0/0, which is not a number, and it also destroys the thing you are measuring: with both points in the same place there is no line through them to have a slope. The limit is a way of asking what the slope is heading towards without ever putting h to 0. The quotient is only ever evaluated for h close to 0, never at it.
When there is no tangent line, and how to tell which case you have
A curve can be perfectly continuous, drawn without lifting the pencil, and still have no tangent at a point. Three different things cause it, they have different answers, and most tools either collapse them together or refuse the input.
- Corner. The one-sided slopes are both finite and they disagree. On
abs(x)at 0 the slope from the left is −1 and from the right is +1. Because they differ, the derivative does not exist and no tangent line exists. This calculator prints both one-sided slopes so you can see why. - Cusp. The one-sided slopes run to opposite infinities. On
x^(2/3)at 0 the curve comes down steeply on one side and rises steeply on the other, meeting at a spike. Again no tangent line. - Vertical tangent. The slope runs to infinity in the same direction on both sides. On
x^(1/3)at 0, and onsqrt(x)at its domain edge, there is a tangent line. It is vertical, so it has no number for a slope, and its equation is x = a. - Point not on the curve. On
1/xat 0 the function has no value, so there is no point to be tangent to. This is a domain problem, not a slope problem, and it is a different situation from the three above. - Vertical asymptote.
tan(x)at π/2 is the case to watch. The graph shoots off in opposite directions either side, which looks like a cusp and is not one: the function is simply undefined there, so again there is no point and no tangent. A cusp is continuous, an asymptote is not.
The distinction that catches people out is the third against the first two: a vertical tangent is a real tangent line with a real equation, while a corner and a cusp have none. Some calculators do not separate these cases and return the same answer for sqrt(x) and abs(x) at 0, though only one of the two has a tangent line.
Finding a tangent line through a point that is not on the curve
This is standard homework, and the fixed input forms of the dedicated calculators on this search page have no separate outside-point mode: each one asks for a point on the curve. A general purpose engine that takes free-form questions may handle it. Either way the method is short enough to do by hand.
Call the unknown point of tangency (a, f(a)) and the given outside point (p, q). Two things must be true at once. The line through those two points has slope (f(a) − q) / (a − p), and the tangent at a has slope f′(a). Set them equal:
(f(a) − q) / (a − p) = f′(a)
That is one equation in one unknown. Solve it for a, then use this calculator with the a you found to get the line. How many answers you get depends on the curve and where the point sits. Take y = x². A point below the parabola gives two real tangent lines, which is the case most textbooks set, and a student who stops at one loses half the marks. A point on the parabola gives one, the tangent at that point. A point above it gives none at all: the equation for a comes out with no real solution. Sketching it makes that obvious, since from inside the curve there is no direction in which a straight edge can rest against it. Other functions behave differently again, and on something periodic like sin(x) a single point can have infinitely many tangent lines through it. Solve the equation and count what you actually get.
Horizontal tangent lines
A tangent is horizontal where f′(x) = 0, and that is what the calculator reports when the slope comes back as 0: the line is y = f(a). Try x^3 at 0, or cos(x) at 0.
Two cautions. A slope of 0 marks a critical point but does not by itself make it a maximum or a minimum, since y = x³ has a horizontal tangent at a point that is neither. Either side of a maximum the tangent slope changes sign, from positive to negative. And a point where f′ is undefined is also a critical point, so a search for horizontal tangents that only solves f′(x) = 0 will miss the corners and cusps described above.
Linearization is the same line under a different name
Later in the course the tangent line reappears as L(x) = f(a) + f′(a)(x − a), called the linear approximation or linearization of f at a. Rearrange the point slope form the calculator prints and you get exactly that. Nothing new has happened; the line is being used to estimate values of f near a rather than to describe a slope.
This is also the honest reason the tangent matters. Approximating a hard function by an easy line near a point is the move behind differentials, Newton’s method and most of numerical analysis.
Frequently asked questions
Is the derivative the same as the slope of the tangent line?
For a function of one variable at a point where it is differentiable, yes: f′(a) is the slope of the tangent at x = a, and the two phrases point at the same number. They are not the same kind of object, though. The derivative f′ is a function you can evaluate anywhere; the slope of the tangent is one number at one point. It is also worth knowing that the definition runs the other way round from how it is usually taught: the derivative is defined as a limit first, and the tangent line is then defined as the line with that slope. The tangent is not used to define the derivative, because doing so would be circular.
Can a tangent line cross the curve or touch it more than once?
Yes to both, and this trips up more people than any other point on this page. Tangency is local. The tangent to y = x³ at x = 0 crosses the curve at the very point it is tangent to. The tangent to y = sin(x) at a peak touches the curve at every other peak. The only thing the definition requires is that the line passes through (a, f(a)) with slope f′(a).
What is the difference between a secant line and a tangent line?
A secant cuts the curve at two points and its slope is the average rate of change between them. A tangent touches at one point and its slope is the instantaneous rate of change there. The tangent slope is the limit of the secant slopes as the second point slides in. Use the Secant tab and shrink the interval to watch one become the other.
Why does abs(x) have no tangent at 0 when I can clearly draw a line touching the corner?
You can draw many lines that touch the corner without crossing the graph, and that is the problem rather than the answer. A tangent has to have a single well defined slope, and here the slope approaching from the left is −1 while from the right it is +1. Two different answers means there is no derivative, so no line qualifies. Being able to draw a line that touches is not the test.
How do I tell a vertical tangent from a cusp or a corner?
Look at the two one-sided slopes. Both finite but different is a corner, as in abs(x) at 0. Both running to infinity in the same direction is a vertical tangent, as in x^(1/3) at 0, and here a tangent line does exist with equation x = a. Running to infinity in opposite directions is a cusp, as in x^(2/3) at 0. A fourth case is often confused with these: if the function is not defined at the point at all, that is a domain problem or an asymptote, not a cusp.
Why can’t h just equal 0 in (f(a + h) − f(a)) / h?
Two reasons, and the second is the one that matters. Putting h = 0 gives 0/0, which is undefined. But even setting the arithmetic aside, with h = 0 both points are the same point, and two identical points do not determine a line, so there is nothing left to take the slope of. The limit avoids this by asking what the quotient approaches as h shrinks, evaluating it only for h near 0 and never at 0.
How do I find the tangent line if the point is not on the curve?
Do not put the outside point into the calculator as the point of tangency. Let (a, f(a)) be the unknown tangency point and (p, q) the given point, then solve (f(a) − q) / (a − p) = f′(a) for a. That equation is usually quadratic, so expect two tangent lines rather than one. Feed each a back into this calculator to get the equations.
How do I find where a function has a horizontal tangent?
Solve f′(x) = 0, then check each solution. Also check any point where f′ is undefined, because those are critical points too and a horizontal-tangent search that only solves f′(x) = 0 will skip them. A horizontal tangent does not by itself mean a maximum or a minimum.
Is the tangent line related to tan(x) from trigonometry?
They share a root, the Latin for touching, and they are connected through the unit circle, where the value of tan is a length measured along the line that touches the circle. In calculus, though, they are separate ideas and the name collision is just a name collision. The tangent line to a curve has nothing to do with the tangent function unless the curve happens to be y = tan(x).
What is L(x) = f(a) + f′(a)(x − a)?
The tangent line, written for a different purpose. It is called the linearization or linear approximation of f at a, and it is the point slope form rearranged. Same line, same slope, same point; it is being used to estimate f(x) for x near a.
How do I get the tangent line on a TI-84?
Graph the function, then press 2nd, TRACE to reach the CALC menu and choose dy/dx to get the numerical derivative at a point. There is also a Tangent( command under the DRAW menu, 2nd then PRGM, which draws the line and prints its equation. There is no dedicated tangent button. The calculator gives you a decimal, so use it to check the answer you worked out rather than as the answer itself.
Does this calculator handle implicit or parametric curves?
Not yet. It takes an explicit function y = f(x). For an implicit curve, differentiate both sides with respect to x, solve for dy/dx, and substitute your point; for a parametric curve, the slope is (dy/dt) / (dx/dt) evaluated at your parameter value. Either way, once you have the slope and the point you can write the line.