A metric is a distance on some surface. For example, in flat Cartesian space the metric is simply the straight line distance between two points. On a sphere it would be the distance between two points, as confined to lie along the surface of the sphere.
In the spacetime of special relativity the metric is defined as
You can think of the metric as the distance between points in spacetime.
Related to the metric is the very important idea of a metric tensor, which is usually represented by the symbol g, sometimes with the indicies explicitly shown (e.g. gab). The metric tensor is one of the most important concepts in relativity, since it is the metric which determines the distance between nearby points, and hence it specifies the geometry of a spacetime situation.
One can represent the metric tensor in terms of a matrix as show below. In 4D spacetime (whether flat or curved by the presence of masses) the metric tensor will have 16 elements. However, like all other tensors which you will experience in this course, the metric tensor is symmetric, so for example
. This means that there are 10 independent terms in the metric tensor.
Misner, Thorne and Wheeler have a unique way of picturing the metric tensor g as a two slot machine g (__, __). The precise numerical operation of the g machine depends on where you are on a surface (i.e. what the local curvature is). When one puts in the same vector, say u, into both slots of the g machine, one gets the square of the length of the vector u as an output. If one puts two different vectors u, v then the g machine gives the scalar (or dot) product of the two vectors u and v.
You might say so what is the big deal - it's just something to calculate the dot product of two vectors. The subtle difference is that in curved spacetime the "angle" between vectors depends on where you are in spacetime, and therefore g is a machine which operates differently at different spacetime points. Viewed backwards, if you know how to calculate the dot products of vectors everywhere, you must understand the curvature of the space (and therefore the g machine specifies the geometry). For this reason, the metric tensor enters into virtually every operation in general relativity (and some in special relativity).
There are a variety of techniques for determining the elements of g - see the reference by Martin below for one of the most clear explanations. In essence they involve taking a small differential displacement on a surface, and seeing how the various components of the vector space change. Alternatively, one can write the metric in whatever coordinate system one is using, and then read off the components for g (g elements will depend on coordinate system in use).
In the flat spacetime of special relativity, g is represented by the Minkowski metric tensor.
For further reading: