TITLE: Functions whose gradient-descent paths are geodesics
QUESTION [33 upvotes]: Let $f(x,y)$ define a surface $S$
in $\mathbb{R}^3$ with a unique local minimum at $b \in S$.
Suppose gradient descent from any start point $a \in S$
follows a geodesic on $S$ from $a$ to $b$.
(Q1.)
What is the class of functions/surfaces
whose gradient-descent paths are geodesics?
Certainly if $S$ is a surface of revolution
about a $z$-vertical line through $b$,
its "meridians"
are geodesics, and these would be the paths followed
by gradient descent down to $b$.
So the class of surfaces includes surfaces of
revolution.  But surely it is wider than that?
(Q2.)
One could ask the same question about paths followed by
Newton's method, which in general are different from gradient-descent
paths, as indicated in this Wikipedia image:
      

Gradient descent: green.
Newton's method: red.

(Q3.) These questions make sense in arbitrary dimensions,
although my primary interest is for surfaces in $\mathbb{R}^3$.
Any ideas on how to formulate my question as constraints on $f(\;)$,
or pointers to relevant literature,
would be appreciated.  Thanks!

REPLY [4 votes]: Here is a function $f(x,y)$ which is 0 inside the square $C=[\pm1,\pm1]$,
and outside that square
has value equal to the Euclidean distance $d( p, C )$ from $p=(x,y)$ to the boundary of $C$.
[I am trying to follow Pietro Majer's suggestion, as far as I understand it.]
It is not a surface of revolution
(but it is centrally symmetric).
Are its gradient descent paths geodesics?
I think so...



Left above: $f(x,y)$. Right above: Level sets of $f$.
Below: $\nabla f$.



And here (below) is a closeup of the function defined using squared distance
$[d( p, C )]^2$, as per Willie Wong's suggestion: