For the $$N$$ number of particles moving freely in $$d$$-dimensional space, the degrees of freedom is represented by the equation $$f=Nd$$. If there are constraints then $$f=Nd-k$$,where $$k$$ is the number of constraints.