Generalized coordinates

In analytical mechanics, generalized coordinates are a set of parameters used to represent the state of a system in a configuration space. These parameters must uniquely define the configuration of the system relative to a reference state. The generalized velocities are the time derivatives of the generalized coordinates of the system. The adjective "generalized" distinguishes these parameters from the traditional use of the term "coordinate" to refer to Cartesian coordinates.

An example of a generalized coordinate would be to describe the position of a pendulum using the angle of the pendulum relative to vertical, rather than by the x and y position of the pendulum.

Although there may be many possible choices for generalized coordinates for a physical system, they are generally selected to simplify calculations, such as the solution of the equations of motion for the system. If the coordinates are independent of one another, the number of independent generalized coordinates is defined by the number of degrees of freedom of the system.

Generalized coordinates are paired with generalized momenta to provide canonical coordinates on phase space.

Constraints and degrees of freedom
Generalized coordinates are usually selected to provide the minimum number of independent coordinates that define the configuration of a system, which simplifies the formulation of Lagrange's equations of motion. However, it can also occur that a useful set of generalized coordinates may be dependent, which means that they are related by one or more constraint equations.

Holonomic constraints
For a system of $s$ particles in 3D real coordinate space, the position vector of each particle can be written as a 3-tuple in Cartesian coordinates:


 * $$\begin{align}

& \mathbf{r}_1 = (x_1,y_1,z_1), \\ & \mathbf{r}_2 = (x_2,y_2,z_2), \\ & \qquad \qquad \vdots \\ & \mathbf{r}_N = (x_N,y_N,z_N) \end{align}$$

Any of the position vectors can be denoted $F(x, y) = 0$ where $C(x, y) = 0$ labels the particles. A holonomic constraint is a constraint equation of the form for particle $θ$


 * $$f(\mathbf{r}_k, t) = 0$$

which connects all the 3 spatial coordinates of that particle together, so they are not independent. The constraint may change with time, so time $x$ will appear explicitly in the constraint equations. At any instant of time, any one coordinate will be determined from the other coordinates, e.g. if $y$ and $s$ are given, then so is $θ$. One constraint equation counts as one constraint. If there are $s$ constraints, each has an equation, so there will be $θ$ constraint equations. There is not necessarily one constraint equation for each particle, and if there are no constraints on the system then there are no constraint equations.

So far, the configuration of the system is defined by $(x, y)$ quantities, but $θ$ coordinates can be eliminated, one coordinate from each constraint equation. The number of independent coordinates is $F(x, y) = 0$. (In $N$ dimensions, the original configuration would need $k$ coordinates, and the reduction by constraints means $C(x, y) = 0$). It is ideal to use the minimum number of coordinates needed to define the configuration of the entire system, while taking advantage of the constraints on the system. These quantities are known as generalized coordinates in this context, denoted $F(x, y, z) = 0$. It is convenient to collect them into an $t$-tuple


 * $$\mathbf{q}(t) = (q_1(t),\ q_2(t),\ \ldots,\ q_n(t)) $$

which is a point in the configuration space of the system. They are all independent of one other, and each is a function of time. Geometrically they can be lengths along straight lines, or arc lengths along curves, or angles; not necessarily Cartesian coordinates or other standard orthogonal coordinates. There is one for each degree of freedom, so the number of generalized coordinates equals the number of degrees of freedom, $xk$. A degree of freedom corresponds to one quantity that changes the configuration of the system, for example the angle of a pendulum, or the arc length traversed by a bead along a wire.

If it is possible to find from the constraints as many independent variables as there are degrees of freedom, these can be used as generalized coordinates. The position vector $S(x, y, z) = 0$ of particle $zk$ is a function of all the $yk$ generalized coordinates (and, through them, of time),


 * $$\mathbf{r}_k = \mathbf{r}_k(\mathbf{q}(t)) \,, $$

and the generalized coordinates can be thought of as parameters associated with the constraint.

The corresponding time derivatives of $(u, v)$ are the generalized velocities,


 * $$\dot{\mathbf{q}} = \frac{d\mathbf{q}}{dt} = (\dot{q}_1(t),\ \dot{q}_2(t),\ \ldots,\ \dot{q}_n(t)) $$

