Recall the formula for finding the slope of a line joining two points and
Suppose these two points are points on a curve :

Notice that and . Let's adjust our notation slightly. Instead of and , let's use and instead. Therefore, instead of and , we now have and as shown below

Notice that with the new notation, the formula for the slope of the line has now become
Now suppose we make these two points on the curve closer together (we do this by letting become very small).

The closer we push the second point towards the , the closer the above formula comes to giving us the slope of the tangent line to the curve at the point .
The expression
is not defined for for , but this is where limits come in handy. We can approximate the slope of the tangent line by taking the limit of the above expression as (if the limit exists). We call this limit the derivative of the function , and denote it or .
The point is , and the point is . As point moves closer to point , the distance between the two points, , also decreases.
Observe that as this happens, the approximated tangent, represented by the blue dashed line, approaches the actual tangent at point , represented by the red line.
Try changing the function, , in the left side panel, and play around by moving points and .
Tip: You can drag the point horizontally.