Recall that two Riemannian manifolds ${M,N}$ are isometric if there exists a diffeomorphism ${f: M \rightarrow N}$ that preserves the metric on the tangent spaces. The curvature tensor  (associated to the Levi-Civita connection) measures the deviation from flatness, where a manifold is flat if it is locally isometric to a neighborhood of ${\mathbb{R}^n}$.

Theorem 1 (The Test Case) The Riemannian manifold ${M}$ is locally isometric to ${\mathbb{R}^n}$ if and only if the curvature tensor vanishes.

One way is easy to check by computation.  We show that zero $R$ implies flatness.

First of all, note that on ${\mathbb{R}^n}$ with the usual metric (or an open submanifold thereof), there is a family of ${n}$ vector fields ${X_1, \dots, X_n}$ ( ${=\frac{\partial}{\partial x_1}, \dots, \frac{\partial}{\partial x_n}}$) which at each point form an orthonormal basis. Moreover, they commute. By contrast, if vector fields with this condition exist on a Riemannian manifold, then it is necessarily locally isometric to ${\mathbb{R}^n}$. For the commutation condition means that we can locally choose coordinates ${x_1, \dots, x_n}$ such that ${X_i = \frac{ \partial}{\partial x_i}}$. Then by orthonormality the metric must be given by ${\sum dx^i \otimes dx^i}$. So if ${R \equiv 0}$, we have to construct such vector fields. Pick ${p \in M}$ and ${(X_1)_p, (X_2)_p, \dots, (X_n)_p}$ forming an orthonormal basis for ${T_p(M)}$. I claim that these can be extended to vector fields ${X_1, \dots, X_n}$ as above. First of all, we may assume that as a manifold ${M}$ is an open subset of ${\mathbb{R}^n}$, just not necessarily with the standard metric, and that ${p=\mathbf{0}}$. Define ${X_1}$ first along the line ${x_2=\dots=x_n=0}$ by parallel translation of ${(X_1)_p}$ along the ${x_1}$-axis. Then define ${X_1(x_1, x_2, 0, 0 ,\dots, 0)}$ by starting with ${X_1(x_1,0,0,\dots,0)}$ and parallel translating along the line from ${(x_1,0, \dots, 0) \rightarrow (x_1, x_2, 0, \dots, 0).}$ Keep using parallel translation in this manner to make these into vector fields.

I claim now that ${\nabla_X X_1 \equiv 0}$ for all ${X}$. By linearity over smooth functions, it is sufficient to show the case of ${X = \frac{\partial}{\partial x_i}}$. We treat the case ${n=2}$. Then we already have $\displaystyle \frac{D}{\partial x_2} X_1 \equiv 0$

since ${X_1}$ was obtained by parallel translation along “vertical” lines and $\displaystyle \frac{D}{\partial x_1} X_1 = 0 \ \mathrm{on \ the \ line} \ x_2 = 0.$

Thus $\displaystyle \frac{D}{\partial x_2} \frac{D}{\partial x_1} X_1 = \frac{D}{\partial x_1} \frac{D}{\partial x_2} X_1 \equiv 0$

where we have used the Clairaut-like theorem for connections whose curvature tensor vanishes! Now this implies ${\frac{D}{\partial x_1} X_1}$ is parallel in ${x_2}$, hence identically zero because it vanishes on the horizontal line ${x_2=0}$. This proof can be extended to higher ${n}$.

We do the same for ${X_i}$ for ${i>1}$. Then the ${X_i}$ are orthonormal because parallel translation preserves inner products. I claim that ${[X_i,X_j]=0}$. To see this, note that $\displaystyle \nabla_{X_i} X_j - \nabla_{X_j} X_i - [X_i,X_j] = 0$

by symmetricity. Since the ${X_i}$ are parallel in every direction, we get ${[X_i,X_j]=0}$. Consequently the test case is proved.

(The term “test case” is borrowed from Michael Spivak.)