Question regarding second derivatives and maximums. Justifying a specific part Note: My question is regarding the bolded parts. Read those and my explanation below to see what I am asking.
Let $f$ be a real-valued function on an open subset $U$ of $R$ that is twice differentiable at $x_0 \in U$. Show that if $f'(x_0) = 0$ and $f''(x_0) < 0$, then the restriction of $f$ to some open ball of center $x_0$ attains a maximum at $x_0$.
Here is my proof
To show there is a maximum, we want to show that
$f(x) < f(x_0) + f'(x_0)(x - x_0) \ \forall x \neq x_0, x_0 \in U$
Case 1.) Assume $x < x_0$. Applying the Mean Value Theorem on the interval $[x,x_0], \exists c \ where \ x < c < x_0 \ s.t.$
$f(x_0) - f(x) = f'(c)(x_0 - x)$
$f(x) = f(x_0) - f'(c)(x_0 - x)$
$f(x) = f(x_0) + f'(c)(x - x_0)$
Since $f''(x) < 0 \forall x \in U, f'(x)$ must be decreasing.
Since we know from the MVT that $c < x_0$, we can put these results together to have.
$f'(x_0) < f'(c)$
Multiplying this by $x - x_0$ (which is negative, so flip the inequality),
$f'(c)(x - x_0) < f'(x_0)(x - x_0)$
Adding $f(x_0)$ to both sides,
$f(x_0) + f'(c)(x - x_0) < f(x_0) + f'(x)(x - x_0)$
The left side is $f(x)$
$f(x) < f(x_0) + f'(x)(x - x_0)$ as desired.
Case 2.) Assume $x_0 < x$. Using the MVT on the interval $[x_0,x], \exists d \ where \ x_0 < d < x_0 \ s.t.$
$f(x) - f(x_0) = f'(c)(x - x_0)$
$f(x) = f(x_0) + f'(c)(x - x_0)$
Similar to before, $f''(x) < 0$ means $f'(x)$ is decreasing. We know from this application of MVT that $x_0 < c$
Therefore,
$f'(c) < f'(x_0)$
Multiplying by $x - x_0$ (positive this time)
$f'(c)(x - x_0)) < f'(x_0)(x - x_0)$
Adding $f(x_0)$,
$f(x_0) + f'(c)(x - x_0) < f(x_0) + f'(x_0)(x - x_0)$
The left side is $f(x)$
$f(x) < f(x_0) + f'(x_0)(x - x_0)$ still holds.
So we have shown that $\forall x \in U \ s.t. \ x \neq x_0$, the function will be concave down. Therefore, it has a maximum at $x_0$
I bolded the parts that were unclear. My professor told me that this is not necessarily true. The function will admit a negative second derivative at $x_0$, but not in the entire neighborhood.
He said in this case, what I did is correct, but he said it is not obvious as to why. He said I have to say something about why I can make that claim. Can someone help me figure out what I can say to make that part clear? I'm not seeing it right now.
Edit: I am thinking it maybe due to the fact that I'm claiming this happens on all of R. So like, the neighborhood wouldn't really matter? But then again, I feel like that would be trivial, so I don't think he would ask the question. I think I just defined it that way. I'm really not sure. Please, any help is appreciated!
Thanks in advance!
 A: Your professor is correct.
What we are dealing here with is called a local maximum.
Let $f$ be a real valued function defined on some open subset $U$ of $\mathbb {R}$. A point $x_0\in U$ is said to be a point of local maximum of $f$ if there is an open interval $I$ such that $x_0\in I, I\subseteq U$ and $f(x_0)\geq f(x) $ for all $x\in I$.
Here is the result you seek:
Theorem: Let $U$ be an open subset of $\mathbb {R} $ and let $f:U\to\mathbb {R} $ be a function. If $x_0\in U$ is such that $f'(x_0)=0,f''(x_0)<0$ then $x_0$ is a point of local maximum of $f$.
Observe that we don't have any information about existence of second derivative at any point except at $x_0$. But the existence of second derivative $f''$ at $x_0$ implies the existence of first derivative $f'$ in some neighborhood of $x_0$.
Next we need to analyze the meaning of $f''(x_0)<0$. Since $$f''(x_0)=\lim_{x\to x_0}\frac{f'(x)-f'(x_0)}{x-x_0}$$ the quotient on the right hand side in above equation must be negative for all $x$ in some deleted neighborhood $I$ of $x_0$. This means that $f'(x) - f'(x_0)=f'(x)$ has the sign opposite to that of $x-x_0$ in $I$. It follows that if $x\in I, x>x_0$ then $f'(x_0)<0$ and if $x\in I, x<x_0$ then $f'(x) >0$.
What this means is that $f$ is strictly increasing on the left side of $x_0$ in $I$ and strictly decreasing on the right side of $x_0$ in $I$. This clearly means that $f(x_0)\geq f(x)$ for all $x\in I$.

Your approach has issues at two steps. First is the definition of local maximum. The definition of local maximum does not need any idea of derivative. I don't see why you write $$f(x) <f(x_0)+f'(x_0)(x-x_0)$$ Next you are using values of $f''$ at points in some neighborhood of $x_0$. This is not given. The fact that $f''(x_0)<0$ does not imply that $f'$ is strictly decreasing in some neighborhood of $I$. This is the part in bold where you have some confusion. You have somehow assumed $f''$ to be negative in some neighborhood of $x_0$ and then deduce the conclusion that $f' $ is strictly decreasing in that neighborhood.
You can see from the argument in my answer that we don't need to know whether $f'$ is decreasing or not. We just need to know that derivative $f'$ is positive to the left of $x_0$ and negative to the right of $x_0$ in some neighborhood. This is sufficient to get the desired conclusion.
