I need to write a coordinate formula for $|df|^2$, where $f$ is a smooth function. This is in the context of Riemannian Geometry.
I know that $|X|^2$ can be written as $\langle X, X\rangle$, which is $g_{ij}X^iX^j$. However, what about $|df|^2$? Is this equal to $\langle \nabla f,\nabla f\rangle=g_{ij}(\nabla f)^i(\nabla f)^j$?
The Riemannian metric induces an isomorphism $g$ between each tangent and cotangent space, so you get an inner product on the cotangent space by pulling back the inner product on the tangent space: $$ \langle \theta_1, \theta_2\rangle_{T^*M} = \langle g(\theta), g(\theta)\rangle_{TM} $$
As in coordinates $g(\theta)^{i} = g^{ij}\theta_j$ and $\langle X, Y\rangle_{TM} = g_{ij}X^iY^j$ we have that $$ \langle \theta_1,\theta_2\rangle_{T^*M} = g_{ij}g^{ik}\theta_kg^{jl}\theta_l = g^{kl}\theta_k\theta_l $$ That is, multiply by the inverse of the local coordinate expression of the Riemannian metric.
I leave it to you to compute $|df|^2$.