In mathematics, particularly differential geometry, a geodesic ( /ˌdʒiːɵˈdiːzɨk/ JEE-o-DEE-zik or /ˌdʒiːɵˈdɛsɨk/ JEE-o-DES-ik) is a generalization of the notion of a "straight line" to "curved spaces". In the presence of a Riemannian metric, geodesics are defined to be (locally) the shortest path between points in the space. In the presence of an affine connection, geodesics are defined to be curves whose tangent vectors remain parallel if they are transported along it.
The term "geodesic" comes from geodesy, the science of measuring the size and shape of Earth; in the original sense, a geodesic was the shortest route between two points on the Earth's surface, namely, a segment of a great circle. The term has been generalized to include measurements in much more general mathematical spaces; for example, in graph theory, one might consider a geodesic between two vertices/nodes of a graph.
Geodesics are of particular importance in general relativity, as they describe the motion of inertial test particles.