A nonholonomic system is a system whose state depends on the path taken in order to achieve it. Such a system is described by a set of parameters subject to differential constraints, such that when the system evolves along a path in its parameter space (the parameters varying continuously in values) but finally returns to the original set of parameter values at the start of the path, the system itself may not have returned to its original state.

Return to computing page for the first course APMA0330
Return to computing page for the second course APMA0340
Return to Mathematica tutorial for the first course APMA0330
Return to Mathematica tutorial for the second course APMA0340
Return to the main page for the first course APMA0330
Return to the main page for the second course APMA0340
Introduction to Linear Algebra with Mathematica


Lagrange multipliers for n-dimensional case

Let \( f: \mathbb{R}^n \to \mathbb{R} \) and \( g: \mathbb{R}^n \to \mathbb{R} \) be smooth real-valued functions on the n-dimensional Eucledian space. The objective is to find a stationary point of f subject to the constraint
\[ g\left( x_1 , x_2 , \ldots , x_n \right) = c. \]
In calculus it is proved that stationary points for the function f under the constraint g = c can be found by introducing a new function
\[ h \left( x_1 , x_2 , \ldots , x_n \right) = f \left( x_1 , x_2 , \ldots , x_n \right) + \lambda\,g\left( x_1 , x_2 , \ldots , x_n \right) , \]
and then seek an unconstrained stationary point for h. The parameter λ is called a Lagrange multiplier.

Thus, we solve the equation \( \nabla f = 0 , \) which is equivalent to the system of algebraic equations

\[ \nabla \,f + \lambda\,\nabla \left( g - c \right) = 0 \qquad \mbox{or}\qquad \nabla \,f = \lambda\,\nabla \, g . \]
The value of Lagrange multiplier should be chosen to satisfy the constraint g = c.

Lagrange Multipliers

For nonholonomic systems, the generalized coordinates qi are not independent of each other and it is impossible to reduce them by means of constraint equations. However, if there are k constraints of the form \( \sum_{k=1}^{3n} A_{jk} \,\delta q_k =0 , \) where \( j =1,2,\ldots , k ; \) then Lagrange multipliers can be used to describe the constraints. The equations of motion that follow from these constraints are

\[ \frac{\text d}{{\text d}t} \left( \frac{\partial L}{\partial \dot{q}_i} \right) - \frac{\partial L}{\partial q_i} = Q_i = \sum_{i=1}^k \lambda_i A_{ij} \]
The k parameters λi are called Lagrange multipliers.

The Lagrange multiplier by itself has no physical meaning: it can be transformed into a new function of time just by rewriting the constraint equation into something physically equivalent.


Let us consider the general problem of finding the extremum of a functional
\[ T(y) = \int_{t_0}^t {\text d}t\, L\left( t, y, y' \right) , \]
subject to the constraint
\[ J(y) = \int_{t_0}^t {\text d}t\, f\left( t, y, y' \right) = c, \]
where c is a given real number. In order to find a stationary point for the functional T subject to the given constraint, we introduce a new functional
\[ K(y) = T(y) + \lambda\left( J(y) - c \right) , \]
and find the unconstrained stationary points for K.


Example: Let us consider the case of a block sliding down a fixed frictionless incline of angle θ. Obviously, the easiest approaches to this would be to either just write down Newton's 2nd law in a convenient coordinate system or to use the generalized coordinate q representing the distance traveled along the incline by the block and just writing down Lagrange's equations. For the second method, the choice of generalized coordinate q will implicitly take into account the constraint which is that the block must stay on the incline during the trajectory before reaching the ground. However, let's do this using the method of Lagrange multipliers.

Sliding and hanging weights on a ramp

Using x for the horizontal coordinate and y for the vertical coordinate, we can write out Lagrangian as \( L = \frac{1}{2}\, m\,\dot{x}^2 + \frac{1}{2}\, m\,\dot{y}^2 + mgy . \) However, the rectangular coordinates are not independent: they are related by the holonomic constraint \( g(x,y) = y - x\,\tan \theta . \) Setting \( L' = L- \lambda\,g , \) we apply Lagrange's second equation

\[ \frac{\text d}{{\text d}t} \left( \frac{\partial L'}{\partial \dot{q}_i} \right) - \frac{\partial L'}{\partial q_i} = 0 \qquad\mbox{or}\qquad \frac{\text d}{{\text d}t} \left( \frac{\partial L}{\partial \dot{q}_i} \right) - \frac{\partial L}{\partial q_i} = Q. \]
This yields
\[ \begin{split} m\,\ddot{x} = \lambda\,\tan\theta , \\ \lambda\,\cot\theta = mg\,\cot\theta - m\,\ddot{x} . \end{split} \]
So adding these two equations yields \( \lambda \,\sec^2 \theta = mg \) and we derive
\[ \lambda = \left( mg\,\cos\theta \right) \cos \theta . \]
Since \( N = mg\,\cos\theta , \) is the magnitude of the normal force on the block from the incline, then λ is the magnitude of the vertical component of the normal force and λ tanθ is the magnitude of the horizontal component of the normal force, as expected.

Now assume that there is a friction acting on mass m1, which we model as

\[ Q= -m_1 g\,\cos \theta \left( k_1 \mbox{sign}(x) + k_2 \dot{x} \right) . \]
We assume that both coefficients k1 and k2 are positive. When weight m1 slides down the ramp, the friction should act on it in opposite direction. Plugging all quantities into the Euler-Lagrange equations, we obtain the equation of motion with dissipation:
\[ \left( m_1 +m_2 \right) \ddot{x} = gm_1 \sin \theta - gm_2 - gm_1 \cos\theta \left( k_1 \mbox{sign}(x) + k_2 \dot{x} \right) . \]
If the constant friction term is too large, the weights would not move at all. So in order to allow movement, we have to assume that
\[ \left\vert k_1 \right\vert < \left\vert m_1 \tan \theta - \frac{m_2}{m_1 \cos\theta} \right\vert . \]


  1. J. R. Gaskill Jr. and M. Arenstein, Geometrical View of Lagrange Multipliers in Mechanics, Journal of Mathematical Physics, 8, Issue 9, 1912 (1967);
  2. Volkov, A. and Zubelevich, O., Lagrangian systems with non-smooth constraints, Glasgow Mathematical Journal, 2016, Vol. 59, No. 2, pp. 289--298; doi: 10.1017/S0017089516000173


Return to Mathematica page
Return to the main page (APMA0340)
Return to the Part 1 Matrix Algebra
Return to the Part 2 Linear Systems of Ordinary Differential Equations
Return to the Part 3 Non-linear Systems of Ordinary Differential Equations
Return to the Part 4 Numerical Methods
Return to the Part 5 Fourier Series
Return to the Part 6 Partial Differential Equations
Return to the Part 7 Special Functions