How to solve linear ODE $y'-axy=b$

212 Views Asked by At

I am trying to solve the ODE $y'-axy=b$, where $a$ and $b$ are constants. For $b=0$, the eqn is separable, but for $b\ne 0$ I tried to use an integrating factor of $I=\exp (-ax^2/2)$. This leaves me with $y\exp (-ax^2/2) = \int \exp (-ax^2/2) dx + C$. I cannot evaluate the integral on the RHS analytically.

Is there another applicable method that will solve the original ODE in closed form?

2

There are 2 best solutions below

0
On

Let $$\mu(x)=e^{\int-axdx}=e^{-ax^2/2}$$ then

$$e^{-ax^2/2}\frac{dy(x)}{dx}-\left(ae^{-ax^2/2}x \right)y(x)=be^{-ax^2/2}$$

$$\frac{d}{dx}\left(e^{-ax^2/2}y(x)\right)=be^{-ax^2/2}$$ $$\int \frac{d}{dx}\left(e^{-ax^2/2}y(x)\right)dx=\int be^{-ax^2/2}dx$$ so

$$e^{-ax^2/2}y(x)=\frac{b\sqrt{\pi/2}erf(\frac{\sqrt{ax}}{\sqrt{2}})}{\sqrt{a}}+C_1$$

0
On

You did not face any problem for $b=0$ $$y'-axy=0 \implies y=c\, e^{\frac{a x^2}{2}}$$ Now, instead of the integration factor, you could use the variation of parameter and get $$e^{\frac{a x^2}{2}} c'(x)=b\implies c'=b e^{-\frac{a x^2}{2}}\implies c=b\int e^{-\frac{a x^2}{2}} \,dx + k$$ for the last integral, let $$\frac{a x^2}{2}=z^2\implies x=\sqrt{\frac 2a}z\implies dx=\sqrt{\frac 2a}\,dz$$ which makes $$\int e^{-\frac{a x^2}{2}} \,dx=\sqrt{\frac 2a}\int e^{-z^2}\,dz=\sqrt{\frac 2a}\times\frac{ \sqrt{\pi }}{2}\, \text{erf}(z)=\sqrt{\frac{\pi }{2a}}\, \text{erf}(z)$$ Back to $x$, then to $c$, then to $y$ for the final answer.