I have the differential equation $$ \dfrac{d}{dx} \left( p(x) \dfrac{df}{dx} \right) + \dots = 0 $$ and I want to perform a generic change of variable from $x$ to $y = y(x)$.
Let $f(x) = F(y(x))$, thus $$ \dfrac{df}{dx} = \dfrac{dF}{dy} \dfrac{dy}{dx} $$ and $$ \dfrac{d}{dx} \left( p(x) \dfrac{dF}{dy} \dfrac{dy}{dx} \right)\ . $$
How should I transform the other derivative? Following the same reasoning, I get $$ \dfrac{d}{dy} \left(p(x) \dfrac{dF}{dy} \dfrac{dy}{dx}\right) \dfrac{dy}{dx} $$ and now I see two options:
Since the outer derivative is done with respect to $y$, treat functions of $x$ as constants and get $$ p(x) \left( \dfrac{dy}{dx} \right)^2 \dfrac{d^2F}{dy^2}\ . $$ This looks a bit weird (ilegal movement?) for me, but apparently this works later when working other things with the differential equation and checking the results.
Define $P(y(x)) = p(x)$ and $Y(y(x)) = dy/dx$ and get $$ Y(y) \dfrac{d}{dy} \left(P(y) Y(y) \dfrac{dF}{dy}\right) $$ which looks like the correct way of doing this for me, but this form of the new differential equation seems to be wrong later.
What is the correct way of doing this?
It is correct that $$\frac{\mathrm{d}}{\mathrm{d}x}\left[p\cdot\frac{\mathrm{d}f}{\mathrm{d}x}\right]=\frac{\mathrm{d}}{\mathrm{d}y}\left[p\cdot\frac{\mathrm{d}F}{\mathrm{d}y}\cdot\frac{\mathrm{d}y}{\mathrm{d}x}\right]\cdot\frac{\mathrm{d}y}{\mathrm{d}x}.$$ Here, you must use the product rule: $$\frac{\mathrm{d}}{\mathrm{d}y}\left[p\cdot\frac{\mathrm{d}F}{\mathrm{d}y}\cdot\frac{\mathrm{d}y}{\mathrm{d}x}\right]\cdot\frac{\mathrm{d}y}{\mathrm{d}x}=\frac{\mathrm{d}}{\mathrm{d}y}\left[p\cdot\frac{\mathrm{d}F}{\mathrm{d}y}\right]\left(\frac{\mathrm{d}y}{\mathrm{d}x}\right)^2+p\cdot\frac{\mathrm{d}F}{\mathrm{d}y}\cdot\frac{\mathrm{d}y}{\mathrm{d}x}\cdot\frac{\mathrm{d}}{\mathrm{d}y}\left(\frac{\mathrm{d}y}{\mathrm{d}x}\right).$$ The secret here is that $$\frac{\mathrm{d}}{\mathrm{d}y}\left(\frac{\mathrm{d}y}{\mathrm{d}x}\right)=\frac{\mathrm{d}}{\mathrm{d}y}\left(\frac1{\frac{\mathrm{d}x}{\mathrm{d}y}}\right)=-\frac{\frac{\mathrm{d}^2x}{\mathrm{d}y^2}}{\left(\frac{\mathrm{d}y}{\mathrm{d}x}\right)^2}.$$
The problem here is that, in actuality, you really cannot do such arbitrary changes of variable without accounting for $y'$ in the change of variables.