MathsCalculus

Tangent Line
calculator.

A tangent line touches a curve at one point and has the same slope as the curve there.

How it's worked out

OpenStax defines the tangent as the line through the point (a,f(a))(a, f(a)) whose slope is the derivative at a. You need two numbers: the height f(a)f(a) and the slope f′(a)f'(a). Put them in the point-slope form.

y−f(a)\displaystyle y - f(a)=f′(a)(x−a)\displaystyle {}= f'(a)\,(x - a)

To get the form you graph with, expand and collect the numbers. The slope is unchanged, and the intercept is the height minus slope times a.

y\displaystyle y=mx+b\displaystyle {}= m x + b
b\displaystyle b=f(a)−ma\displaystyle {}= f(a) - m\,a

The normal line goes through the same point at a right angle to the tangent. Perpendicular slopes are negative reciprocals, so the normal has the slope below. A flat tangent has slope 0, which has no reciprocal, so its normal is the vertical line x=ax = a.

mnormal\displaystyle m_{\text{normal}}=−1f′(a)\displaystyle {}= -\frac{1}{f'(a)}

The slope here comes from automatic differentiation, which carries exact derivative rules through each step of your formula. It does not divide a tiny rise by a tiny run, so the only error left is ordinary rounding. A fraction such as 13\frac{1}{3} stays stacked when the numbers allow it.

Worked examples

Maya checks a cubic from her homework

Maya wants the tangent to y=x3−3xy = x^3 - 3x at x=2x = 2. The height is 2. The derivative is 3x2−33x^2 - 3, and at 2 it equals 9.

y\displaystyle y=9x−16\displaystyle {}= 9x - 16

The normal has the opposite tilt, so it comes out as y=−19x+209y = -\frac{1}{9}x + \frac{20}{9}. Since f′′(2)=12f''(2) = 12 is positive, the curve bends up, and the tangent sits under it near the point.

Her book then asks where the line hits the curve again. Setting the curve equal to the line leaves a double root at 2 and one more at x=−4x = -4, where both have height −52. So a tangent can touch a curve in one place and cut it in another.

Open this example in the tool

Sam estimates a square root without a calculator

Sam knows the square root of 9 and wants the square root of 9.1. OpenStax works this same case: the line at 9 has slope 16\frac{1}{6} and height 3.

y\displaystyle y=16x+32\displaystyle {}= \frac{1}{6}x + \frac{3}{2}

At 9.1 the line gives 3.016667, and the true value is 3.016621. The estimate is too high by 0.000046, which fits a curve that bends down away from its tangent.

Now try 10, a step ten times as long. The line gives 3.166667 against 3.162278, so the miss grows to 0.004389. That is about 95 times the first miss. The error grows with the square of the step, not with the step.

Open this example in the tool

Lee tests the small angle rule

Physics books replace sin x with x for small angles in radians. That rule is the tangent at 0, which is y=xy = x. At 0.2 radians, about 11 degrees, the line gives 0.2 and the sine is 0.198669.

This case differs from the other two. Since f′′(0)=0f''(0) = 0, the curve crosses its tangent at the point itself. The line is above the curve on the right and below it on the left, and the miss here, 0.001331, shrinks with the cube of the step.

Open this example in the tool

Reading your result

Slope. This is the rate of change at the point: how much y moves for each 1 added to x, right there. The tilt in degrees is the arctangent of that slope, measured from the horizontal.

The second derivative. It tells you which side of the line the curve takes nearby. If it is positive, the curve bends up and estimates from the line are too low. If it is negative, they are too high. At x=2x = 2 on 1x\frac{1}{x} it is 0.25, so the estimate at 2.2 of 0.45 falls short of the true 0.454545.

Which form to use. Point-slope shows the point and the slope, so it is the quickest one to check by hand. Slope-intercept is easier to graph and to compare with other lines.

The same tangent line also powers Newton's method, which follows it down to the x-axis to get closer to a root. These lines at common starting points are worth knowing by sight.

Tangent lines of common functions
CurveAt xTangent
x2x^21y=2x−1y = 2x - 1
sin⁡x\sin x0y=xy = x
cos⁡x\cos x0y=1y = 1
exe^x0y=x+1y = x + 1
ln⁡x\ln x1y=x−1y = x - 1
x\sqrt{x}1y=12x+12y = \frac{1}{2}x + \frac{1}{2}
1x\frac{1}{x}1y=−x+2y = -x + 2
tan⁡x\tan x0y=xy = x

Common mistakes

  • Leaving x in the slope. With f′(x)=3x2−3f'(x) = 3x^2 - 3, the slope at 2 is the number 9. If you keep the x, your "line" is a curve.
  • Using \(f(a)\) as the slope, or \(f'(a)\) as the height. They are different numbers. On the cubic at 2, the height is 2 and the slope is 9.
  • Flipping the slope without changing its sign. The normal needs both changes. A slope of 9 gives a normal slope of −19-\frac{1}{9}, not 19\frac{1}{9}.
  • Dividing by 0 for a flat tangent. At the low point of x2x^2, the tangent is y=0y = 0 and the normal is the vertical line x=0x = 0. It has no slope to write.
  • Using degrees in a trig function. The rule that sin x has slope cos x holds only in radians, so sin(30) here means 30 radians.
  • Trusting an estimate far from a. OpenStax warns that the line is not a good stand-in far from the point. Check the error before you rely on it.

Questions people ask

Set the derivative equal to 0 and solve for x, then put each x back in the function to get the height. For x³ − 3x that gives x = −1 and x = 1. The same idea finds tangents parallel to any line: set the derivative equal to that line's slope, and a slope of 9 gives x = −2 and x = 2.

Sources