Necessary condition for local maximum Let $\Omega\subset \mathbb{R}^n$ open, bounded and let $f:\Omega\to\mathbb{R}$ be a $C^2$-function.
I want to prove: Necessary for a interior maximum $x_0\in\Omega$ is that $D^2f(x_0)$ is negative semidefinite. 
I'm stuck, I want to know how to finish my proof.
First case: Suppose that $x_0\in \Omega$ is a maximum and $D^2f(x_0)$ is positive definite. This means, there is a nonzero vector $v$ such that $v^TD^2f(x_0)v>0$. Consider $g(t)=f(x_0+tv)$. $g$ has local minimum at $t=0$ which is a contradiction that $f$ has a maximum at $x_0$. Therefore $D^2f(x_0)$ can't be positive definite. 
Second Case: Suppose that $x_0\in \Omega$ is a maximum and $D^2f(x_0)$ is indefinite. This means the maximum $x_0$ is a saddle point too,  this is a contradiction.
I'm stuck on the third case. Suppose that $x_0\in \Omega$ is a maximum and $D^2f(x_0)$ is positive semidefinite. How do you get a contradiction here? 

It might be that there is no contradiction in the third case.
Namely, it can happen that $D^2f(x_0)$ is zero and therefore positive semidefinite and positive semidefinite.
You don't really have to work by cases.
A matrix $A$ being negative semidefinite means that for all $v$ you have $v^TAv\leq0$.
If this is not the case, then there is some $v$ for which $v^TAv>0$.
And you know how to get a contradiction from here.