(each dot over a quantity indicates one time derivative). The velocity vector $(x, y, z)$ is the total derivative of $rk$ with respect to time


 * $$\mathbf{v}_k = \dot{\mathbf{r}}_k = \frac{d\mathbf{r}_k}{dt} = \sum_{j=1}^n \frac{\partial \mathbf{r}_k}{\partial q_j}\dot{q}_j \,.$$

and so generally depends on the generalized velocities and coordinates. Since we are free to specify the initial values of the generalized coordinates and velocities separately, the generalized coordinates $C$ and velocities $k = 1, 2, …, N$ can be treated as independent variables.

Non-holonomic constraints
A mechanical system can involve constraints on both the generalized coordinates and their derivatives. Constraints of this type are known as non-holonomic. First-order non-holonomic constraints have the form


 * $$g(\mathbf{q}, \dot{\mathbf{q}}, t) = 0\,,$$

An example of such a constraint is a rolling wheel or knife-edge that constrains the direction of the velocity vector. Non-holonomic constraints can also involve next-order derivatives such as generalized accelerations.

Kinetic energy
The total kinetic energy of the system is the energy of the system's motion, defined as


 * $$T = \frac {1}{2} \sum_{k=1}^N m_k \dot{\mathbf{r}}_k \cdot \dot{\mathbf{r}}_k\,,$$

in which · is the dot product. The kinetic energy is a function only of the velocities $3N$, not the coordinates $n = 3N − C$ themselves. By contrast an important observation is


 * $$\dot{\mathbf{r}}_k \cdot \dot{\mathbf{r}}_k = \sum_{i,j=1}^n \left(\frac{\partial \mathbf{r}_k}{\partial q_i}\cdot\frac{\partial \mathbf{r}_k}{\partial q_j}\right)\dot{q}_i\dot{q}_j, $$

which illustrates the kinetic energy is in general a function of the generalized velocities, coordinates, and time if the constraints also vary with time, so $n = ND − C$.

In the case the constraints on the particles are time-independent, then all partial derivatives with respect to time are zero, and the kinetic energy is a homogeneous function of degree 2 in the generalized velocities.

Still for the time-independent case, this expression is equivalent to taking the line element squared of the trajectory for particle $C$,


 * $$ds_k^2 = d\mathbf{r}_k\cdot d\mathbf{r}_k = \sum_{i,j=1}^n \left(\frac{\partial \mathbf{r}_k}{\partial q_i}\cdot\frac{\partial \mathbf{r}_k}{\partial q_j}\right) dq_i dq_j \,,$$

and dividing by the square differential in time, $qj(t)$, to obtain the velocity squared of particle $C$. Thus for time-independent constraints it is sufficient to know the line element to quickly obtain the kinetic energy of particles and hence the Lagrangian.

It is instructive to see the various cases of polar coordinates in 2D and 3D, owing to their frequent appearance. In 2D polar coordinates $rk$,


 * $$\left(\frac{ds}{dt}\right)^2 = \dot{r}^2 + r^2\dot{\theta}^2 \,,$$

in 3D cylindrical coordinates $q$,


 * $$\left(\frac{ds}{dt}\right)^2 = \dot{r}^2 + r^2\dot{\theta}^2 + \dot{z}^2 \,,$$

in 3D spherical coordinates $vk$,


 * $$\left(\frac{ds}{dt}\right)^2 = \dot{r}^2+r^2\dot{\theta}^2 +r^2\sin^2\theta \, \dot{\varphi}^2 \,.$$

Generalized momentum
The generalized momentum "canonically conjugate to" the coordinate $D$ is defined by


 * $$p_i =\frac{\partial L}{\partial\dot q_i}.$$

If the Lagrangian $ND$ does not depend on some coordinate $n$, then it follows from the Euler–Lagrange equations that the corresponding generalized momentum will be a conserved quantity, because the time derivative is zero implying the momentum is a constant of the motion;


 * $$ \frac{\partial L}{\partial q_i} =\frac{d}{dt}\frac{\partial L}{\partial\dot q_i} =\dot{p}_i =0\,.$$

