Find a metric so that a given submanifold is totally geodesic

Suppose $N$ is closed. Let $p:U\to N$ be a tubular neighborhood of $N$ in $M$. So $p:U\to N$ is a vector bundle. Now let $g_N$ be a Riemannian metric on $N$ and $g_U$ be a fiber metric on $U$, and let $\nabla$ be a linear connection on the vector bundle $p:U\to N$. Split $TU= V\oplus H$ into the vertical and horizontal bundle over $U$. Put $T(p)^*g_N$ on $H$, Put $g_U$ on $V$ via the affine structure, and declare $V$ an $H$ to be orthogonal everywhere. This gives you metric $\tilde g$ on $U$ so that $p$ is a Riemannian submersion by construction. Thus horizontal geodesics in $U$ project to geodesics of the same length in $N$, so $N$ is totally geodesic in $U$. Now use a partition of unity argument to get a metric on $M$ which equals $\tilde g$ near $N$.


I happened to think of an alternative proof long after this question was answered, but I decided to post it anyway now.

As mentioned in the comments, if $N$ is properly embedded and has trivial normal bundle then taking any product metric on a tubular neighborhood and extending with a partition of unity does the trick.

If the normal bundle $E$ of $N$ is nontrivial, let $E'$ be an inverse bundle so that $E \oplus E' \cong N \times \mathbb{R}^n$. Again giving $N\times \mathbb{R}^n$ any product metric renders $N\times \{0\}$ totally geodesic in $N \times \mathbb{R}^n$. A glance at the second fundamental form reveals that $N\times \{0\}$ is also totally geodesic in $E$ (identifying $E$ with its image in $N \times \mathbb{R}^n$). Now pull back the induced metric on $E$ to a tubular neighborhood $U$ of $N$, and extend to $M$ with a partition of unity.