What are holonomic and non-holonomic constraints? I was reading Herbert Goldstein's Classical Mechanics. Its first chapter explains holonomic and non-holonomic constraints, but I still don’t understand the underlying concept. Can anyone explain it to me in detail and in simple language?
 A: A holonomic constraint is a constraint that places a definite relationship between the coordinates you're using.  For example, consider a cylinder of radius $R$ rolling along a table in 1-D.  The system can be described by a coordinate $x$, denoting the position of the cylinder, and a coordinate $\theta$, describing the angle of rotation of the cylinder.  If the cylinder is rolling without slipping, though, then for every infinitesimal distance  $dx$ the cylinder moves, it must move a distance $d\theta $ given by
$$
d\theta  = \frac{d x}{R} \quad \Rightarrow \quad dx - R d \theta = 0.
$$
But this equation can be integrated to yield
$$
f(x, \theta) = x - R \theta = 0.
$$
Since the constraint can be integrated (i.e. the differential constraint in the first equation is equivalent to saying that $df = 0$ for some function $f$ of the coordinates), then this constraint is holonomic.  Frequently, when writing down such a constraint, we'll just skip the step with the infinitesimal coordinate changes and simply write down a relationship $f(q_i) = C$ between the coordinates $q_i$.  Note that this also implies that $x$ determines $\theta$:  if I know where the cylinder is along the table, I know what its angular orientation is, because  given a value of $x$, I can solve the equation $f = 0$ for $\theta$.
A non-holonomic constraint is a system for which this integration can't be performed.  The classical example of this is a sphere rolling without slipping on a table in 2D.  In this case, the state of the system is described by the position of the sphere along the table (needing two coordinates, $x$ and $y$) and the angular orientation of the sphere in 3D (needing three coordinates, such as the Euler angles $\theta$, $\phi$, $\psi$.)
Now, suppose I displace the sphere along the table by some infinitesimal displacement $dx$ and $dy$.  The values of $dx$ and $dy$, combined with the values of $\theta$, $\phi$, $\psi$ before the displacement, will determine the infinitesimal changes $d\theta$, $d\phi$, $d\psi$.  In other words, there must be some kind of relationships of the form
$$
d \theta = ( \sim ) dx + (\sim) dy, \quad d \phi = ( \sim ) dx + (\sim) dy, \quad d \psi = ( \sim ) dx + (\sim) dy
$$
where the quantities in brackets are functions of the coordinates themselves.  (Their precise form is not important for this argument.)
One might hope that we could integrate these relationships between the differentials  to obtain constraints between the coordinates themselves, expressed as a set of functions $f_j(q_i) = 0$.  But here's the catch:  we can't.  If there existed such a set of functions, then it would be the case that the ball's position $x,y$ on the table would completely determine its angular orientation, just like it did for the cylinder.  You can try this out yourself, though:  take a ball and mark a starting spot on the table and a spot on the ball.  Put the ball on the starting point so that the marked spot on the ball is on top, and roll the ball around the table without slipping.  You'll quickly discover that the ball's position on the table does not determine its orientation:  when you bring the ball back to the starting point, the marked point will generally not be on top.  In fact, you can bring pretty much any point to be on top of the ball when the ball returns to its starting point.
This means that there do not exists functions $f_i(q_j)$ of the coordinates which can be obtained by "integrating" the differential constraints above.  Rather than a constraint between the coordinates themselves, we are "stuck" with a constraint between the infinitesimal changes of the coordinates.
A: For completeness: There is also a notion of semi-holonomic constraints.

*

*Recall that a holonomic constraint$^1$
$$f(q,t)~=~0\tag{H}$$
only depends on the generalized coordinates$^2$ $q^j$ and time $t$, but not the generalized velocities $\dot{q}^j$.


*A non-holonomic constraint is unsurprisingly a constraint that is not holonomic.


*A semi-holonomic/Pfaffian constraint
$$a(q,\dot{q},t)~\equiv~ \sum_{j=1}^na_j(q,t)~\dot{q}^j+a_0(q,t)~=~0\tag{S1}$$
is a non-holonomic constraint that depends affinely on the generalized velocities $\dot{q}^j$. Eq. (S1) can equivalently be written via a one-form $$\omega~\equiv~\sum_{j=1}^na_j(q,t)~\mathrm{d}q^j+a_0(q,t)\mathrm{d}t~=~0.\tag{S2}$$


