# Line element

In geometry, the line element or length element can be informally thought of as a line segment associated with an infinitesimal displacement vector in a metric space. The length of the line element, which may be thought of as a differential arc length, is a function of the metric tensor and is denoted by $ds$.
Line elements are used in physics, especially in theories of gravitation (most notably general relativity) where spacetime is modelled as a curved Pseudo-Riemannian manifold with an appropriate metric tensor.

## General formulation
### Definition of the line element and arc length

The coordinate-independent definition of the square of the line element ds in an n-dimensional Riemannian or Pseudo Riemannian manifold (in physics usually a Lorentzian manifold) is the "square of the length" of an infinitesimal displacement $d\mathbf {q}$ (in pseudo Riemannian manifolds possibly negative) whose square root should be used for computing curve length: $ds^{2}=d\mathbf {q} \cdot d\mathbf {q} =g(d\mathbf {q} ,d\mathbf {q} )$ where g is the metric tensor, · denotes inner product, and dq an infinitesimal displacement on the (pseudo) Riemannian manifold. By parametrizing a curve $\mathbf {q} (\lambda )$, we can define the arc length of the curve length of the curve between $\mathbf {q} _{1}=\mathbf {q} (\lambda _{1})$, and $\mathbf {q} _{2}=\mathbf {q} (\lambda _{2})$ as the integral: $s=\int _{\mathbf {q} _{1}}^{\mathbf {q} _{2}}{\sqrt {\left|ds^{2}\right|}}=\int _{\lambda _{1}}^{\lambda _{2}}d\lambda {\sqrt {\left|g\left({\frac {d\mathbf {q} }{d\lambda }},{\frac {d\mathbf {q} }{d\lambda }}\right)\right|}}=\int _{\lambda _{1}}^{\lambda _{2}}d\lambda {\sqrt {\left|g_{ij}{\frac {dq^{i}}{d\lambda }}{\frac {dq^{j}}{d\lambda }}\right|}}.$
To compute a sensible length of curves in pseudo Riemannian manifolds, it is best to assume that the infinitesimal displacements have the same sign everywhere. E.g. in physics the square of a line element along a timeline curve would (in the $-+++$ signature convention) be negative and the negative square root of the square of the line element along the curve would measure the proper time passing for an observer moving along the curve. From this point of view, the metric also defines in addition to line element the surface and volume elements etc.

### Identification of the square of the line element with the metric tensor

Since $d\mathbf {q}$ is an arbitrary "square of the arc length", $ds^{2}$ completely defines the metric, and it is therefore usually best to consider the expression for $ds^{2}$ as a definition of the metric tensor itself, written in a suggestive but non tensorial notation: $ds^{2}=g$ This identification of the square of arc length $ds^{2}$ with the metric is even more easy to see in n-dimensional general curvilinear coordinates q = (q$^1$, q$^2$, q$^3$, ..., q$^n$), where it is written as a symmetric rank 2 tensor coinciding with the metric tensor: $ds^{2}=g_{ij}dq^{i}dq^{j}=g.$
Here the indices i and j take values 1, 2, 3, ..., n and Einstein summation convention is used. Common examples of (pseudo) Riemannian spaces include three-dimensional space (no inclusion of time coordinates), and indeed four-dimensional spacetime.

## Line elements in Euclidean space

Following are examples of how the line elements are found from the metric.

### Cartesian coordinates

The simplest line element is in Cartesian coordinates - in which case the metric is just the Kronecker delta: $g_{ij}=\delta _{ij}$ (here i, j = 1, 2, 3 for space) or in matrix form (i denotes row, j denotes column): $[g_{ij}]={\begin{pmatrix}1&0&0\\0&1&0\\0&0&1\end{pmatrix}}$
The general curvilinear coordinates reduce to Cartesian coordinates: $(q^{1},q^{2},q^{3})=(x,y,z)\,\Rightarrow \,d\mathbf {r} =(dx,dy,dz)$ so $ds^{2}=g_{ij}dq^{i}dq^{j}=dx^{2}+dy^{2}+dz^{2}$

### Orthogonal curvilinear coordinates

