Let $f:[a,b] \rightarrow \mathbb{R}$ be a two times differentiable function, that attains its maximum value at some $x_0\in (a,b).$ Prove that $f''(x_0)\leq 0.$
Attempt. By defintion, we have $\displaystyle f''(x_0)=\lim_{x \rightarrow x_0}\frac{f'(x)-f'(x_0)}{x-x_0}$, where $f'(x_0)=0$ by Fermat's theorem (since $x_0$ is an interior point of diferentiability of $f$), so: $$\displaystyle f''(x_0)=\lim_{x \rightarrow x_0^+}\frac{f'(x)}{x-x_0}.$$ It is enough to prove that for some $\delta>0$ we have that $f'(x)\leq 0$ for $x\in (x_0,x_0+\delta).$ This is the point I am stuck.
Thank you in advance for the help!