A Riemannian metric \(g\) is a smooth positive-definite symmetric covariant \(2\)-tensor on a smooth manifold \(M\). In coordinates, \(g=g_{ij}\,dx^i\otimes dx^j\); write \((g^{ij})=(g_{ij})^{-1}\) and sum repeated upper and lower indices.
The Levi-Civita connection is the unique affine connection satisfying
\[\nabla_XY-\nabla_YX=[X,Y],\qquad X(g(Y,Z))=g(\nabla_XY,Z)+g(Y,\nabla_XZ).\]
Its coefficients are
\[\nabla_{\partial_i}\partial_j=\Gamma^k_{ij}\partial_k,\qquad \Gamma^k_{ij}=\frac12g^{k\ell} (\partial_i g_{j\ell}+\partial_j g_{i\ell}-\partial_\ell g_{ij}).\]
An affinely parametrized geodesic satisfies
\[\nabla_{\dot\gamma}\dot\gamma=0,\qquad \ddot x^k+\Gamma^k_{ij}\dot x^i\dot x^j=0.\]
Its speed is constant. Sufficiently short geodesic segments minimize length, but arbitrary segments need not: a long great-circle arc on a round sphere is a geodesic without being globally shortest.
\[R(X,Y)Z=\nabla_X\nabla_YZ-\nabla_Y\nabla_XZ-\nabla_{[X,Y]}Z,\qquad R^i{}_{jkl}=dx^i\bigl(R(\partial_k,\partial_l)\partial_j\bigr).\]
For a plane \(\sigma=\operatorname{span}\{X,Y\}\subset T_pM\) with \(X,Y\) independent,
\[K(\sigma)=\frac{g(R(X,Y)Y,X)} {g(X,X)g(Y,Y)-g(X,Y)^2}.\]
With this sign convention, Euclidean space has \(K=0\) and a round sphere of radius \(r\) has \(K=1/r^2\).
For a compact oriented Riemannian surface without boundary,
\[\int_M K\,dA=2\pi\chi(M).\]
For smooth boundary, the formula becomes \(\int_M K\,dA+\int_{\partial M}k_g\,ds=2\pi\chi(M)\), where \(k_g\) is signed geodesic curvature for the induced boundary orientation (positive for the boundary of a Euclidean disk). Piecewise-smooth boundaries require corner-angle terms as well.