Maximal distance from a point to closed minimal submanifold 
Suppose $M$ is a complete connected manifold with sectional curvature satisfying $K \geq \frac{1}{r^2} > 0$ for some $r > 0$ and let $N \subset M$ be a closed minimal submanifold. Given $p \notin N$, show that
$$\operatorname{dist}(p, N) \leq \frac{\pi r}{2}$$

I know from Bonnet-Myers that $\operatorname{diam}(M) \leq \pi r$ and from a previows exercise I did, I also know there exists a point $q \in N$ and a geodesic $\gamma$ such that $\operatorname{dist}(p, N) = \operatorname{dist}(p, q) = \ell(\gamma)$ (where the latter denotes the length of $\gamma$). From there I can easily obtain the estimate $\operatorname{dist}(p, N) \leq \pi r$, but that's not enough. I also know this estimate is optimal (just take $M = \mathbb{S}^2$). But I don't know how to proceed any further than this now, can anyone help me? I'd really appreciate it. I'm not seeing where the "minimal" hypothesis must come in, I think if I knew any results that helped in that direction the exercise would be easier, but since I don't, I'm having a hard time trying to solve this.
Thinking about it some more, I think this might come as a consequence of the second variational formula for length. But I don't see how the minimality comes in there, I need to think of some way to relate the second fundamental form and the terms which appear in the second variational formula.
 A: I figured it out. It's actually pretty similar do do Carmo's proof of the Bonnet-Myers theorem.
Let $\gamma: [0, 1] \to M$ be a minimizing geodesic joining $p$ and $N$ (the existence of such a geodesic is a well known exercise) with length $\ell$, which we'll suppose by contradiction satisfies $2\ell > \pi r$. As a consequence of the second variation formula (see here, for instance) , for any orthogonal variation $h(t, s)$ of $\gamma$ with $h(0, s) = p$ and $h(1, s) \in N$, we have the following exprresion for the formula for the second variation
$$\frac{1}{2}E''(0) = \int_{0}^1(\|V'\|^2 - \langle R(\gamma', V)\gamma', V \rangle) \ \mathrm{d} t - \langle \alpha(V(0), V(0)), \gamma'(0) \rangle $$ where $V$ is the variational vector and $\alpha$ denotes the second fundamental form of $N$. This exercise (the one in the previous link) turns out to be pretty simple, and it's straightforward to check that the formula in the exercise I linked requires only that $V(0)$ and $V(\ell)$ be orthogonal to $\gamma'(0)$ and $\gamma'(\ell) $, respectively. The extra term in the calculations which appears if we don't require that condition, in our case (since the other submanifold is but a point), is $$\nabla^{(1)}_{\frac{\partial h}{\partial s}} \frac{\partial h}{\partial s} \text{      , denoted by $r$}$$ Consider parallel fields $e_1(t), \cdots, e_{n-1}(t)$ along $\gamma$ which are orthonormal for each $t \in [0, 1]$ and belong to the orthogonal complement of $\gamma'(t)$. Let $e_n(t) = \frac{\gamma'(t)}{\ell}$ and let $V_j$, for $1 \leq j \leq n - 1$ be a vector field along $\gamma$ given by $$V_{j}(t) = \cos\left(\frac{\pi}{2} t \right) e_j(t)$$
And let $V_n(t) \doteq e_n(t)$. The term $r$ in this case is $0$ because $\gamma$ is a geodesic, therefore the formula in the exercise I mentioned previously holds without any changes required. Consider now the $n$ variations of $\gamma$ generated by the vector fields $V_1, \cdots, V_n$. For $1 \leq i \leq n - 1$, we have:
$$\frac{1}{2} E_{i}''(0) = \int_{0}^{1} \left[ \frac{\pi^2}{4}\sin^2\left( \frac{\pi}{2}t \right) - \ell^2 \cos^2\left(\frac{\pi}{2} t \right) K_{\gamma(t)}(e_n(t), e_i(t))   \right] \mathrm{d} t - \langle \alpha(e_i(0), e_i(0)), \gamma'(0) \rangle$$
And for $i = n$, it's clear that $\frac{1}{2} E_{i}''(0) = -\alpha(e_n(0), e_n(0)), \gamma'(0) \rangle$. Therefore
$$\frac{1}{2} \sum_{i = 1}^{n} E_i''(0) = \int_{0}^{1} \left( (n-1) \frac{\pi^2}{4} \sin^2\left( \frac{\pi}{2}t \right) - \ell^2 \cos^2\left( \frac{\pi}{2}t \right) \operatorname{Ric}_{\gamma(t)}(e_n(t)) \right) \mathrm{d} t $$
Notice that we used the hypothesis of $N$ being minimal to ensure that $\sum_{i = 1}^{n} \alpha(e_i(0), e_i(0)) = 0$. Now, since $\sin^2\left( \frac{\pi}{2}t \right) = \cos^2\left( \frac{\pi}{2}t \right) - \cos(\pi t)$, $\int_{0}^{1} \cos( \pi t) = 0$ and by the hypotheses we have $\ell^2 \operatorname{Ric}_{\gamma(t)}(e_n(t)) > \frac{\pi^2}{4}$ (notice that I'm using do Carmo's definition for the curvatures), we conclude that:
$$\frac{1}{2} \sum_{i = 1}^{n} E_i''(0) = \int_{0}^{1} (n - 1)\cos^2\left( \frac{\pi}{2}t \right) \left(\frac{\pi^2}{4} - \ell^2 \operatorname{Ric}_{\gamma(t)}(e_n(t))\right) \ \mathrm{d} t < 0$$
which is absurd, because this would imply $E_{i}''(0) < 0$ for some $1 \leq i \leq n$ and this can't happen because $\gamma$ was taken as a minimizing geodesic. Hence $\ell < \frac{\pi r}{2}$, as desired.