For all orthogonal coordinates the metric is given by: $[g_{ij}]={\begin{pmatrix}h_{1}^{2}&0&0\\0&h_{2}^{2}&0\\0&0&h_{3}^{2}\end{pmatrix}}$ where $h_{i}=\left|{\frac {\partial \mathbf {r} }{\partial q^{i}}}\right|$
for i = 1, 2, 3 are scale factors, so the square of the line element is: $ds^{2}=h_{1}^{2}(dq^{1})^{2}+h_{2}^{2}(dq^{2})^{2}+h_{3}^{2}(dq^{3})^{2}$
Some examples of line elements in these coordinates are below.
| Coordinate system | (q$^1$, q$^2$, q$^3$) | Metric | Line element |
| Cartesian | (x, y, z) | $[g_{ij}]={\begin{pmatrix}1&0&0\\0&1&0\\0&0&1\\\end{pmatrix}}$ | $ds^{2}=dx^{2}+dy^{2}+dz^{2}$ |
| Plane polars | (r, θ) | $[g_{ij}]={\begin{pmatrix}1&0\\0&r^{2}\\\end{pmatrix}}$ | $ds^{2}=dr^{2}+r^{2}d\theta ^{2}$ |
| Spherical polars | (r, θ, φ) | $[g_{ij}]={\begin{pmatrix}1&0&0\\0&r^{2}&0\\0&0&r^{2}\sin ^{2}\theta \\\end{pmatrix}}$ | $ds^{2}=dr^{2}+r^{2}d\theta \ ^{2}+r^{2}\sin ^{2}\theta d\varphi ^{2}$ |
| Cylindrical polars | (r, φ, z) | $[g_{ij}]={\begin{pmatrix}1&0&0\\0&r^{2}&0\\0&0&1\\\end{pmatrix}}$ | $ds^{2}=dr^{2}+r^{2}d\varphi ^{2}+dz^{2}$ |

## General curvilinear coordinates

Given an arbitrary basis $\{{\hat {b}}_{i}\}$ of a space of dimension $n$, the metric is defined as the inner product of the basis vectors. $g_{ij}=\langle {\hat {b}}_{i},{\hat {b}}_{j}\rangle$
Where $1\leq i,j\leq n$ and the inner product is with respect to the ambient space (usually its $\delta _{ij}$)
In a coordinate basis ${\hat {b}}_{i}={\frac {\partial }{\partial x^{i}}}$
The coordinate basis is a special type of basis that is regularly used in differential geometry.

## Line elements in 4d spacetime
### Minkowski spacetime

The Minkowski metric is: $[g_{ij}]=\pm {\begin{pmatrix}1&0&0&0\\0&-1&0&0\\0&0&-1&0\\0&0&0&-1\\\end{pmatrix}}$ where one sign or the other is chosen, both conventions are used. This applies only for flat spacetime. The coordinates are given by the 4-position: $\mathbf {x} =(x^{0},x^{1},x^{2},x^{3})=(ct,\mathbf {r} )\,\Rightarrow \,d\mathbf {x} =(cdt,d\mathbf {r} )$
so the line element is: $ds^{2}=\pm (c^{2}dt^{2}-d\mathbf {r} \cdot d\mathbf {r} ).$

### Schwarzschild coordinates

In Schwarzschild coordinates coordinates are $\left(t,r,\theta ,\phi \right)$, being the general metric of the form: $[g_{ij}]={\begin{pmatrix}-a(r)^{2}&0&0&0\\0&b(r)^{2}&0&0\\0&0&r^{2}&0\\0&0&0&r^{2}\sin ^{2}\theta \\\end{pmatrix}}$
(note the similitudes with the metric in 3D spherical polar coordinates).
so the line element is: $ds^{2}=-a(r)^{2}\,dt^{2}+b(r)^{2}\,dr^{2}+r^{2}\,d\theta ^{2}+r^{2}\sin ^{2}\theta \,d\phi ^{2}.$

### General spacetime

The coordinate-independent definition of the square of the line element ds in spacetime is: $ds^{2}=d\mathbf {x} \cdot d\mathbf {x} =g(d\mathbf {x} ,d\mathbf {x} )$
In terms of coordinates: $ds^{2}=g_{\alpha \beta }dx^{\alpha }dx^{\beta }$ where for this case the indices α and β run over 0, 1, 2, 3 for spacetime.
This is the spacetime interval - the measure of separation between two arbitrarily close events in spacetime. In special relativity it is invariant under Lorentz transformations. In general relativity it is invariant under arbitrary invertible differentiable coordinate transformations.