What is wrong with this procedure-writing Angular momentum operator in spherical coordinates I am trying to write the first component of the quantum angular momentum operator  $L_1$ in spherical coordinates.
$$L_1=x_2p_3-x_3p_2=-i\hbar (x_2\dfrac{\partial}{\partial x_3}-x_3\dfrac{\partial}{\partial x_2})=$$
The defining equations of the spherical coordinates are:
$x_1=r \sin\theta \cos\varphi,x_2=r\sin\theta\sin\varphi, x_3=r\cos\theta\tag{1}$
Then using the chain rule:
\begin{align}
L_1
&=-i\hbar (x_2\dfrac{\partial}{\partial x_3}-x_3\dfrac{\partial}{\partial x_2})\\
&=-i\hbar \Big[r\sin\theta\sin\varphi\left(
\dfrac{\partial r}{\partial x_3}\dfrac{\partial}{\partial r}
+\dfrac{\partial \theta}{\partial x_3}\dfrac{\partial}{\partial \theta}
+\dfrac{\partial \varphi}{\partial x_3}\dfrac{\partial}{\partial \varphi}\right)\\
&\qquad\qquad\; -r\cos\theta\ \left(
\dfrac{\partial r}{\partial x_2}\dfrac{\partial}{\partial r}
+\dfrac{\partial \theta}{\partial x_2}\dfrac{\partial}{\partial \theta}
+\dfrac{\partial \varphi}{\partial x_2}\dfrac{\partial}{\partial \varphi}\right)
\Big] \tag{2}
\end{align}
Using (1):
$\dfrac {\partial r}{\partial x_3}=\dfrac {1}{\frac{\partial x_3}{\partial r}}=\dfrac {1}{\cos \theta}$
$\dfrac {\partial \theta}{\partial x_3}=\dfrac {1}{\frac{\partial x_3}{\partial \theta}}=\dfrac {-1}{r \sin \theta}$
$\dfrac {\partial \varphi}{\partial x_3}=0$
$\dfrac {\partial r}{\partial x_2}=\dfrac {1}{\frac{\partial x_2}{\partial r}}=\dfrac {1}{\sin \theta \sin \varphi}$
$\dfrac {\partial \theta}{\partial x_2}=\dfrac {1}{\frac{\partial x_2}{\partial \theta}}=\dfrac {1}{r \cos \theta \sin \varphi}$
$\dfrac {\partial \varphi}{\partial x_2}=\dfrac {1}{\frac{\partial x_2}{\partial \varphi}}=\dfrac {1}{r \sin \theta \cos \varphi}$
Plugging these results in (2):
$$L_1=-i\hbar [r\tan\theta\sin\varphi
\dfrac{\partial}{\partial r}
-\sin \varphi\dfrac{\partial}{\partial \theta}
-r \dfrac{\cot\theta}{\sin \varphi}\dfrac{\partial}{\partial r}
-\dfrac{1}{\sin \varphi}\dfrac{\partial}{\partial \theta}
-\dfrac{\cot \theta}{ \cos \varphi}\dfrac{\partial}{\partial \varphi}
] \tag{3}$$
But the result should be
$$L_1=+i\hbar [\sin \varphi\dfrac{\partial}{\partial \theta}
+\cos \varphi \cot \theta \dfrac{\partial}{\partial \varphi}
] \tag{4}$$
What am I doing wrong?
 A: When enough variables are involved, partial derivatives need a disambiguation as to what is held constant in their definition, e.g. $\left(\tfrac{\partial u}{\partial v}\right)_w$ holds $w$ constant. In particular, $\left(\tfrac{\partial u}{\partial v}\right)\left(\tfrac{\partial v}{\partial u}\right)\ne1$ when we use different conventions in these derivatives.
A simpler version of your mistake is found in planar polar coordinates with $4$ variables $x,\,y,\,r,\,\theta$. For example, compare$$\left(\tfrac{\partial x}{\partial r}\right)_\theta=\left(\tfrac{\partial r\cos\theta}{\partial r}\right)_\theta=\cos\theta=\tfrac{x}{r}$$with$$\left(\tfrac{\partial r}{\partial x}\right)_y=\left(\tfrac{\partial\sqrt{x^2+y^2}}{\partial x}\right)_y=\tfrac{x}{\sqrt{x^2+y^2}}=\tfrac{x}{r}.$$These aren't reciprocals; in fact, they're equal. (Physics has another famous example of what you'd think would be reciprocals in fact being equal; it's the basis of a lot of relativity "paradoxes".)
The triple product rule is another important example of such "gotchas". If $f(x,\,y,\,z)=0$ then$$\prod_\text{cyc}\left(\tfrac{\partial x}{\partial y}\right)_z=-1$$(note the minus sign).
