# Math: How to Find the Tangent Line of a Function in a Point

*I hold both a bachelor's and a master's degree in applied mathematics.*

## What Is a Tangent Line?

In mathematics, a tangent line is a line that touches the graph of a certain function at one point, and has the same slope as the slope of the function at that point. By definition, a line is always straight and cannot be a curve. Therefore, a tangent line can be described as a linear function of the form* y = ax + b.*

To find the parameters *a* and *b,* we have to use the characteristics of the function and the point we are looking at. First, we need the slope of the function at that specific point. This can be calculated by first taking the derivative of the function, and then filling in the point. Then there are also enough details to find *b*.

Another interpretation was given by Leibniz when he first introduced the idea of a tangent line. A line can be defined by two points. Then, if we pick those points infinitely close to each other, we get the tangent line.

The name tangent line comes from the word *tangere*, which is "touching" in Latin.

### The Derivative

To find a tangent line we need the derivative. The derivative of a function is a function that for every point gives the slope of the graph of the function. The formal definition of a derivative is as follows:

*df(x)/dx = lim{h to 0} (f(x+h) - f(x))/h)*

The interpretation is that if *h* is very small the difference between* x* and *x + h* is very small, so the difference between *f(x+h)* and* f(x)* should also be small. In general, this does not have to be the case—for example, when* f(x)* is not continuous. However, if a function is continuous, this will be the case. The definition of "continuous" is pretty complex, but it means as much as that you can draw the graph of the function in one move without taking your pen off the paper.

Then what the definition of the derivative does is imagine the part of the function between* x* and *x+h* as if it was a straight line and determine its direction of it. Since we took *h* to be infinitesimally close to zero, this corresponds to the slope at the point *x*.

If you want more information on the derivative you can read the article I wrote about calculating the derivative. If you want to know more about the limits that are used, you can also check my article about the limit of a function.

## Finding the Parameters

A tangent line is of the form* ax + b*. To find *a* we must calculate the slope of the function in that specific point. To get this slope we first have to determine the derivative of the function. Then we have to fill in the point in the derivative to get the slope at that point. This is the value of *a*. Then we can also determine *b* by filling in a and the point in the formula of the tangent line.

### Numerical Example

Let's look at the tangent line of *x^2 -3x + 4* in the point (1,2). This point is on the graph of the function since *1^2 - 3*1 + 4 = 2*. As a first step, we need to determine the derivative of *x^2 -3x + 4*. This is *2x - 3*. Then we need to fill in 1 in this derivative, which gives us a value of -1. This means that our tangent line will be of the form *y = -x + b*. Since we know that the tangent line needs to go through the point (1,2) we can fill in this point to determine b. If we do this we get:

*2 = -1 + b.*

This means that *b* has to be equal to 3 and therefore the tangent line is *y = -x + 3*.

### General Formula of the Tangent Line

There also is a general formula to calculate the tangent line. This is a generalization of the process we went through in the example. The formula is as follows:

*y = f(a) + f'(a)(x-a)*

Here a is the x-coordinate of the point you are calculating the tangent line for. So in our example, *f(a) = f(1) = 2. f'(a) = -1*. Therefore the general formula gives:

*y = 2 + -1 * (x - 1) = 2 -x + 1 = -x + 3.*

This is indeed the same tangent line as we calculated before.

## A More Difficult Example

Now we look at the function *sqrt(x-2)/cos(π*x) at x = 3*. This function looks a lot uglier than the function in the previous example. However, the approach stays exactly the same. First, we determine the y-coordinate of the point. Filling in 3 gives s*qrt(1)/cos(pi) = 1/-1 = -1*. So the point we are looking at is (3,-1). Then the derivative of the function. This is a pretty difficult one, so either you can use the quotient rule and try it by hand, or you can ask a computer to calculate it. One can check that this derivative is equal to:

*(2 π (x - 2) tan(π x) + 1) /(2 sqrt(x - 2)cos(π x))*

Now we can calculate a with the use of this derivative. Filling in *x = 3 gives a = -1/2*. Now we know *a, y* and *x*, which enables us to calculate *b* as follows:

*-1 = -1/2*3 + b.*

This means *b = 1/2*, which leads to the tangent line *y = -1/2x + 1/2*.

Instead of this, we could also take the shortcut via the direct formula. Using this general formula we get:

*y = f(3) + f'(3)(x-3) = -1 + -1/2*(x-3) = -1 - 1/2x + 3/2 = 1/2x + 1/2.*

Indeed, we get the same tangent line.

## Summary

A tangent line is a line that touches the graph of a function in one point. The slope of the tangent line is equal to the slope of the function at this point. We can find the tangent line by taking the derivative of the function in the point. Since a tangent line is of the form* y = ax + b* we can now fill in *x, y,* and *a* to determine the value of *b*.

*This content is accurate and true to the best of the author’s knowledge and is not meant to substitute for formal and individualized advice from a qualified professional.*