# my ODE won't get solved [closed]

I press ENTER but nothing happens. Not even the {}. Nothing.

DSolve[{y'[x] == (-x*y[x] - 1)/(4*x^3*y[x] - 2*x^2) }, y[x], x]

Have I written anything wrong?

• It works for me. What's the version of Mma? – Andrew May 17 '18 at 6:10
• Press shift+enter. – Mariusz Iwaniuk May 17 '18 at 6:11
• Shift+enter worked. Thanks. Can I see the steps of the solution somehow? – Carcosa Piper May 17 '18 at 6:25
• No,Mathematica can't do this. If you whant steps post question to: math.stackexchange.com. Well, you can have a preview of what it is integrating: Block[{Integrate}, DSolve[{y'[x] == (-x*y[x] - 1)/(4*x^3*y[x] - 2*x^2)}, y[x], x] /. {Integrate -> Inactive[Integrate]}] – Mariusz Iwaniuk May 17 '18 at 10:33
• Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! – Chris K May 17 '18 at 14:07

Can I see the steps of the solution somehow?

Here is step-by-step solution. May be Wolfram-Alpha can show step by step for this.

solve $\frac{dy}{dx}=\frac{-xy-1}{4x^{3}y-2x^{2}}$. Write as

$$M\left( x,y\right) +N\left( x,y\right) \frac{dy}{dx}=0$$

Where \begin{align*} M & =\left( xy+1\right) \\ N & =\left( 4x^{3}y-2x^{2}\right) \end{align*}

$\frac{\partial M}{\partial y}=x,\frac{\partial N}{\partial x}=12x^{2}y-4x$. Since $\frac{\partial M}{\partial y}\neq\frac{\partial N}{\partial x}$, then the ODE is not exact. Let try to find an integrating factor $\mu$.

$$R=\frac{\frac{\partial N}{\partial x}-\frac{\partial M}{\partial y}} {xM-yN}=\frac{\left( 12x^{2}y-4x\right) -x}{x\left( xy+1\right) -y\left( 4x^{3}y-2x^{2}\right) }=\frac{12xy-5}{-4\left( xy\right) ^{2}+3xy+1}$$

Since $R$ is a function of $xy$ only, then we got lucky, and found integrating factor $\mu=e^{\int R\left( t\right) dt}$ where $t=xy$.

\begin{align*} \mu & =e^{\int\frac{\left( 12t-5\right) }{\left( -4t^{2}+3t+1\right) } dt}\\ & =e^{-\frac{7}{5}\ln\left( 1-t\right) -\frac{8}{5}\ln\left( 1+4t\right) }\\ & =\left( 1+4t\right) ^{\frac{-8}{5}}\left( 1-t\right) ^{\frac{-7}{5}}\\ & =\frac{1}{\left( 1+4xy\right) ^{\frac{8}{5}}\left( 1-xy\right) ^{\frac{7}{5}}} \end{align*}

Multiplying the original ODE by $\mu$ gives

\begin{align*} \mu M\left( x,y\right) +\mu N\left( x,y\right) \frac{dy}{dx} & =0\\ \frac{xy+1}{\left( 1+4xy\right) ^{\frac{8}{5}}\left( 1-xy\right) ^{\frac{7}{5}}}+\frac{4x^{3}y-2x^{2}}{\left( 1+4xy\right) ^{\frac{8}{5} }\left( 1-xy\right) ^{\frac{7}{5}}}\frac{dy}{dx} & =0\\ \bar{M}\left( x,y\right) +\bar{N}\left( x,y\right) & =\frac{dy}{dx} \end{align*}

Where \begin{align*} \bar{M}\left( x,y\right) & =\frac{xy+1}{\left( 1+4xy\right) ^{\frac {8}{5}}\left( 1-xy\right) ^{\frac{7}{5}}}\\ \bar{N}\left( x,y\right) & =\frac{4x^{3}y-2x^{2}}{\left( 1+4xy\right) ^{\frac{8}{5}}\left( 1-xy\right) ^{\frac{7}{5}}} \end{align*}

