# Commutation relations inconsistent with constraints

In section $$9.5$$ of Weinberg's Lectures on Quantum Mechanics, he uses an example to explain the clasification of constraints. The Lagrangian for a non-relativistic particle that is constrained to remain on a surface described by

$$f(\vec x)=0\tag{1}$$

can be taken as

$$L=\frac 12 m \dot{\vec x}^2-V(\vec x)+\lambda f(\vec x).\tag{2}$$

Apart from the primary constraint $$(1)$$ there is also a secondary one, arising from the imposition that $$(1)$$ is satisfied during the dynamics $$\dot {\vec x}\cdot\vec \nabla f(\vec x)=0.\tag{3}$$

Then he states that imposing $$[x_i,p_j]=i\hbar\delta_{ij}$$ would be inconsistent with the constraints $$(1)$$ and $$(3)$$ (which reads $$\vec{p}\cdot\vec{\nabla}f=0$$ in the Hamiltonian formalism). How can I see this inconsistency?

Would an example suffice? If so, consider the case $$f(\vec x) = x_1$$. Then (1) says $$x_1=0$$, which is already inconsistent with the commutation relation, and (3) says $$p_1=0$$, which is again inconsistent with the commutation relation. If $$x_1$$ or $$p_1$$ is zero, then we can't have $$[x_1,p_1]\neq 0$$.
On one hand, $$0~=~[0,0]~=~[f(x),\vec{p}\cdot\vec{\nabla}f]~=~i\hbar (\vec{\nabla}f)^2.$$ On the other hand, a constraint function $$f$$ typically satisfies a regularity condition $$\left .\vec{\nabla}f \right|_{f=0}~\neq~\vec{0}.$$