How is it that a maximum of a function can have the second derivative as 0? I thought the gradient of the tangent to the curve changed from positive to negative at a maximum and is therefore decreasing.
-
2The function might simply be "too flat" at the extremum. Consider e.g. $f(x) = -x^4$. – Jakob Streipel Aug 16 '22 at 10:52
-
How can it be flat at the maximum? I thought there was only one point where the function reaches the maximum – overthetop Aug 16 '22 at 10:55
-
1Indeed: if $f(x)=-x^4$, then the maximum is attained at $0$ and only at $0$. However, $f'(0)=f''(0)=f'''(0)=0$; that's why we say that $f$ is very flat near $0$. – José Carlos Santos Aug 16 '22 at 11:01
-
It's not that it is actually flat, it is just flatter than, say, $f(x) = -x^2$. Intuitively, the second derivative test is comparing the function to a parabola, trying to tell if it looks alike. One can power this test up by looking at more derivatives, which amounts to comparing the function locally to higher degree polynomials. – Jakob Streipel Aug 16 '22 at 11:04
-
I believe you. I just don't see how. The gradient has gone from positive to negative and is therefore decreasing ie the change in the gradient is negative, not 0. – overthetop Aug 16 '22 at 11:08
-
You may think of it as the slope changing so slowly around $x = 0$ that the second derivative doesn't see it. The slope is changing, overall, but around that exact point it is very, very slowly changing. – Jakob Streipel Aug 16 '22 at 11:12
-
1You say you don't see how this can be. Jose gave an example where it happens - what's your problem with the example $f(x)=-x^4$? – David C. Ullrich Aug 16 '22 at 11:13
-
I thought differentiation could detect any changes, no matter how small. – overthetop Aug 16 '22 at 11:14
-
1A classic counterexample to that notion is $f(x) = \begin{cases} e^{-1/x^2}, & \text{if $x \neq 0$} \ 0, & \text{if $x = 0$} \end{cases}$. This function has a minimum at $x = 0$, and the value of $f(x)$ definitely does change if you move away from $x = 0$. Nevertheless every single derivative of $f$ is $0$ at $x = 0$. – Jakob Streipel Aug 16 '22 at 11:26
-
$y=-x^6$ at $x=0$ – Ivan Kaznacheyeu Aug 16 '22 at 14:18
1 Answers
Consider the function $g(x) = 4x^3.$
This is an increasing function. It is increasing everywhere you look. No matter what values of $x_1$ and $x_2$ you choose, it is always true that if $x_1 < x_2$ then $g(x_1) < g(x_2).$ Even if $x_1 = 0$ or $x_2 = 0.$
So in particular the function $g(x) = 4x^3$ is increasing at $x = 0.$
But the derivative of $g(x)$ is $g'(x) = 12x^2.$ Therefore $g'(0) = 0.$
This is why you cannot just look for "the derivative is zero" to tell you whether you have a local extremum at a given point. In this case we have an inflection point in the graph of $y = g(x)$ at the point $(x,y) = (0,0).$
On the other hand, the function $h(x) = -4x^3$ is decreasing everywhere. Its derivative is $h'(x) = -12x^2.$ Therefore $h'(0) = 0.$
This means that at $x = 0,$ both of the functions $g(x)$ and $h(x)$ have zero first derivatives, even though one function is increasing and one is decreasing. If you only look at the first derivative of a function and find that it is zero, you can't tell whether the function is increasing or decreasing at that point.
Of course a positive first derivative implies and increasing function and negative implies decreasing. It's just the reverse implication that doesn't always work.
Now consider the function $f(x) = -x^4.$ This function clearly has a maximum at $x = 0,$ because $f(0) = 0$ and $f(x) < 0$ whenever $x \neq 0.$
The derivative of $f(x)$ is $f'(x) = -4x^3 = h(x).$ So we know the derivative is positive whenever $x < 0$ and is negative whenever $x > 0.$ That also tells us that a maximum of $f(x)$ occurs at $x = 0.$
But the second derivative of $f(x)$ is $f''(x) = h'(x) = -12x^2.$ So $f''(0) = 0.$
The second derivative of $f(x)$ is zero.
But that doesn't change the fact that the gradient of the curve $y = f(x)$ goes from positive to negative exactly as we pass $x = 0.$ The reason is because the value of $h(x)$ goes from positive to negative exactly at zero, despite the fact that the derivative of $h(x)$ is zero at $x=0.$
- 98,388