We look here at an example, from the Italian mathematician Giuseppe Peano of a real function \(f\) defined on \(\mathbb{R}^2\). \(f\) is having a local minimum at the origin along all lines passing through the origin, however \(f\) does not have a local minimum at the origin as a function of two variables.
The function \(f\) is defined as follows
\[\begin{array}{l|rcl}
f : & \mathbb{R}^2 & \longrightarrow & \mathbb{R} \\
& (x,y) & \longmapsto & f(x,y)=3x^4-4x^2y+y^2 \end{array}\] One can notice that \(f(x, y) = (y-3x^2)(y-x^2)\). In particular, \(f\) is strictly negative on the open set \(U=\{(x,y) \in \mathbb{R}^2 \ : \ x^2 < y < 3x^2\}\), vanishes on the parabolas \(y=x^2\) and \(y=3 x^2\) and is strictly positive elsewhere.
Consider a line \(D\) passing through the origin. If \(D\) is different from the coordinate axes, the equation of \(D\) is \(y = \lambda x\) with \(\lambda > 0\). We have \[f(x, \lambda x)= x^2(\lambda-3x)(\lambda -x).\] For \(x \in (-\infty,\frac{\lambda}{3}) \setminus \{0\}\), \(f(x, \lambda x) > 0\) while \(f(0,0)=0\) which proves that \(f\) has a local minimum at the origin along the line \(D \equiv y – \lambda x=0\). Along the \(x\)-axis, we have \(f(x,0)=3 x^ 4\) which has a minimum at the origin. And finally, \(f\) also has a minimum at the origin along the \(y\)-axis as \(f(0,y)=y^2\).
However, along the parabola \(\mathcal{P} \equiv y = 2 x^2\) we have \(f(x,2 x^2)=-x^4\) which is strictly negative for \(x \neq 0\). As \(\mathcal{P}\) is passing through the origin, \(f\) assumes both positive and negative values in all neighborhood of the origin.
This proves that \(f\) does not have a minimum at \((0,0)\).