TITLE: Basic understanding of a metric.
QUESTION [8 upvotes]: What is a metric ? Do a metric depend on the system of coordinates I use ? Does it depend on surfaces (or higher dimensional manifolds. Correct me if I'm wrong using the word) the coordinate frames are chosen on ? Is there any general form for a metric? In this course it's mentioned Gauss pointed it out as restriction for an infinitesimal metric or distance function on surfaces to be
$$(dS)^2 = g_{xx} (x,y)(dx)^2 + g_{xy} (x,y)dxdy + g_{yy} (x,y)(dy)^2.$$ And is it that mentioned quadratic form restricted for a metric to look like a Euclidean metric $(ds)^2 = (dx)^2 + (dy)^2$ , is just a belief working in this comment of Gauss or is there any proper logical explanation to this ?

REPLY [7 votes]: $\newcommand{\Reals}{\mathbf{R}}$In the broad sense of your question, a "metric" is a means of quantifying "distance" between points in some "space" (or set) $M$.
One common axiomatic approach leads to the concept of a "topological metric", a function $d$ (for "distance") that assigns a positive real number $d(p, q)$ to each unordered pair of distinct points $p$ and $q$ in $M$, subject to the "triangle inequality", and to the condition $d(p, p) = 0$ for all $p$. This approach is described in multiple answers.
In 1854, Georg Bernhard Riemann gave his habilitation lecture Über die Hypothesen, welche der Geometrie zu Grunde liegen (see Item 13 on the linked page), in which he took an approach leading to the concept of metric in your question.
Suppose $M$ is a space that, near each point, "looks like" the $n$-dimensional Cartesian space. By "looks like", you should imagine that if $p$ is an arbitrary point of $M$, then a sufficiently small neighborhood $U$ of $p$ in $M$:

Is continuously coordinatized by $n$ real-valued functions (i.e., $U$ is homeomorphic to an open subset of $\Reals^{n}$).
There is a well-defined notion of differentiability. Loosely, if $(x^{1}, \dots, x^{n})$ and $(y^{1}, \dots, y^{n})$ are two different sets of coordinates near $p$, then an arbitrary real-valued function $f$ is smooth when expressed in the $x$ coordinates if and only if $f$ is smooth when expressed with respect to the $y$ coordinates. This is equivalent to saying the change of coordinates mapping from $x$ to $y$ is smooth, and invertible with smooth inverse.

Nowadays we call $M$ (together with a fixed notion of "differeitiability") an $n$-dimensional smooth manifold. Examples include Cartesian space itself and any non-empty open subset, spheres of arbitrary dimension (the "unit $n$-sphere" is the set of points at unit distance from the origin in $\Reals^{n+1}$), tori of arbitrary dimension, real or complex projective spaces, and regular level sets of smooth mappings.
Riemann's idea was, in essence, to assume the Pythagorean theorem holds infinitesimally, namely, that if $du$ and $dv$ are orthogonal infinitesimal displacements, then the magnitude of their sum is $ds = \sqrt{du^{2} + dv^{2}}$.
With modern hindsight, Riemann is equipping each "tangent space" of $M$ with an inner product, a real, symmetric, positive-definite bilinear form, now called a Riemannian metric. With respect to a coordinate system $(x^{1}, \dots, x^{n})$, a Riemannian metric and the associated length-squared function look like
$$
g = \sum_{i, j} g_{ij}\, dx^{i} \otimes dx^{j},\qquad
(ds)^{2} = \sum_{i, j} g_{ij}\, dx^{i} \, dx^{j}.
$$
(The Riemannian metric $g_{p}$ at a point $p$ accepts two tangent vectors and returns their inner product; the metric components $(g_{ij})$ are location-dependent matrix entries defining the inner product. The length-squared function is the associated quadratic form, $(ds)^{2}(v) = g(v, v)$.
A Riemannian metric is not the only "distance-inducing geometric structure" a manifold may possess. In addition to general topological metrics, there are, for example, Finsler manifolds, in which each tangent space is equipped with a norm function, and pseudo-Riemannian manifolds, as in general relativity, in which the inner product is not positive-definite.)
Riemannian geometry is the study of Riemannian manifolds, including questions such as

When are two Riemannian metrics isometric? (Loosely, when do two different coordinate representations determine "the same geometry"?) Even locally (in a neighborhood of a point) the question is non-trivial. Riemann showed that a Riemannian metric is locally isometric to the Euclidean metric $\sum_{i} (dx^{i})^{2}$ if and only if a certain fourth-order tensor vanishes.
Given a tangent vector $v_{p}$ at some point $p$ and a smooth path in $M$ joining $p$ to $q$, is there a "natural" notion of parallel transport along the path, yielding a tangent vector $v_{q}$ at $q$? (The answer is "yes", and the Riemann curvature tensor has the following geometric interpretation. Let $u$ and $v$ be tangent vectors at $p$. Parallel transport around a small (curvilinear) parallelogram with sides (approximately) parallel to $u$, $v$, $-u$, and $-v$ defines an orthogonal transformation of the tangent space $T_{p}M$, and the dependence turns out to be linear in $u$ and $v$. To say the curvature vanishes is to say that parallel transport around a small parallelogram is the identity transformation, as is the case in Euclidean geometry.)
Given two points $p$ and $q$ in a Riemannian manifold, does there exist a "shortest path" (technically, a length-minimizing geodesic) from $p$ to $q$? If so, is such a geodesic unique?

Locally, geodesics exist and are automatically length-minimizing, but globally they can fail to exist, or to minimize length, for geometric reasons. For example, if $M$ is the plane $\Reals^{2}$ with the origin removed, and if $g$ is the (restriction of) the Euclidean metric, then a point $p$ and its "opposite" $q = -p$ are not joined by a geodesic in $M$.
A Riemannian manifold is complete if every geodesic is defined for all time. (Loosely, no geodesic "encounters an edge of $M$ in finite time", or "$M$ has no edge".) Even in a complete Riemannian manifold, a sufficiently long geodesic can fail to be length-minimizing: Think of a great circle arc on a sphere subtending more than half of a "full turn".
A connected Riemannian manifold $(M, g)$ becomes a metric space (equipped with a topological metric) if, for points $p$ and $q$ of $M$, we define $d(p, q)$ to be the infimum of the lengths of piecewise-smooth curves from $p$ to $q$. When $M = \Reals^{n}$ and $g$ is the Euclidean (Riemannian) metric, the geodesics are line segments (parametrized at constant speed) and the topological distance reduces to the Euclidean (Pythagorean) distance. In general, however, a topological metric on a smooth manifold $M$ does not arise in this way from a Riemannian metric on $M$.