Checking now shows that $\frac{\partial\bar{M}}{\partial y}=\frac{\partial \bar{N}}{\partial x}$, so the ODE is now exact. Hence it can now be solved. Let

\begin{align} \frac{dU}{dx} & =\bar{M}\left( x,y\right) \tag{1}\\ \frac{dU}{dy} & =\bar{N}\left( x,y\right) \tag{2} \end{align}

From (1)

\begin{align} U & =\int\bar{M}dx+f\left( y\right) \nonumber\\ & =\int\frac{xy+1}{\left( 1+4xy\right) ^{\frac{8}{5}}\left( 1-xy\right) ^{\frac{7}{5}}}dx+f\left( y\right) \nonumber\\ & =\frac{x}{\left( 1-xy\right) ^{\frac{2}{5}}\left( 1+4xy\right) ^{\frac{3}{5}}}+f\left( y\right) \tag{3} \end{align}

From (2)

\begin{align*} \frac{dU}{dy} & =\frac{2x^{2}\left( -1+2xy\right) }{\left( 1+xy\right) ^{\frac{7}{5}}\left( 1+4xy\right) ^{\frac{8}{5}}}\\ \frac{d}{dy}\left( \frac{x}{\left( 1-xy\right) ^{\frac{2}{5}}\left( 1+4xy\right) ^{\frac{3}{5}}}+f\left( y\right) \right) & =\frac {2x^{2}\left( -1+2xy\right) }{\left( 1+xy\right) ^{\frac{7}{5}}\left( 1+4xy\right) ^{\frac{8}{5}}}\\ \frac{2x^{2}\left( -1+2xy\right) }{\left( 1-xy\right) ^{\frac{7}{5} }\left( 1+4xy\right) ^{\frac{8}{5}}}+f^{\prime}\left( y\right) & =\frac{2x^{2}\left( -1+2xy\right) }{\left( 1+xy\right) ^{\frac{7}{5} }\left( 1+4xy\right) ^{\frac{8}{5}}}\\ f^{\prime}\left( y\right) & =\frac{\left( 4x^{3}y-2x^{2}\right) }{\left( 1+4xy\right) ^{\frac{8}{5}}\left( 1-xy\right) ^{\frac{7}{5}} }-\frac{2x^{2}\left( -1+2xy\right) }{\left( 1-xy\right) ^{\frac{7}{5} }\left( 1+4xy\right) ^{\frac{8}{5}}}\\ & =0 \end{align*}

Hence $f\left( y\right) =C$ and from (3)

$$U=\frac{x}{\left( 1-xy\right) ^{\frac{2}{5}}\left( 1+4xy\right) ^{\frac {3}{5}}}+C$$

But $U=c_{0}$ some constant. Hence combining constants to one, the implicit solution for $y\left( x\right)$ is

$$\frac{x}{\left( 1-xy\right) ^{\frac{2}{5}}\left( 1+4xy\right) ^{\frac {3}{5}}}+C=0$$

To show the above is the same as solution by Mathematica, just apply solve for it. (I think implicit solution is easier in this case)

  eq=x/((1-x y)^(2/5) (1+4 x y)^(3/5))+C[1]==0;
Solve[eq, y]


Compare to

  DSolve[{y'[x] == (-x*y[x] - 1)/(4*x^3*y[x] - 2*x^2)}, y[x], x]


I also verified the hand solution in Maple, using its odetest() function

restart;
ode:=diff(y(x),x)=(-x*y(x)-1)/(4*x^3*y(x)-2*x^2):
mysol:=x/((1-x*y(x))^(2/5)*(1+4*x*y(x))^(3/5))+_C1=0:
odetest(mysol,ode);
(* 0 *)


zero from odetest means the solution satisfies the ODE.

• great answer! thank you! I've never seen this integrating factor though... – Carcosa Piper May 18 '18 at 19:44