Enoncé 
Déterminer les extrema locaux de $f:\mathbb R^3\to\mathbb R,$ $(x,y,z)\mapsto x^2+y^2+z^2+xy+xz+yz-4(x+y+z)$.
Corrigé 
On commence par rechercher les points critiques de $f.$ Pour cela, on calcule les dérivées partielles et on trouve, pour tout $(x,y,z)\in\mathbb R^3,$
$$\frac{\partial f}{\partial x}(x,y,z)=2x+y+z-4,\ \frac{\partial f}{\partial y}(x,y,z)=2y+x+z-4, \frac{\partial f}{\partial z}(x,y,z)=2z+x+y-4.$$
On résout le système
$$\left\{\begin{array}{rcl}
2x+y+z-4&=&0\\
x+2y+z-4&=&0\\
x+y+2z-4&=&0.
\end{array}\right.
$$
En faisant $(L1)-(L2)$ puis $(L2)-(L3),$ on trouve $x=y=z,$ et finalement le seul point critique est $(1,1,1)$. Pour déterminer la nature de $(1,1,1)$, on va étudier la matrice hessienne de $f$. Pour cela, on observe que, pour tout $(x,y,z)\in\mathbb R^3,$
$$\frac{\partial^2 f}{\partial x^2}=\frac{\partial^2 f}{\partial y^2}=\frac{\partial^2 f}{\partial z^2}=2$$
$$\frac{\partial^2 f}{\partial x\partial y}=\frac{\partial^2 f}{\partial x\partial z}=\frac{\partial^2 f}{\partial y\partial z}=1.$$
La matrice hessienne de $f$ en $(1,1,1)$ est donc
$$M=\begin{pmatrix}
2&1&1\\
1&2&1\\
1&1&2
\end{pmatrix}.$$
On cherche les valeurs propres de $M.$ Un calcul simple donne
$$\chi_M(\lambda)=(\lambda-4)(\lambda-1)^2.$$
Les valeurs propres de $M$ sont strictement positives, donc $M$ est définie positive, et $f$ admet un minimum local strict en $(1,1,1)$.