Let $f:\mathbb R^n \mapsto \mathbb R$ be a differentiable function. Let us assume that the point $\bar x$ is a local minimum of the function f on every line passing through $\bar x$ what means that the function $g(\alpha) = f(\bar x + \alpha d)$ has a local minimum at the point $\alpha = 0$ for every $d\in \mathbb R^n$.
I need to show that $\nabla f(\bar x) = 0$ and come up with an example showing $\bar x$ does not have to be a local minimum of $f$. I got a hint to this one - let $f(x,y) = (y-px^2)(y-qx^2)$, where $(0<p<q)$. Show that $(0,0)$ is a local minimum of $f$ on every line passing through $(0,0)$.