### An intro to slopes and tangents

The slope of a line, and its relationship to the tangent line of a curve is a basic concept in calculus. It is critical for an overall comprehension of function derivatives.

In this guide, you will find out what the slope of a line is and what a tangent is to a curve.

After going through this guide, you will be aware of:

- The slope of a line
- The average pace of change of f(x) on an interval w.r.t x
- The slope of a curve
- The tangent line to a curve at a point

__Tutorial Summarization__

This tutorial is subdivided into two portions, they are:

- The slope of a line and a curve
- The tangent line to a curve

__The Slope of a Line__

Let’s begin through review of the slope of a line. Within calculus, the slope of a line defines its steepness as a number. This number is quantified through dividing the change in the vertical direction to the alteration in the horizontal direction when shifting from one point on the line to another. The figure demonstrates how the slope can be quantified from two unique points A and B on a line.

A straight line can be uniquely defined by two points on the line. The slope of a line is similar everywhere on the line, therefore, any line can additionally be uniquely defined by the slope and one point lying on the line. From the known point, we can shift to any other point on the line going by the ratio defined by the slope of the line.

__The average rate of a change of a curve__

We can go about extending the idea of the slope of a line to the slope of a curve. Take up the left graph of the figure below. If we desire to measure the ‘steepness’ of this curve, it is going to vary at differing points on the curve. The mean rate of change when shifting from point A to point B is negative as the value of the function is reducing when x is increasing. It is identical when shifting from point B to point A. Therefore, we can define it over the interval [x0, x1] as:

(y1-y0)/(x1-x0)

We can observe that the above is additionally an expression for the slope of the secant line that consists of the points A and B. To jog your memory, a secant line intersects the curve at dual points.

Likewise, the average pace of change between point C and point D is positive and it’s provided by the slope of the secant line that consists of these two points:

__Definition of the slope of the curve__

Let’s now observe the right graph of the above image. What occurs when we shift point B towards the point A? Let’s refer to the new point B. When the point B is infinitesimally nearer to A, the secant line would convert into a line that touches the curve just once. Here, the x coordinate of B is (x0+h) with h an infinitesimally small value. The correlating value of the y-coordinate of the point B’ is the value of this function at (x0+h) that is, f(x0+h)

The mean rate of change over the interval [x0,x0+h] indicates the pace of change over a very small interval of length h, where h gets close to zero. This is referred to as the slope of the curve at the point x0. Therefore, at any point A(x0,f(x0)), the slope of the curve receives definition as:

The expression of the slope of the curve at a point A is equal to the derivative of f(x) at the juncture x0. Therefore, we can leverage the derivative to identify the slope of the curve.

__Instances of slope of the curve__

Here are a few instances of the slope of the curve.

- The slope of f(x) = 1/x at any juncture k (k is not equal to 0) is provideed by (-1/k^2). As an instance:
- Slope of f(x) = 1/x at (x=2) is -1/4
- Slope of f(x) = 1/x at (x=-1) is -1

- The slope of f(x) = x^2 at any juncture k is provided by (2k) For instance:
- Slope of f(x) = x^2 at (x=0) is 0
- Slope of f(x) = x^2 at (x=1) is 2

- The slope of f(x) = 2x+1, is a constant value equivalent to two. We can observe that f(x) defines a straight line.
- The slope of f(x) = k, (where k is a constant) is 0 as the function does not alter anywhere. Therefore, its mean rate of change at any point is zero.

__The Tangent Line__

It was specified earlier that any straight line can receive unique definition and a point that goes through it. We additionally just defined the slope of a curve at a point A. Leveraging these two facts, we’ll go about defining the tangent to a curve f(x) at a point A(x0,f(x0)) as a line that fulfils two of the following:

- The line goes through A
- The slope of the line is equivalent to the slope of the curve at the point A.

Leveraging the above two facts, it is easy to decide the equation of the tangent line at a point (x0,f(x0)). A few instances are demonstrated next.

__Instances of tangent lines__

- 1, f(x) = 1/x

The graph of f(x) combined with the tangent line at x=1 and x=-1 are displayed in the figure. Below are the steps to decide the tangent line at x=1.

- Equation of a line with slope m and y-intercept c is provided by: y=mx+c
- Slope of the line at any point is provided by the function f’(x)=-1/x^2
- Slope of the tangent line to the curve at x=1 is -1, we obtain y=-x+c
- The tangent line goes through the point (1,1) and therefore having the outcome in the above equation we obtain:
- 1=-(1)+cc=2
- The final equation of the tangent line is y = -x+2

- 2, f(x) = x^2

Displayed below is the curve and the tangent lines at the points x=2, x=-2, x=0. At x=0, the tangent line is parallel to the x-axis as the slope of f(x) at x=0 is 0.

This is how we go about computing the equation of the tangent line at x=2.

- Equation of a line with slope m and y-intercept c is provided by y=mx+c
- Slope of the line at any point is provided by the function f’(x) = 2x
- Slope of the tangent line to the curve at x=2 is 4, we obtain y = 4x+c
- The tangent line goes through the point (2,4) and therefore replacing in the above equation, we obtain:
- 4=4(2)+cc=-4

- The last equation of the tangent line is y=4x-4

- 3, f(x) = x^3+2x+1

This function is demonstrated below, combined with its tangent lines at x=0, x=2, and x=-2. Below are the stages to derive an equation of the tangent line at x=0.

- Equation of a line with slope m and y-intercept c is provided by: y=mx+c
- Slope of the line at any point is provided by the function f’(x) = 3x^2+2
- Slope of the tangent line to the curve at x=0 is 2, we obtain y=2x+c
- The tangent line goes through the point (0,1) and therefore replacing in the above equation, we obtain:
- 1=2(0)+cc=1

- The last equation of the tangent line is y=2x+1

Observe that the curve has an identical slope at both x=2 and x=-2, and therefore the two tangent lines at x=2 and x=-2 are parallel. The same would be the case would be true for any x=k and x=-k as f’(x) = f’(-x) = 3x^2+2

__Extensions__

This section details some concepts for extension of the guide that you may desire to explore:

- Velocity and acceleration
- Integration of a function