TITLE: Uncomfortable using Leibniz notation for the chain rule.
QUESTION [5 upvotes]: I am working through the following solved problem which uses separation of variables to get two ODEs.  The problem is to show that 
$$\frac{1}{\sin\theta P}\frac{\mathrm{d}}{\mathrm{d}\theta}\left(\sin\theta\frac{\mathrm{d}P}{\mathrm{d}\theta}\right)-\frac{m^2}{\sin^2\theta}=-\lambda,$$
can be expressed as 
$$\left(1-x^2\right)\frac{\mathrm{d}^2P}{\mathrm{d}x^2}-2x\frac{\mathrm{d}P}{\mathrm{d}x}+\left[l\left(l+1\right)-\frac{m^2}{1-x^2}\right]P=0,$$
where $\lambda=l\left(l+1\right)$ and $x=\cos\theta$.
I can solve the problem fine but I am uncomfortable with some of the notation that I used and want to know / understand better if it is correct.
Essentially the answer involves stating that
$$\frac{\mathrm{d}}{\mathrm{d}\theta}=\frac{\mathrm{d}x}{\mathrm{d}\theta}\frac{\mathrm{d}}{\mathrm{d}x}=-\sin\theta\frac{\mathrm{d}}{\mathrm{d}x},$$
and substituting it in.
I can see that this is an application of the chain rule, but I don't feel comfortable in it being expressed this way.  I think what bothers me is the first part it is not specified what function we are taking the derivative of, which in this case is $x$ but then that would leave you with 
$$\frac{\mathrm{d}x}{\mathrm{d}\theta}=\frac{\mathrm{d}x}{\mathrm{d}\theta}=-\sin\theta,$$
which doesn't give you the manipulation that is needed to re-express the question.  This sort of manipulation gets used a lot and I would like to become more comfortable with understanding why it is valid to state such a thing as to me it just doesn't feel 100% correct.

REPLY [2 votes]: what bothers me is the first part it is not specified what function we
  are taking the derivative

Assume you have two differentiable functions $f:I\rightarrow 
\mathbb{R}
$ and $g:J\rightarrow 
\mathbb{R}
$ such that $f(I)\subset J$, where $I$ and $J$ are two intervals $\varnothing
\neq I\subset 
\mathbb{R}
$ and $\varnothing \neq J\subset 
\mathbb{R}
$. Then the chain rule can be expressed as 
\begin{equation*}
\left( g\circ f\right) ^{\prime }(a)=g^{\prime }(b)f^{\prime }(a),\qquad
a\in I,b=f(a)\text{.}
\end{equation*}
If $y=g(x)$ and $x=f(\theta )$ this corresponds to the following Leibnitz
notation for the derivative of the composite function $y=\left( g\circ f\right)
\left( \theta \right) =g\left( f(\theta )\right) $
\begin{equation*}
\frac{dy}{d\theta }=\frac{dy}{dx}\frac{dx}{d\theta },
\end{equation*}
where $dy/d\theta $, $dy/dx$ and $dx/d\theta $ are evaluated, respectively,
at $\theta =a\in I$, $b=f(a)$ and $\theta =a$.