Bead on a wire


For a bead sliding on a frictionless wire subject only to gravity in 2d space, the constraint on the bead can be stated in the form $rk$, where the position of the bead can be written $dqj/dt$, in which $n$ is a parameter, the arc length $k$ along the curve from some point on the wire. This is a suitable choice of generalized coordinate for the system. Only one coordinate is needed instead of two, because the position of the bead can be parameterized by one number, $n$, and the constraint equation connects the two coordinates $k$ and $qj$; either one is determined from the other. The constraint force is the reaction force the wire exerts on the bead to keep it on the wire, and the non-constraint applied force is gravity acting on the bead.

Suppose the wire changes its shape with time, by flexing. Then the constraint equation and position of the particle are respectively


 * $$f(\mathbf{r}, t) = 0 \,,\quad \mathbf{r} = (x(s, t), y(s, t))$$

which now both depend on time $k$ due to the changing coordinates as the wire changes its shape. Notice time appears implicitly via the coordinates and explicitly in the constraint equations.

Simple pendulum


The relationship between the use of generalized coordinates and Cartesian coordinates to characterize the movement of a mechanical system can be illustrated by considering the constrained dynamics of a simple pendulum.

A simple pendulum consists of a mass $k$ hanging from a pivot point so that it is constrained to move on a circle of radius $qi$. The position of the mass is defined by the coordinate vector $vk$ measured in the plane of the circle such that $L$ is in the vertical direction. The coordinates $qi$ and $s$ are related by the equation of the circle
 * $$f(x, y) = x^2+y^2 - L^2=0,$$

that constrains the movement of $s$. This equation also provides a constraint on the velocity components,
 * $$ \dot{f}(x, y)=2x\dot{x} + 2y\dot{y} = 0.$$

Now introduce the parameter $s$, that defines the angular position of $x$ from the vertical direction. It can be used to define the coordinates $y$ and $t$, such that
 * $$ \mathbf{r}=(x, y) = (L\sin\theta, -L\cos\theta).$$

The use of $M$ to define the configuration of this system avoids the constraint provided by the equation of the circle.

Notice that the force of gravity acting on the mass $L$ is formulated in the usual Cartesian coordinates,
 * $$ \mathbf{F}=(0,-mg),$$

where $y$ is the acceleration due to gravity.

The virtual work of gravity on the mass $x$ as it follows the trajectory $rk$ is given by
 * $$ \delta W = \mathbf{F}\cdot\delta \mathbf{r}.$$

The variation $T = T(q, dq/dt, t)$ can be computed in terms of the coordinates $y$ and $M$, or in terms of the parameter $θ$,
 * $$ \delta \mathbf{r} =(\delta x, \delta y) = (L\cos\theta, L\sin\theta)\delta\theta.$$

Thus, the virtual work is given by
 * $$\delta W = -mg\delta y = -mgL\sin(\theta)\delta\theta.$$

Notice that the coefficient of $dt2$ is the $M$-component of the applied force. In the same way, the coefficient of $(r, θ)$ is known as the generalized force along generalized coordinate $x$, given by
 * $$ F_{\theta} = -mgL\sin\theta.$$

To complete the analysis consider the kinetic energy $y$ of the mass, using the velocity,
 * $$ \mathbf{v}=(\dot{x}, \dot{y}) = (L\cos\theta, L\sin\theta)\dot{\theta},$$

so,
 * $$ T= \frac{1}{2} m\mathbf{v}\cdot\mathbf{v} = \frac{1}{2} m (\dot{x}^2+\dot{y}^2) = \frac{1}{2} m L^2\dot{\theta}^2.$$

D'Alembert's form of the principle of virtual work for the pendulum in terms of the coordinates $θ$ and $m$ are given by,
 * $$ \frac{d}{dt}\frac{\partial T}{\partial \dot{x}} - \frac{\partial T}{\partial x} = F_{x} + \lambda \frac{\partial f}{\partial x},\quad \frac{d}{dt}\frac{\partial T}{\partial \dot{y}} - \frac{\partial T}{\partial y} = F_{y} + \lambda \frac{\partial f}{\partial y}. $$

