The derivative f'(x) is the slope of the graph of f at the point x: how fast f changes when x moves a little. Positive slope, f is rising; negative, falling; zero, the graph is flat for an instant. Optimization lives on that last case: at the top or bottom of a smooth curve (away from any end point) the slope is zero.
f'(x) = \lim_{h \to 0} \frac{f(x+h) - f(x)}{h} In words: the slope of the line through two nearby points of the graph, as the second point slides onto the first.
\begin{align*} (x^n)' &= n\,x^{n-1}, & (a f + b g)' &= a f' + b g',\\ (f g)' &= f' g + f g', & \bigl(f(g(x))\bigr)' &= f'(g(x))\, g'(x) \end{align*} In words: the power rule; derivatives of sums and multiples add up; the product rule; and the chain rule (differentiate the outside, then multiply by the derivative of the inside).
f(x + \Delta x) \approx f(x) + f'(x)\,\Delta x In words: for a small step \Delta x, the change in f is about the slope times the step. The derivative is a rate, measured in units of f per unit of x.
A shop’s weekly revenue from selling q units is R(q) = 40q - q^2 dollars. Its derivative, the marginal revenue, is R'(q) = 40 - 2 q dollars per unit. At q = 5 units the slope is R'(5) = 30 dollars per unit: one more unit adds about $30. The exact gain R(6) - R(5) = 29 dollars is close, because the slope changes a little over the step. The slope is zero at q = 20 units, the top of the revenue curve, where revenue is R = 400 dollars. The kernel finds the same top:
maximize 40*q - q^2
# q = units sold per week, revenue in dollars
It reports q = 20 units and revenue 400 dollars (status optimal).
A zero derivative is the one-variable form of stationarity, the first condition in Lagrange and KKT. The derivative as a rate is also how ProvenDecisions reads a result: a shadow price is the rate at which the best value changes when a limit moves, in units of the objective per unit of the limit. Gradient and Newton steps, which solvers take, are built from derivatives.