The Lagrangian can be expressed in momentum space also, L ′(p, d p / dt, t), where p = (p 1, p 2,..., p n) is an n -tuple of the generalized momenta. A Legendre transformation is performed to change the variables in the total differential of the generalized coordinate space Lagrangian; d L = ∑ ∑ i = 1 n ( ∂ ∂ L ∂ ∂ q i d q i + ∂ ∂ L ∂ ∂ q ˙ ˙ i d q ˙ ˙ i ) + ∂ ∂ L ∂ ∂ t d t = ∑ ∑ i = 1 n ( p ˙ ˙ i d q i + p i d q ˙ ˙ i ) + ∂ ∂ L ∂ ∂ t d t , where the definition of generalized momentum and Euler–Lagrange equations have replaced the partial derivatives of L. The product rule for differentials allows the exchange of differentials in the generalized coordinates and velocities for the differentials in generalized momenta and their time derivatives, p ˙ ˙ i d q i = d ( q i p ˙ ˙ i ) − − q i d p ˙ ˙ i p i d q ˙ ˙ i = d ( q ˙ ˙ i p i ) − − q ˙ ˙ i d p i which after substitution simplifies and rearranges to d [ L − − ∑ ∑ i = 1 n ( q i p ˙ ˙ i + q ˙ ˙ i p i ) ] = − − ∑ ∑ i = 1 n ( q ˙ ˙ i d p i + q i d p ˙ ˙ i ) + ∂ ∂ L ∂ ∂ t d t .