Suppose y is a function of x: y = f(x) At the maximum/minimum of the curve y, the first derivative of the function (with respect to x) is equal to zero:dy/dx = 0To check whether this is a maximum or a minimum we take the second derivative with respect to x:d2y/dx2If d2y/dx2 < 0 then this point is a maximum.If d2y/dx2 > 0 then this point is a minimum.
IntuitionThe derivative describes the rate of change. In the above case, the first derivative means "the rate of change of y with respect to x". The first derivative of a function allows us to find the gradient of that function for any given x-value. We can think of the gradient as just a number describing the steepness of the curve at that point. Hence, a gradient of zero would mean the curve is flat (i.e. perfectly horizontal) whereas a gradient of infinity would mean the curve was perfectly vertical at that x-value. We are interested in where the curve is flat; where the gradient is zero; the stationary point. From our experience we know that the ground is level at the top of mountains and at the bottom of valleys. Hence, the gradient is zero at a curve's "peak" (the "maximum") at its "trough" (the "minimum"). We should also mention that the gradient is positive when going "uphill" (i.e. if y increases as x increases) and negative when going "downhill" (i.e. if y decreases as x increases). This fact helps us determine whether a stationary point is a maximum or a minimum. Since we have said that the the first derivative means "the rate of change of y with respect to x", it follows that the second derivative is "the rate of change of the rate of change of y with respect to x". Obviously this is a bit of a mouthful but, put simply, this means "the rate of change of the gradient." When we are walking uphill and approaching the summit, the gradient is decreasing; the hill is getting less steep with every step. At the peak, the gradient is zero. If we carry on walking, the gradient becomes negative; we are now walking downhill. So, overall, the gradient decreases as we walk over the hill. Hence, the second derivative at a maximum is negative.Using the same idea, try to understand why the second derivative is positive at a minimum (or the "bottom of a valley" in our illustration)!ExampleFind the stationary point of the curve y = x2Is this a maximum or a minimum?y = x2Therefore, dy/dx = 2xAt stationary point, dy/dx = 0. That is, 2x = 0. Hence, x = 0 at stationary point.From dy/dx = 2x we differentiate again with respect to x to find the second derivative:d2y/dx2 = 2At x = 0, d2y/dx2 = 2 (In this example the second derivative is 2 everywhere! The x-value doesn't affect it.)Since 2 > 0, this stationary point is a minimum.