# How to do a change of variable in an ODE

I asked something related to this and this was a secondary question, after some answers. So I prefer to ask this in a new post because this question is extensive. Sorry for ask this simple things. )=

If I have an ODE, let's say of second order, and has the form $$\frac{d^2 y}{dx^2} = f \Big( {\frac{dy}{dx},y,x} \Big),$$ where clearly $y$ is a function that depends on $x$.

There are two important kinds of change of variable. The second complains me, but I put i) also in case someone notes an error. In fact if someone know if this can be writted in a optional hide, but I don't know how to do it.

i) If I use some change of the form $s=g(x)$, then I have to compute $\frac{d^2 y}{dx^2}, \frac{dy}{dx}$ with the new variable. I know how to do it. $$\frac{dy}{dx} = \frac{dy}{ds}\frac{ds}{dx}.$$ Then for the second, we have $$\frac{d^2 y}{dx^2} = \frac{d}{dx} \Big( \frac{dy}{dx} \Big) = \frac{d}{dx} \left( \frac{dy}{ds} \frac{ds}{dx} \right) = \frac{ds}{dx} \cdot \frac{d}{dx} \Big( \frac{dy}{ds} \Big) + \frac{dy}{ds} \cdot \frac{d}{dx} \Big( \frac{ds}{dx} \Big) .$$ For the first term we have $$\frac{ds}{dx} \cdot \left( \frac{d}{dx} \Big( \frac{dy}{ds} \Big) \right) = \frac{ds}{dx} \cdot \left( \frac{d}{ds} \Big( \frac{dy}{ds} \Big) \cdot \frac{ds}{dx} \right) = \frac{d^2 y}{ds^2} \Big( \frac{ds}{dx} \Big)^2 ,$$ and the second is obviously equal to $$\frac{dy}{ds} \cdot \frac{d^2 s}{dx^2}.$$ So we have that $$\frac{d^2 y}{dx^2} = \frac{d^2 y}{ds^2} \Big( \frac{ds}{dx} \Big)^2 + \frac{dy}{ds} \cdot \frac{d^2 s}{dx^2}$$

ii) Here is my problem, a change of variable of the form $s= g(y)$. Here the technique is different because, in the other I start with $\frac{dy}{dx}$ and changed with the chain rule, but here is different because in a way it clearing in an indirect way. I start differentiating the equality with respect to $x$, I have \begin{align*} s &= g(y) \\ \frac{ds}{dx} &= \frac{dg}{dy} \cdot \frac{dy}{dx} \end{align*} But for the second, what can I do?

-

I'm unsure what you're asking exactly. Without a specific substitution in mind, I can't be very specific. If your substitution has as it's goal to replace $y$ with $s$, then...

$$s=g(y)$$

$$\frac{ds}{dx} = \frac{ds}{dy}\frac{dy}{dx} = g'(y)\frac{dy}{dx}$$

$$\frac{d^2s}{dx^2} = g''(y) \frac{dy}{dx} + g'(y)\frac{d^2y}{dx^2}$$

So that $$\frac{d^2s}{dx^2} = g''(y)\frac{dy}{dx}+g'(y)f\left(\frac{dy}{dx},y,x\right)$$

Now every occurrence of $\frac{dy}{dx}$ can be replaced by $\frac{ds}{dx}/g'(y)$ (assuming $g'(y) \not=0$). This leaves us with...

$$\frac{d^2s}{dx^2} = g''(y)\left(\frac{ds}{dx}/g'(y)\right)+g'(y)f\left(\frac{ds}{dx}/g'(y),y,x\right)$$

The last step would involve replacing $g(y)$'s with $s$. Or if the substitution can be solved for $y$: $y=g^{-1}(s)$ then...

$$\frac{d^2s}{dx^2} = g''(g^{-1}(s))\left(\frac{ds}{dx}/g'(g^{-1}(s))\right)+g'(g^{-1}(s))f\left(\frac{ds}{dx}/g'(g^{-1}(s)),g^{-1}(s),x\right)$$

-