Suppose $\nabla$ is the Levi-Civita connection on Riemannian manifold $M$. $X$ be a vector fields on $M$ defined by $X=\nabla r$ where $r$ is the distance function to a fixed point in $M$. $\{e_1, \cdots, e_n\}$ be local orthnormal frame fields. We want to calculate $(|\nabla r|^2)_{kk}=\nabla_{e_k}\nabla_{e_k}|\nabla r|^2$. Let $$\nabla r=\sum r_i e_i$$ so $r_i=\nabla_{e_i}r$.
The standard calculation for tensor yields: $$(|X|^2)_{kk}=(\sum r_i^2)_{kk}\\ =2(\sum r_i r_{ik})_{k} \\ =2\sum r_{ik}r_{ik}+2\sum r_i r_{ikk} $$ My question is, how to switch the order of partial derivatives $r_{ikk}$ to $r_{kki}$. I know some curvature terms should apear, but I am very confused by this calculation.
My main concern is $r_i$ should be function, when exchange the partial derivatives Lie bracket will apear, how come the curvature term apears?
Anyone can help me with this basic calculations?
I don't think curvature terms should appear since $\nabla_{e_i} \nabla_{e_i} f = e_i \cdot e_i f$, where you think of the $e_i$ as first order differential operators. Then using your notation $$ r_{ikk} = e_k e_k e_i r = (e_k [e_k,e_i] + e_ke_i e_k) r = (e_k[e_k,e_i] + [e_k,e_i] e_k + e_ie_ke_k)r = (e_k[e_k,e_i] + [e_k,e_i] e_k)r + r_{kki}. $$ So $r_{ikk}$ differs from $r_{kki}$ by a second order term.