I have the following expresion
$$\hat{M}^2=-\left[\frac{1}{\sin\beta}\frac{\partial}{\partial\beta}\sin\beta\frac{\partial}{\partial\beta}+\frac{1}{sin^2\beta}\left(\frac{\partial^2}{\partial\alpha^2}+\frac{\partial^2}{\partial\gamma^2}\right)-2\frac{cot\beta}{sin\beta}\frac{\partial^2}{\partial\alpha\partial\gamma}\right]$$
In my problem i don't want to work with the angle $\beta$, instead i just want to work with the $\cos\beta$ (basically due to the convergence of Legendre functions with respect to spherical armonics), so i'm trying to make a transformation rule for the partial derivative. For instance, $$q=\cos\beta \quad; usin=\sin\beta=\sqrt{1-q^2} \quad and\quad dq=-\sin\beta d\beta$$
My expression for $\hat{M^2}$ is now: $$\hat{M}^2=-\left[\frac{\partial}{\partial q}usin^2\frac{\partial}{\partial q }+ \frac{1}{usin^2}\left(\frac{\partial^2}{\partial\alpha^2}+\frac{\partial^2}{\partial\gamma^2}\right)-2\frac{q}{usin^2}\frac{\partial^2}{\partial\alpha\partial\gamma}\right]$$
Subscript[w, 1] = f[Subscript[r, 1], Subscript[r, 2], α, β, γ, Subscript[Θ, 12]]
M = -(1/Sin[β] D[(Sin[β] D[Subscript[w, 1], β]), β] + 1/Sin[β]^2 (D[Subscript[w, 1],
{α, 2}] + D[Subscript[w, 1], {γ, 2}]) - 2 Cot[β]/Sin[β] D[Subscript[w, 1], α, γ])
I have written a few lines of code, however i don't know how to exactly proceed with the transformation.