5 Changing the role of independent and dependent variable in an ode
(added Dec 14, 2024).
Given an ode \(y^{\prime }\left ( x\right ) =f\left ( x,y\right ) \), we want to change it so that instead of \(y\left ( x\right ) \) being the dependent variable, to make the
ode so that \(x\left ( y\right ) \) is the dependent variable. For example, given the ode
\[ \frac {d^{2}y}{dx^{2}}=\frac {dy}{dx}e^{y\left ( x\right ) }\]
The new ode becomes
\[ \frac {d^{2}x}{dy^{2}}=-\left ( \frac {dx}{dy}\right ) ^{2}e^{y}\]
Which is
easier to solve for \(x\left ( y\right ) \). Once solved, we flip back and find \(y\) from the solution. Sometimes this trick can
make solving hard ode very easy. It also can make solving easy ode very hard. Only way to find
out, is to try it. So if we have an ode that we are having hard time solving, we can try this
trick.
For first order ode, the method is easy. We just isolate \(\frac {dy}{dx}\) and then flip the left hand side and flip the
right hand side, and change all \(y\left ( x\right ) \) to just \(y\) and change all the \(x\) to \(x\left ( y\right ) \).
More formally, this can also be done using change of variables, like this. The first step is to do
change of variables.
\begin{align*} x & =v\left ( t\right ) \\ y & =t \end{align*}
If we carry the above change of variables, the new ode will be in terms of \(v\left ( t\right ) ,v^{\prime }\left ( t\right ) \) and so on.
Now we replace all the \(v^{\left ( n\right ) }\left ( t\right ) \) with \(x^{\left ( n\right ) }\left ( y\right ) \) where \(n\) here is the order of derivative. And replace any \(t\) by \(y\) (not \(y\left ( x\right ) \) but
just \(y\)). And replace any \(v\left ( t\right ) \) by \(x\). The new ode will be the flipped ode.
When we do the above change of variables using chain rule, these will result in the
following
\begin{align*} \frac {dy}{dx} & \rightarrow \frac {1}{\frac {dv}{dt}}=\frac {dt}{dv}\\ \frac {d^{2}y}{dx^{2}} & \rightarrow -\frac {\frac {d^{2}v}{dt^{2}}}{\left ( \frac {dv}{dt}\right ) ^{3}}\\ \frac {d^{3}y}{dx^{3}} & \rightarrow \frac {\frac {2\left ( \frac {d^{2}v}{dt^{2}}\right ) ^{2}}{\left ( \frac {dv}{dt}\right ) ^{2}}-\frac {\frac {d^{3}v}{dt^{3}}}{\left ( \frac {dv}{dt}\right ) ^{3}}}{\frac {dv}{dt}}\end{align*}
And so on. Once the above is done, the rest is easy. We just replace any \(\frac {dv}{dt}\) by \(\frac {dx}{dy}\) and any \(t\) by \(y\) and any \(v\)
by \(x\). We will not do change roles for ode higher than two in these examples.
5.1 Example 1
Change the role for the ode
\[ \frac {dy}{dx}=x \]
This has solution
\begin{equation} y\left ( x\right ) =\frac {1}{2}x^{2}+c_{1} \tag {1}\end{equation}
Since this is first order, we can do it the easy way
without change of variable. Flip the left side and flip the right side and do the renaming
\[ \frac {dx}{dy}=\frac {1}{x}\]
If we want
to do it via change of variables, the method is: Let
\begin{align*} x & =v\left ( t\right ) \\ y & =t \end{align*}
Then
\[ \frac {dy}{dx}=\frac {dy}{dt}\frac {dt}{dv}\frac {dv}{dx}\]
But \(\frac {dy}{dt}=1\) and the above becomes
\[ \frac {dy}{dx}=\frac {dt}{dv}\frac {dv}{dx}\]
And \(\frac {dv}{dx}=1\) and the above becomes
\[ \frac {dy}{dx}=\frac {dt}{dv}\]
Hence ode becomes
\begin{align*} \frac {dt}{dv} & =v\left ( t\right ) \\ \frac {dv}{dt} & =\frac {1}{v}\end{align*}
Now we replace \(v^{\prime }\left ( t\right ) \) by \(x^{\prime }\left ( y\right ) \) and \(v\) by \(x\) The above becomes (which is the flipped ode)
\[ \frac {dx}{dy}=\frac {1}{x}\]
Solving for \(x\left ( y\right ) \)
gives
\begin{align*} x_{1} & =\sqrt {2y+c_{1}}\\ x_{2} & =-\sqrt {2y+c_{1}}\end{align*}
Lets take the first solution and solve for \(y\), this gives
\begin{align} x^{2} & =2y+c_{1}\nonumber \\ y & =\frac {1}{2}x^{2}-\frac {1}{2}c_{1}\nonumber \\ & =\frac {1}{2}x^{2}+c_{1} \tag {2}\end{align}
Which is the same as (1). Of course, in this example there is no point of changing the roles, but
this was just an example.
5.2 Example 2
Change the role for the ode
\[ \frac {dy}{dx}=e^{y}\]
This has solution
\begin{equation} y\left ( x\right ) =\ln \left ( \frac {-1}{x+c_{1}}\right ) \tag {1}\end{equation}
Since this is first order, we will do it the easy way.
Flip the left side and flip the right side and do the renaming. This gives
\[ \frac {dx}{dy}=e^{-y}\]
Solving this gives
\[ x=-e^{-y}+c_{1}\]
Solving for \(y\) gives
\begin{align*} -x+c_{1} & =e^{-y}\\ \ln \left ( -x+c_{1}\right ) & =-y\\ y & =-\ln \left ( -x+c_{1}\right ) \\ & =\ln \left ( \frac {1}{-x+c_{1}}\right ) \\ & =\ln \left ( \frac {-1}{x-c_{1}}\right ) \\ & =\ln \left ( \frac {-1}{x+c_{2}}\right ) \end{align*}
Which is same as (1).
5.3 Example 3
Change the role for the ode
\begin{equation} y\ln y+\left ( x-\ln y\right ) \frac {dy}{dx}=0 \tag {1}\end{equation}
Solving the above gives
\begin{align} y_{1} & =e^{x-\sqrt {x^{2}-2c_{1}}}\tag {2}\\ y_{1} & =e^{x+\sqrt {x^{2}-2c_{1}}}\nonumber \end{align}
Since this is first order, we will do it the easy way. First isolate \(\frac {dy}{dx}\) then flip the left side and the right
side and rename. Solving for \(\frac {dy}{dx}\) from (1) gives
\[ \frac {dy}{dx}=\frac {-y\ln y}{x-\ln y}\]
Flipping
\begin{align} \frac {dx}{dy} & =\frac {\ln \left ( y\right ) -x}{y\ln y}\nonumber \\ & =\frac {1}{y}-\frac {x}{y\ln y}\nonumber \\ \frac {dx}{dy}+\frac {x}{y\ln y} & =\frac {1}{y} \tag {3}\end{align}
In this example, we see that changing roles really paid off as Eq. (3) is linear ode in \(x\left ( y\right ) \) but (1) is very
hard to solve for \(y\left ( x\right ) \) and needs Lie symmetry to solve it. Solving (3) gives
\[ x=\frac {\ln y}{2}+\frac {c_{1}}{\ln y}\]
Solving the above for \(y\) gives
same solutions as (2).
5.4 Example 4
Change the role for the ode
\begin{equation} \frac {d^{2}y}{dx^{2}}=\frac {dy}{dx}e^{y\left ( x\right ) } \tag {1}\end{equation}
This has solution
\begin{equation} y\left ( x\right ) =c_{1}c_{2}+c_{1}x+\ln \left ( \frac {-c_{1}}{e^{c_{1}c_{2}}e^{xc_{1}}-1}\right ) \tag {2}\end{equation}
Since this is not first order, we can not do the easy
method as with first order and we have to do change of variables since with second derivative it is
more complicate. Let
\begin{align*} x & =v\left ( t\right ) \\ y & =t \end{align*}
Using the rules gives above, we know that
\begin{align} \frac {dy}{dx} & =\frac {1}{\frac {dv}{dt}}\tag {3}\\ \frac {d^{2}y}{dx^{2}} & =-\frac {\frac {d^{2}v}{dt^{2}}}{\left ( \frac {dv}{dt}\right ) ^{3}}\nonumber \end{align}
Substituting (3) into (1) (and changing at \(y\left ( x\right ) \) by \(t\) and any \(x\) by \(v\left ( t\right ) \)) gives
\begin{align*} -\frac {\frac {d^{2}v}{dt^{2}}}{\left ( \frac {dv}{dt}\right ) ^{3}} & =\frac {1}{\frac {dv}{dt}}e^{t}\\ -\frac {d^{2}v}{dt^{2}} & =\frac {\left ( \frac {dv}{dt}\right ) ^{3}}{\frac {dv}{dt}}e^{t}\\ -\frac {d^{2}v}{dt^{2}} & =\left ( \frac {dv}{dt}\right ) ^{2}e^{t}\end{align*}
We now replace each \(\frac {dv}{dt}\) by \(\frac {dx}{dy}\) and each \(t\) by \(y\). The above becomes
\[ \frac {d^{2}x}{dy^{2}}=-\left ( \frac {dx}{dy}\right ) ^{2}e^{y}\]
And the above is the final
flipped ode. The solution is
\[ x=-\frac {1}{c_{1}}\ln \left ( e^{y}\right ) +\frac {1}{c_{1}}\ln \left ( e^{y}-c_{1}\right ) +c_{2}\]
To obtain \(y\) as function of \(x\), we just isolate \(y\) from the above.
\begin{align*} c_{1}x & =-\ln \left ( e^{y}\right ) +\ln \left ( e^{y}-c_{1}\right ) +c_{1}c_{2}\\ c_{1}x-c_{1}c_{2} & =\ln \left ( \frac {e^{y}-c_{1}}{e^{y}}\right ) \\ e^{\left ( c_{1}x-c_{1}c_{2}\right ) } & =\frac {e^{y}-c_{1}}{e^{y}}\\ e^{\left ( c_{1}x-c_{1}c_{2}\right ) } & =1-c_{1}e^{-y}\\ 1-e^{\left ( c_{1}x-c_{1}c_{2}\right ) } & =c_{1}e^{-y}\\ \frac {1-e^{\left ( c_{1}x-c_{1}c_{2}\right ) }}{c_{1}} & =e^{-y}\\ -y & =\ln \left ( \frac {1-e^{\left ( c_{1}x-c_{1}c_{2}\right ) }}{c_{1}}\right ) \\ y & =\ln \left ( \frac {c_{1}}{1-e^{\left ( c_{1}x-c_{1}c_{2}\right ) }}\right ) \end{align*}
Which is the solution to the original ode obtain by first flipping the ode.
5.5 Example 5
Change the role for the ode
\begin{equation} 1+xy\left ( 1+xy^{2}\right ) \frac {dy}{dx}=0 \tag {1}\end{equation}
As this stands, it is hard to solve as it needed Lie symmetry. The
solution is
\begin{align*} y_{1} & =\frac {1}{x}\sqrt {-x\left ( 2x\operatorname {LambertW}\left ( -\frac {1}{2}c_{1}e^{\frac {-2x-1}{2x}}\right ) +2x+1\right ) }\\ y_{2} & =-\frac {1}{x}\sqrt {-x\left ( 2x\operatorname {LambertW}\left ( -\frac {1}{2}c_{1}e^{\frac {-2x-1}{2x}}\right ) +2x+1\right ) }\end{align*}
By flipping roles, the ode becomes Bernoulli, which is much easier. Since this is first order, we will
use the easy method. First we isolate\(\ \frac {dy}{dx}\) from (1) then flip both sides and rename. Solving for\(\ \frac {dy}{dx}\) in (1)
gives
\[ \frac {dy}{dx}=\frac {-1}{xy\left ( 1+xy^{2}\right ) }\]
Flipping and renaming \(y\left ( x\right ) \) to \(y\) and \(x\) to \(x\left ( y\right ) \) gives
\[ \frac {dx}{dy}=-xy-x^{2}y^{3}\]
This is in the form
\[ x^{\prime }=Px+Qx^{n}\]
Where \(n=2\) here. Hence
Bernoulli, which is easily solved. The solution is
\[ x=\frac {1}{-2+c_{1}e^{\frac {y^{2}}{2}}-y^{2}}\]
The last step is to solve for \(y\) as function of
\(x\).
\begin{align*} x\left ( -2+c_{1}e^{\frac {y^{2}}{2}}-y^{2}\right ) & =1\\ -2x+c_{1}xe^{\frac {y^{2}}{2}}-xy^{2} & =1\\ c_{1}e^{\frac {y^{2}}{2}}-y^{2} & =\frac {1+2x}{x}\end{align*}
Solving for \(y\) from the above gives same answer as above. This is an example where flipping roles
paid off well. But only way to know is to try it and see.
5.6 Example 6
Change the role for the ode
\begin{equation} \left ( 1-4xy^{2}\right ) \frac {dy}{dx}=y^{3} \tag {1}\end{equation}
As this stands, this is homogeneous class G. The solution
is
\begin{align*} y_{1} & =-\frac {1}{2x}\sqrt {x\left ( 1+\sqrt {16c_{1}x+1}\right ) }\\ y_{2} & =\frac {1}{2x}\sqrt {x\left ( 1+\sqrt {16c_{1}x+1}\right ) }\\ y_{3} & =-\frac {1}{2x}\sqrt {-x\left ( -1+\sqrt {16c_{1}x+1}\right ) }\\ y_{4} & =\frac {1}{2x}\sqrt {-x\left ( -1+\sqrt {16c_{1}x+1}\right ) }\end{align*}
By flipping roles, the ode becomes linear, which is much easier to solve. Since this is first order, we
will use the easy method. First we isolate\(\ \frac {dy}{dx}\) from (1) then flip both sides and rename. Solving for\(\ \frac {dy}{dx}\) in
(1) gives
\[ \frac {dy}{dx}=\frac {y^{3}}{1-4xy^{2}}\]
Flipping and renaming \(y\left ( x\right ) \) to \(y\) and \(x\) to \(x\left ( y\right ) \) gives
\begin{align*} \frac {dx}{dy} & =\frac {1-4xy^{2}}{y^{3}}\\ & =\frac {1}{y^{3}}-4\frac {x}{y}\end{align*}
Or
\[ \frac {dx}{dy}+\frac {4}{y}x=\frac {1}{y^{3}}\]
Which is linear ode in \(x\left ( y\right ) \). Solving gives
\[ x=\frac {1}{y^{4}}\left ( \frac {y^{2}}{2}+c_{1}\right ) \]
The last step is to solve for \(y\) which will give same solution
as above.
5.7 Example 7
Change the role for the ode
\begin{equation} \frac {dy}{dx}=\frac {x}{y^{2}x^{2}+y^{5}} \tag {1}\end{equation}
As this stands, this can be solved using Lie symmetry or as an exact
ode but with an integrating factor that needs to be found first, The solution is
\[ y_{1}=\frac {1}{2}\left ( -8x^{2}-12\operatorname {LambertW}\left ( \frac {4}{3}c_{1}e^{-\frac {2}{3}x^{2}-1}\right ) -12\right ) ^{\frac {1}{3}}\]
And 2 more (too
long to type). By flipping roles the new ode becomes
\begin{align*} \frac {dx}{dy} & =\frac {y^{2}x^{2}+y^{5}}{x}\\ & =xy^{2}+y^{5}x^{-1}\end{align*}
This has form
\[ x^{\prime }=P\left ( y\right ) x+Q\left ( y\right ) x^{n}\]
Which is Bernoulli ode. Which is simpler to solve solve. Solving gives
\begin{align*} x & =-\frac {1}{2}\sqrt {-6-4y^{3}+c_{1}4e^{\frac {2}{3}y^{3}}}\\ x & =\frac {1}{2}\sqrt {-6-4y^{3}+c_{1}4e^{\frac {2}{3}y^{3}}}\end{align*}
Finally, we solve for \(y\) from the above. This will give same solutions as above.