# 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.

• thank you for the answer. Do you mean, case 2 and three are not necessary? But if a matrix is not negativ semidefinit, the matrix could be positiv definite and positive semidefinite and indefinite. Why I don't have to exclude this cases, because the opposite of negative semidefinite is not only positive semidefinite, it could be indefinite as well? And if $D^2f(x_o)$ is zero, then $x_0$ isn't a maximum of f . This is a contradiction? – derivation Jul 5 '15 at 12:00
• It can happen that $x_0$ is a maximum but $D^2f(x_0)=0$. Consider $f(x)=-\|x\|^4$ and $x_0=0$. (You are looking for a necessary condition, not a sufficient one, right?) All you need to know is what it means for a symmetric matrix not to be negative semidefinite. It means that there is a $v$ with $v^TAv>0$. This is not the same as $A$ being positive definite! The problem with the classification to positive and negative semidefinite and indefinite matrices is that the zero matrix is in two classes. – Joonas Ilmavirta Jul 5 '15 at 12:05

You don't even have to argue by contradiction. Start from Taylor's formula at order $2$: \begin{align*} f(x_0+h,y_0+k)&=f(x_0,y_0)+Df(x_0,y_0)\cdot (h,k)+ \frac 12D^2f(x_0,y_0)\cdot (h,k)+o\bigl(\bigl\lVert(h,k)\bigr\rVert^2\bigr)\\ &=f(x_0,y_0)+ \frac 12D^2f(x_0,y_0)\cdot (h,k)+o\bigl(\bigl\lVert(h,k)\bigr\rVert^2\bigr) \end{align*} since at an interior local extremum, the linear form $Df(x_0,y_0)=0$.

Hence, if the quadratic form $D^2f(x_0,y_0)$ is positive semi-definite, $f(x_0+h,y_0+k)\ge f(x_0,y_0)\;$ in a small neighbourhood of $(x_0,y_0)$, i.e. we have a local minimum.

Similarly, if it is semi-definite negative $f(x_0+h,y_0+k)\le f(x_0,y_0)\;$ we have a local maximum.

Finally if the quadratic form is not semi-definite, we have a saddle point.