# What is the tangent line at a point?

Finds the equation of the tangent line to y = f(x) at x = a, with its slope, checked numerically.

- Page: https://www.acalculator.org/math/tangent-line-calculator
- JSON spec: https://www.acalculator.org/math/tangent-line-calculator.json
- Version: f6589a4cbe9f

## Default answer

Example with the default inputs (Function f(x) x^2, At x = a 3): The tangent line to x^2 at x = 3 is y = 6x - 9.

## Inputs

| Key | Label | Description |
| --- | --- | --- |
| f | Function f(x) | The curve y = f(x), typed like x^2, sqrt(x) or sin(x). |
| a | At x = a | The point of tangency: a number or a constant such as pi/4. |

## Outputs

| Key | Label | Description |
| --- | --- | --- |
| line | Tangent line y = | The tangent line y = f(a) + f′(a)(x − a), expanded, with exact numbers. |
| slope | Slope f′(a) | The slope of the tangent line. |
| y | Point f(a) | The y value of the point of tangency (a, f(a)). |

## Method

y = f(a) + f′(a)(x − a). A computer algebra system finds f′(a); it is shown only when f′ matches a difference quotient at 20 points and at a.

## Assumptions

- The variable is x; angles are in radians; ln is the natural logarithm.
- An answer that fails its check is not shown.

## Worked examples

1. f = x^2, a = 3 gives line = 6x - 9, slope = 6, y = 9. Source: OpenStax, Calculus Volume 1, section 3.1 Defining the Derivative, Example 3.1. https://openstax.org/books/calculus-volume-1/pages/3-1-defining-the-derivative.
2. f = 1/x, a = 2 gives line = 1 - x/4, slope = -0.25, y = 0.5.

## FAQ

### What is a tangent line?

The tangent line to y = f(x) at x = a is the line through the point (a, f(a)) with slope f′(a). Close to a it is the straight line that fits the curve best: zoom in on a smooth curve and it looks more and more like its tangent line.

### How do I find the equation of the tangent line?

Find the slope m = f′(a) by differentiating f and putting in x = a. Find the point: y₀ = f(a). The line is y − y₀ = m(x − a), which you can rewrite as y = mx + (y₀ − ma). For f(x) = x² at x = 3: f′(x) = 2x, so m = 6; f(3) = 9; the line is y = 6(x − 3) + 9 = 6x − 9.

### Why is there no tangent line at some points?

A tangent line needs a slope, and some curves have none at some points. |x| has a corner at 0: the slope is −1 on the left and 1 on the right. The page compares the slope just left and just right of a and gives no line when they differ. A curve like the cube root of x has a vertical tangent at 0, where the slope is infinite; the page gives no line there either.

### What is the difference between a tangent line and a secant line?

A secant line crosses the curve at two points, (a, f(a)) and (b, f(b)), and its slope is (f(b) − f(a))/(b − a). As b moves towards a, the secant line turns into the tangent line and its slope into the derivative f′(a).

### Can the tangent line cross the curve?

Yes. The tangent line touches the curve at a but may cross it elsewhere, and even at a itself: the tangent to x³ at 0 is y = 0, the x-axis, which the curve crosses there. Near an inflection point the curve passes from one side of its tangent line to the other.

### How is the answer checked?

A computer algebra system finds the line; each derivative it uses is compared with a numeric difference quotient at 20 points, and each coefficient with the derivative at a. The page then compares the slope with the slope of f just left and right of a. If any check fails, it says "No verified answer" instead of showing the line.

## Sources

- OpenStax, Calculus Volume 1, section 3.1 Defining the Derivative: https://openstax.org/books/calculus-volume-1/pages/3-1-defining-the-derivative
