✖

Equation of a tangent

A tangent is a line that touches the graph of a function at one point and has the same slope (gradient) there as the graph. Near that point it hugs the graph so closely that the two are almost indistinguishable. Let’s see it on the parabola, that is, on the graph of f(x) = x2:

The graph of f(x) = x^2, its tangent t at the point T, and a grey line that also passes through T but crosses the graph

The red line t is the tangent at the point T(1, 1). The grey dashed line passes through the same point, but it has a different slope, and so it crosses the graph and meets it again a little further along. So it is not a tangent.

The task usually looks like this: we have a function and a point on its graph, and we want to write the equation of the tangent at that point, that is, the equation of a line of the form y = mx + b. To get the equation of a line we need two things:

  • a point the line passes through,
  • the slope m, that is, the number that tells us how steeply the line is tilted.

The point is given. It lies on the graph, so if its first coordinate is x0, its second coordinate is f(x0). For the slope we can turn to the derivative: the derivative of a function at a point is exactly the slope of the tangent at that point. What remains is to build the equation of the line from the point and the slope.

A line given by a point and a slope

A line with slope m passing through the point (x0, y0) has the equation

y−y0=m⋅(x−x0).

You can check it straight away: if you substitute x0 for x, the right-hand side is zero, so y = y0 and the point lies on the line. And the number in front of the bracket is the slope, because after expanding the bracket we get the slope-intercept form of a line y = mx + b with m in the right place.

For a tangent, we put y0 = f(x0) for the point of tangency and the derivative for the slope, m = f'(x0).

The formula

If all you need is the formula, the tangent to the graph of a function f at the point (x0, f(x0)) is written as

y−f(x0)=f′(x0)⋅(x−x0),

where x0 is the first coordinate of the point of tangency and f'(x0) is the derivative of f at that point. The formula assumes that the derivative at x0 exists; otherwise we cannot write the tangent this way.

The whole method therefore has three steps:

  1. work out f(x0),
  2. differentiate the function and work out f'(x0),
  3. substitute both numbers into the formula and simplify.

Example

Let’s write the equation of the tangent to the graph of f(x) = x2 at the point x0 = 1, which is the red tangent from the figure at the start of the article.

We start with the value of the function at x0:

f(1)=12=1

So the point of tangency is (1, 1). Next comes the derivative; by the derivative formulae, (x2)' = 2x:

f′(x)=2x

We put x0 = 1 into the derivative:

f′(1)=2⋅1=2

The slope of the tangent is two. We substitute both numbers into the formula:

y−1=2⋅(x−1)

Expand the bracket:

y−1=2x−2

It remains to isolate y, so we move the one to the right:

y=2x−1

The tangent to the graph of x2 at the point (1, 1) has the equation y = 2x − 1. Check that the tangent really passes through the point of tangency: 2 · 1 − 1 = 1. It works.

A common mistake is to substitute x0 into the original function even where the derivative belongs, and write y − 1 = 1 · (x − 1). You do get a line through the point, but it has the wrong slope, and so it crosses the graph. It is exactly the grey dashed line y = x from the opening figure.

A tangent parallel to a line

Sometimes nobody gives us the point of tangency and we have to track it down ourselves. A typical question reads: find the tangent to the graph of the function

f(x)=x2−4x+5,

that is parallel to the line y = 2x − 7.

The line y = 2x − 7 is not itself a tangent; it does not even have any point in common with the parabola. If we set the two equations equal, we get x2 − 6x + 12 = 0, and this quadratic equation has no solution, because the discriminant works out as 36 − 48 = −12. So we have to shift the line until it just touches the parabola.

Parallel lines have the same slope, so the tangent we are looking for must have slope two, just like the line y = 2x − 7. We are therefore looking for a point where the derivative equals two. Differentiate:

f′(x)=2x−4

Set the derivative equal to two and solve the linear equation:

2x−4=2/+42x=6/:2x=3

The first coordinate of the point of tangency is x0 = 3. We get the second from the function:

f(3)=32−4⋅3+5=9−12+5=2

We have the point of tangency T(3, 2) and the slope two, so we can write:

y−2=2⋅(x−3)

After expanding the bracket and moving the two to the right, we get:

y=2x−4

The tangent we are looking for has the equation y = 2x − 4. In the figure you can see the parabola in black, the given line p in blue, the tangent t in red and the point of tangency T in orange.

The parabola f(x) = x^2 - 4x + 5, the line p: y = 2x - 7 and the tangent t: y = 2x - 4 parallel to it, with point of tangency T

If the given line had a different slope, the method would be exactly the same; we would just set the derivative equal to a different number. For a parabola there is always exactly one point of tangency; for more complicated functions there may be more, or there may be none at all.

The normal

The normal is the line that passes through the point of tangency and is perpendicular to the tangent. If the tangent has slope m, the perpendicular line has slope −1m. The equation of the normal is therefore

y−f(x0)=−1f′(x0)⋅(x−x0).

We only use the formula when f'(x0) ≠ 0. If the derivative is zero, the tangent is horizontal and the normal is the vertical line x = x0.

Let’s go back to the first example and work out its normal, that is, the normal to x2 at the point (1, 1). The slope of the tangent was two, so the slope of the normal is −12. We substitute:

y−1=−12⋅(x−1)

Expand the bracket:

y−1=−12x+12

Move the one to the right-hand side and add the fractions:

y=−12x+32

The normal to the graph of x2 at the point (1, 1) is therefore given by the equation y=−12x+32.