A *secant line* is a straight line that connects two points on a curve. A *tangent line* is a straight line that “just touches” the curve at a single point.

The slope of the secant line gives us the *average* rate of change of the function on the interval between the two points. The slope of the tangent line gives us the *instantaneous* rate of change.

Finding the slope of the secant line is easy:

`m_"sec" = (Delta y)/(Delta x) = (y_2 - y_1)/(x_2 - x_1) = (3 - 4)/(4 - 2) = -1/2`.

We can generalize this to give us the average rate on the interval [`x_1`, `x_2`] for any function `f` with

`m_"sec" = (f(x_2) - f(x_1))/(x_2 - x_1)`,

but what about the tangent line? We could draw it with a ruler and pick two points that is passes through, but this method is tedious and inaccurate. No, instead we can use our newly-acquired limit skills.

The key thing to realize here is that the secant line and the tangent line are related. A tangent line is just a secant line whose interval happens to be very, very small—*infinitesimal*, to be exact (this means indefinitely small). In other words, the slope of the tangent line at `x=a` is equal to the slope of the secant line on the interval [`a`, `a+h`] as `h` approaches zero:

`m_"tan" = lim_(h->0)(f(a+h) - f(a))/h`.

This is the first principle of calculus. As with most other things, graphing will help us understand it:

As we move the second point closer to the first point, thereby making `h` approach zero, the slope of the secant line will converge on the slope of the tangent line at `a`.

Suppose we want to find the slope of the tangent line at 3 on `f(x) = x^2`. We simply plug it into our first principle of calculus, giving us

`m_"tan" = lim_(h->0)(f(3+h) - f(3))/h = lim_(h->0)((3+h)^2 - 3^2)/h`,

which simplifies to

`lim_(h->0)(9+6h+h^2 - 9)/h = lim_(h->0)(6h+h^2)/h = lim_(h->0)6+h = 6+0 = 6`,

therefore the instantaneous rate of change at `x = 3` is 6.