*The constraint (S2) is equivalent to the holonomic constraint (H) iff there exist an integrating factor $\lambda(q,t)\neq 0$ and a one-form $\eta$ such that$^3$
$$ \lambda\omega+ f\eta~\equiv~\mathrm{d}f . \tag{I}$$
--
$^1$ There are various technical regularity conditions implicitly assumed, cf. e.g. this Phys.SE post.
$^2$ In this answer, we also call the original point particle position variables ${\bf r}_1, \ldots, {\bf r}_N$ for generalized coordinates to be as general as possible.
$^3$ Frobenius theorem provides necessary and sufficient conditions
$$\omega\wedge\mathrm{d}\omega~=~0 \quad\Leftrightarrow\quad
\exists\eta:~\mathrm{d}\omega~=~\eta\wedge\omega$$
for a $\omega$ to be (equivalent to) an integrable 1-form.
A: If you have a mechanical system with $N$ particles, you'd technically need $n = 3N$ coordinates to describe it completely.
But often it is possible to express one coordinate in terms of others: for example of two points are connected by a rigid rod, their relative distance does not vary. Such a condition of the system can be expressed as an equation that involves only the spatial coordinates $q_i$ of the system and the time $t$, but not on momenta $p_i$ or higher derivatives wrt time. These are called holonomic constraints: $$f(q_i, t) = 0.$$ The cool thing about them is that they reduce the degrees of freedom of the system. If you have $s$ constraints, you end up with $n' = 3N-s < n$ degrees of freedom.
An example of a holonomic constraint can be seen in a mathematical pendulum. The swinging point on the pendulum has two degrees of freedom ($x$ and $y$). The length $l$ of the pendulum is constant, so that we can write the constraint as $$x^2 + y^2 - l^2 = 0.$$ This is an equation that only depends on the coordinates. Furthermore, it does not explicitly depend on time, and is therefore also a scleronomous constraint. With this constraint, the number of degrees of freedom is now 1.

Non-holonomic constraints are basically just all other cases: when the constraints cannot be written as an equation between coordinates (but often as an inequality).
An example of a system with non-holonomic constraints is a particle trapped in a spherical shell. In three spatial dimensions, the particle then has 3 degrees of freedom. The constraint says that the distance of the particle from the center of the sphere is always less than $R$: $$\sqrt{x^2 + y^2 + z^2} < R.$$
We cannot rewrite this to an equality, so this is a non-holonomic, scleronomous constraint.

A: Suppose you've written down either a system's Lagrangian in terms of $q_i,\,\dot{q}_i$, or its Hamiltonian in terms of $q_i,\,p_i$. There are some subtleties to the analysis if a function $f$ exists for which $f(q_i,\,\dot{q}_j,\,t)=0$, or $f(q_i,\,p_j,\,t)$. Either way, you've constrained that system. We call this holonomic if $f$ is a function of the $q_i,\,t$ alone.
Let's look at some examples. A rollercoaster follows the shape of its track, so the constraint is holonomic. On the other hand, electromagnetism has $p_{A_0}=0$, which is a non-holonomic constraint. (In fact, this one doesn't even depend on the $q_i$.)
A: Suppose a particle is moving on the surface of the sphere, you can write the equation of the distance between the centre  of the sphere and the particle( radius of the sphere) as $x^2+y^2+z^2 = R^2$, here $x,y,z$ are the Cartesian coordinates and $R$ is radius  of the sphere. This is an example of holonomic constraint. Now suppose that particle is not bound to move on the surface of the sphere, in this you can not write the equation as given above. It is a non-holomomic constraint. See the book "Introduction to classical mechanics" by Puranik and Takwale.  
A: The question has been well-answered several times. I'll just add some geometrical context.
In geometry, the holonomy group of a connection is the set of transformations an object can experience when it is parallel transported in a loop. Many constraints can be phrased in terms of forcing something to be parallel transported. If the associated holonomy groups are not trivial, then the constraint cannot be holonomic, because the orientation of the object will depend on the loop traversed, not just the current state. So, rather confusingly, you get holonomic constraints from trivial holonomy groups. 
Here are some examples:


*

*Suppose a coin is rolling without slipping in 2D. This is a holonomic constraint, because if you roll the coin forward and back to where you started, it'll end up in the same orientation. Formally this is described by parallel transport in a $U(1)$ bundle over $\mathbb{R}$, where the $U(1)$ describes the orientation of the coin.

*Suppose a ball is rolling without slipping in 3D. This is not a holonomic constraint, because if you wiggle the ball around, you can make it return to where it started, turned over. (Try it!) Formally this is described by nontrivial holonomy in an $SO(3)$ bundle over $\mathbb{R}^2$, where the $SO(3)$ describes the orientation of the ball. 

*Suppose a cat is floating in space, with zero total angular momentum. This is not a holonomic constraint, because it's possible for the cat to wiggle a bit, then return to its original shape but turned around. Formally this is described by nontrivial holonomy in an $SO(3)$ bundle over $S$, where $S$ is the space of shapes of the cat. 