This yields the three equations
 * $$m\ddot{x} = \lambda(2x),\quad m\ddot{y} = -mg + \lambda(2y),\quad x^2+y^2 - L^2=0,$$

in the three unknowns, $g$, $m$ and $x$.

Using the parameter $y$, those equations take the form
 * $$\frac{d}{dt}\frac{\partial T}{\partial \dot{\theta}} - \frac{\partial T}{\partial \theta} = F_{\theta},$$

which becomes,
 * $$ mL^2\ddot{\theta} = -mgL\sin\theta,$$

or
 * $$ \ddot{\theta} + \frac{g}{L}\sin\theta=0.$$

This formulation yields one equation because there is a single parameter and no constraint equation.

This shows that the parameter $θ$ is a generalized coordinate that can be used in the same way as the Cartesian coordinates $y$ and $θ$ to analyze the pendulum.

Double pendulum
The benefits of generalized coordinates become apparent with the analysis of a double pendulum. For the two masses $(r, θ, z)$, let $(r, θ, φ)$ define their two trajectories. These vectors satisfy the two constraint equations,
 * $$f_1 (x_1, y_1, x_2, y_2) = \mathbf{r}_1\cdot \mathbf{r}_1 - L_1^2 = 0$$

and
 * $$f_2 (x_1, y_1, x_2, y_2) = (\mathbf{r}_2-\mathbf{r}_1) \cdot (\mathbf{r}_2-\mathbf{r}_1) - L_2^2 = 0.$$

The formulation of Lagrange's equations for this system yields six equations in the four Cartesian coordinates $C$ and the two Lagrange multipliers $N$ that arise from the two constraint equations.

Now introduce the generalized coordinates $f (r) = 0$ that define the angular position of each mass of the double pendulum from the vertical direction. In this case, we have
 * $$\mathbf{r}_1 = (L_1\sin\theta_1, -L_1\cos\theta_1), \quad \mathbf{r}_2 = (L_1\sin\theta_1, -L_1\cos\theta_1) + (L_2\sin\theta_2, -L_2\cos\theta_2).$$

The force of gravity acting on the masses is given by,
 * $$\mathbf{F}_1=(0,-m_1 g),\quad \mathbf{F}_2=(0,-m_2 g)$$

where $T$ is the acceleration due to gravity. Therefore, the virtual work of gravity on the two masses as they follow the trajectories $r = (x(s), y(s))$ is given by
 * $$ \delta W = \mathbf{F}_1\cdot\delta \mathbf{r}_1 + \mathbf{F}_2\cdot\delta \mathbf{r}_2.$$

The variations $f (x, y) = 0$ can be computed to be
 * $$ \delta \mathbf{r}_1 = (L_1\cos\theta_1, L_1\sin\theta_1)\delta\theta_1, \quad \delta \mathbf{r}_2 = (L_1\cos\theta_1, L_1\sin\theta_1)\delta\theta_1 +(L_2\cos\theta_2, L_2\sin\theta_2)\delta\theta_2$$

Thus, the virtual work is given by
 * $$\delta W = -(m_1+m_2)gL_1\sin\theta_1\delta\theta_1 - m_2gL_2\sin\theta_2\delta\theta_2,$$

and the generalized forces are
 * $$F_{\theta_1} = -(m_1+m_2)gL_1\sin\theta_1,\quad F_{\theta_2} =  -m_2gL_2\sin\theta_2.$$

Compute the kinetic energy of this system to be
 * $$ T= \frac{1}{2}m_1 \mathbf{v}_1\cdot\mathbf{v}_1 + \frac{1}{2}m_2 \mathbf{v}_2\cdot\mathbf{v}_2 = \frac{1}{2}(m_1+m_2)L_1^2\dot{\theta}_1^2 + \frac{1}{2}m_2L_2^2\dot{\theta}_2^2 + m_2L_1L_2 \cos(\theta_2-\theta_1)\dot{\theta}_1\dot{\theta}_2.$$

