Differentiability in metric spaces

Solution 1:

Riemannian manifolds are the primary example of metric spaces which have a useful notion of differentiability, despite not necessarily being $\mathbb R^n$ or any kind of vector space. (One does not actually need the Riemannian structure to define derivatives; only the smooth structure is needed. But you asked about metric spaces, and general smooth manifolds do not have a preferred metric.)

One can push a bit of calculus into the realm of metric spaces that are not smooth manifolds. This subject (Analysis on metric spaces) gets pretty technical and axiomatic quickly, but there are strong recent results, with applications to other areas like embeddings of infinite graphs into normed spaces. A standard reference is the survey Nonsmooth calculus by Heinonen:

We survey recent advances in analysis and geometry, where first order differential analysis has been extended beyond its classical smooth settings. Such studies have applications to geometric rigidity questions, but are also of intrinsic interest. The transition from smooth spaces to singular spaces where calculus is possible parallels the classical development from smooth functions to functions with weak or generalized derivatives. Moreover, there is a new way of looking at the classical geometric theory of Sobolev functions that is useful in more general contexts.