The derivative of a function describes the gradient, also known as the slope. In the simplest terms, the slope defines the change in y divided by the change in x. So if there is a large increase in y for a small increase in x, we have a very large, positive gradient, and vice versa. As an example we can look at an ordinary quadratic equation (e.g.y = x2+5x ). As we move from left to right, the slope is initially large and negative, but moves towards zero. It is zero when the minimum is reached, and there is no change in y for a change in x (a horizontal line). Then the gradient begins to increase and becomes increasingly large and positive.
When we are trying to find the maximum or minimum of a function, we are trying to find the point where the gradient changes from positive to negative or the other way around. When this occurs, the function becomes flat for a moment, and thus the gradient is zero. Since we can find the gradient by taking the derivative of a function, we can simply set the derivative to zero. When this equation is then solved for x, we have found the x value at which the minimum occurs. To find the value of the minimum we simply plug the found x value back into the original function. For the example above, we find dy/dx = 2x +5. If we set this to zero, and solve for x, we find x=-2.5 at the minimum. Plugging this back into the original function we find that the minimum is equal to (-2.5)2 + 5(-2.5) = -6.25.