When one tries to find (local) minima of a function $f(x)$ under the constraint $g(x)=0$, the classical approach that is taught in analysis courses is to find the zeros of the gradient of the Lagrange function $$\mathcal{L}(x,\lambda) = f(x) - \lambda g(x).$$
Apparently, at a zero $x_0,\lambda_0$ of the gradient of $\mathcal{L}$ we have $$ \nabla_f(x_0) = \lambda_0 \nabla_g(x_0)$$ and $$g(x_0) =0 $$
such that in particular at this point our constraint is fulfilled. Now, however, I wondered how one would implement a gradient that flows up to this point of minimum, and in particular how one does that while staying on the manifold given by $g(x)=0$ at any point in time.
I initially thought that by simply doing
$$ \frac{d}{dt}\begin{pmatrix} x \\ \lambda \end{pmatrix} = \nabla \mathcal{L}(x,\lambda)$$
one would achieve this. However, it does not seem to be as obvious any more, since 1. the zeros of the lagrange function we are seeking are saddle points, not minima, and 2. if one plugs in $$ \frac{d}{dt} g(x(t))$$ this results in some set of equations that do not seem to indicate that we stay on the manifold.
So, my question is, what would an appropiate flow look like that stays on the manifold and approaches a minimum? I.e., looking for some set of equations
$$\frac{d}{dt}\begin{pmatrix} x \\ \lambda \end{pmatrix} = \begin{pmatrix} u(x,\lambda) \\ v(x,\lambda) \end{pmatrix} $$
such that in particular
$$ \frac{d}{dt} g(x(t)) = \nabla_g(x(t)) u(x(t),\lambda(t)) = 0$$
and a local minimum is a fixed point of the equations.