Recall the formula for finding the slope of a line joining two points \( (x_1,y_1) \) and \( (x_2,y_2) \)
\[ m = \frac{y_2 - y_1}{x_2 - x_1} \]
Suppose these two points are points on a curve \(y = f(x)\):
Notice that \(y_1 = f(x_1)\) and \(y_2 = f(x_2)\). Let's adjust our notation slightly. Instead of \(x_1\) and \(x_2\), let's use \(x\) and \(x+h\) instead. Therefore, instead of \(y_1\) and \(y_2\), we now have \(f(x)\) and \(f(x+h)\) as shown below
Notice that with the new notation, the formula for the slope of the line has now become
\[ m = \frac{y_2 - y_1}{x_2 - x_1} = \frac{f(x+h) - f(x)}{x+h-x} = \frac{f(x+h) - f(x)}{h} \]
Now suppose we make these two points on the curve closer together (we do this by letting \(h\) become very small).
The closer we push the second point towards the \( (x,f(x)) \), the closer the above formula comes to giving us the slope of the tangent line to the curve at the point \( (x,f(x)) \).
The expression
\[ \frac{f(x+h) - f(x)}{h} \]
is not defined for for \(h = 0\), 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 \( h \to 0 \) (if the limit exists). We call this limit the derivative of the function \(f(x)\), and denote it \( f'(x) \) or \(\dfrac{d}{dx}\left(f(x)\right)\).