Euler–Lagrange equation yield two equations in the unknown generalized coordinates $C$ given by
 * $$(m_1+m_2)L_1^2\ddot{\theta}_1+m_2L_1L_2\ddot{\theta}_2\cos(\theta_2-\theta_1) + m_2L_1L_2\dot{\theta_2}^2\sin(\theta_1-\theta_2) = -(m_1+m_2)gL_1\sin\theta_1,$$

and
 * $$m_2L_2^2\ddot{\theta}_2+m_2L_1L_2\ddot{\theta}_1\cos(\theta_2-\theta_1) + m_2L_1L_2\dot{\theta_1}^2\sin(\theta_2-\theta_1)=-m_2gL_2\sin\theta_2.$$

The use of the generalized coordinates $N$ provides an alternative to the Cartesian formulation of the dynamics of the double pendulum.

Spherical pendulum


For a 3D example, a spherical pendulum with constant length $x$ free to swing in any angular direction subject to gravity, the constraint on the pendulum bob can be stated in the form


 * $$f(\mathbf{r}) = x^2 + y^2 + z^2 - l^2 = 0 \,, $$

where the position of the pendulum bob can be written


 * $$\mathbf{r} = (x(\theta,\phi),y(\theta,\phi),z(\theta,\phi)) \,, $$

in which $r = (x, y)$ are the spherical polar angles because the bob moves in the surface of a sphere. The position $r$ is measured along the suspension point to the bob, here treated as a point particle. A logical choice of generalized coordinates to describe the motion are the angles $δr$. Only two coordinates are needed instead of three, because the position of the bob can be parameterized by two numbers, and the constraint equation connects the three coordinates $δy$ so any one of them is determined from the other two.

Generalized coordinates and virtual work
The principle of virtual work states that if a system is in static equilibrium, the virtual work of the applied forces is zero for all virtual movements of the system from this state, that is, $δθ$ for any variation $mi (i = 1, 2)$. When formulated in terms of generalized coordinates, this is equivalent to the requirement that the generalized forces for any virtual displacement are zero, that is $ri = (xi, yi), i = 1, 2$.

Let the forces on the system be $xi, yi (i = 1, 2)$ be applied to points with Cartesian coordinates $λi (i = 1, 2)$, then the virtual work generated by a virtual displacement from the equilibrium position is given by
 * $$\delta W = \sum_{j=1}^m \mathbf{F}_j\cdot \delta\mathbf{r}_j.$$

where $θi (i = 1, 2)$ denote the virtual displacements of each point in the body.

Now assume that each $ri (i = 1, 2)$ depends on the generalized coordinates $δri (i = 1, 2)$ then
 * $$ \delta \mathbf{r}_j = \frac{\partial \mathbf{r}_j}{\partial q_1} \delta{q}_1 + \ldots + \frac{\partial \mathbf{r}_j}{\partial q_n} \delta{q}_n,$$

and
 * $$ \delta W = \left(\sum_{j=1}^m \mathbf{F}_j\cdot \frac{\partial \mathbf{r}_j}{\partial q_1}\right) \delta{q}_1 + \ldots + \left(\sum_{j=1}^m \mathbf{F}_j\cdot \frac{\partial \mathbf{r}_j}{\partial q_n}\right) \delta{q}_n. $$

The $y$ terms
 * $$ F_i = \sum_{j=1}^m \mathbf{F}_j\cdot \frac{\partial \mathbf{r}_j}{\partial q_i},\quad i=1,\ldots, n,$$

are the generalized forces acting on the system. Kane shows that these generalized forces can also be formulated in terms of the ratio of time derivatives,
 * $$ F_i = \sum_{j=1}^m \mathbf{F}_j\cdot \frac{\partial \mathbf{v}_j}{\partial \dot{q}_i},\quad i=1,\ldots, n,$$

where $θi (i = 1, 2)$ is the velocity of the point of application of the force $θi (i = 1, 2)$.

In order for the virtual work to be zero for an arbitrary virtual displacement, each of the generalized forces must be zero, that is
 * $$ \delta W = 0 \quad \Rightarrow \quad F_i =0, i=1,\ldots, n.$$