Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I solve $\frac{dy}{dx}=5xy + \sin x$ explicitly? With $y(0) = 1$. I am asked to use an integrating factor. What I did:

$\frac{dy}{dx}-5xy = \sin x \\ \text{Integrating factor:} \ e^{\int{-5x\ dx}} = e^{-\frac{5}{2}x^2} \\ \frac{d}{dx}\left[e^{-\frac{5}{2}x^2}y\right] = e^{-\frac{5}{2}x^2}\sin x \\ e^{-\frac{5}{2}x^2}y = \int e^{-\frac{5}{2}x^2}\sin x \ dx$

How would I proceed from there? Edit: $y(0) = 1$.

Also, when does the scalar ODE (above) have a unique solution?

share|cite|improve this question
Whether you can integrate it in closed form or not, you've found the solution: just take your last equation and multiply both sides by $e^{\frac{5}{2} x^2}$ to get $y = e^{\frac{5}{2} x^2} (F(x) + C)$ where $F(x) = \int e^{-\frac{5}{2} x^2} \sin x\ dx$. An ODE never has a unique solution, you always need an initial condition to specify a unique solution. – Robert Israel Apr 25 '12 at 18:30
Robert is right. If the instructions are: "Solve using an integrating factor", then you have done that. It just happens that your solution involves an integral. Maybe divide to get "$y=\dots$". – GEdgar Apr 25 '12 at 18:38
Thanks @ Robert Israel @GEdgar. I forgot to add in the initial condition. It is $y(0) = 1$. How do I proceed from there? From my working above, can I then just substitute $y(0) = 1$? – Richard Apr 25 '12 at 18:50
Yes, like this:$$y = e^{\frac{5}{2}x^2}\big(1+\int_0^x e^{-\frac{5}{2}t^2}\sin t \, dt\big)$$ – GEdgar Apr 25 '12 at 20:25
Thanks @GEdgar ! I get $1 = 1(1+0)$, is that correct? Or Shouldnt the $1$ be a $C$? Constant. – Richard Apr 25 '12 at 21:39

Rewrite ODE into form :

$(5xy+\sin x)dx-1\cdot dy=0$

Next , let's denote :

$M=5xy+\sin x ~\text{and}~ N=1$ , then :

integrating factor $u(x)$ is given by :

$$u(x)=e^{\int\frac{\frac{\partial M}{\partial y}-\frac{\partial N}{\partial x}}{N}\,dx}=e^{\frac{5}{2}x^2}$$

Use this procedure to find solution of ODE .

share|cite|improve this answer
Thanks for your help! Sorry I forgot to add an initial condition, $y(0) = 1$. – Richard Apr 25 '12 at 18:54

This is a linear, non-homogeneous, differential equation. Mathematica suggests the solution $$\left\{\left\{y(x)\to \frac{1}{20} e^{\frac{5 x^2}{2}} \left(20 c_1+\frac{i \sqrt{10 \pi } \left(\text{erf}\left(\frac{5 x+i}{\sqrt{10}}\right)+i \text{erfi}\left(\frac{1+5 i x}{\sqrt{10}}\right)\right)}{\sqrt[10]{e}}\right)\right\}\right\}.$$ Your approach if perfectly correct, since linear equation always have an integrating factor. Yours has $e^{\frac{5}{2}x^2}$. I'm afraid you won't find an elementary solution, since $\int e^{-\frac{5}{2}x^2}\sin x\, \mathrm{d}x$ can't be expressed in terms of elementary functions. Of course, this does not mean that the exercise is impossible.

share|cite|improve this answer
Thanks @siminore, what is the way to find the solution? The method pedja described? – Richard Apr 25 '12 at 18:22
The solution proposed by Mathematica is a big mess, and it has to do with complex numbers. By the way, I believe that nobody wants to work with erf and erfi functions to solve a linear equation. For the general approach to first-order linear equations, see : there is a paragraph where the method is explained. – Siminore Apr 26 '12 at 8:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.