Can we say that a constraint decreases the degrees of freedom of a system if and only if it is holonomic. Either way please can you explain why?
A constraint condition can reduce the DOF of the system if it can be used to express a coordinate in terms of the others. This can always be done in case of holonomic constraints which are basically just algebraic functions of the coordinates and time. This means that you just have to manipulate the constraint equation in such a way that one of the coordinates is on the left side and all others on the right and then eliminate. Look at the example below.
Say the holonomic constraint is $f(q_1,q_2,q_3,...,t)=0$, then you just have to bring it in the form $q_1 = g(q_2,q_3,...,t)$ and then substitute the value of $q_1$ thus obtained in all the equations of motion. This would reduce the DOF by 1.
But if the constraint is non-holonomic you might not be able to perform this manipulation.
Suppose your constraint is non-holonomic because it is an inequality of the form $f(q_1,q_2,q_3,...,t) \ge 0$ then the best you can do is get a relation like $q_1 \ge g(q_2,q_3,...,t)$. Obviously you cannot use this to eliminate the coordinate $q_1$ from the equation of motion.
For another example, consider if the constraint was in the form of $f(q_1, q_2, q_3,...,\dot q_1,\dot q_2,\dot q_3,...,t) = 0$. This constraint will not be considered holonomic unless you could integrate it and get it to the form $f(q_1,q_2,q_3,...,t)=0$. There may be problems where this integration cannot be performed without solving the equations of motion first(look at Herbert Goldstein's pure rolling example in the first chapter). In this case too you will not be able to eliminate any coordinates from the equations of motion. In general, constraints involving velocities are of this type
So only holonomic constraints guarantee a reduction in the number of DOF of the system.
yes constraints whether holonomic or non holonomic it must have reduce the degree of freedom As if the system of pendulam then it is holonomic it has two constraint the first one is they can't move freely in x y coordinate and other is z=0 so it reduce the degree of freedom