I am to solve the following initial value problem: $$\frac {dy}{dx}=(4+y)\cos x + 4x(4+y),\ y(0)=0$$

I am aware that the general formula for an ODE/IVP is: $$\frac {dy}{dx}+p(x)\cdot y=q(x),$$ and the integrating factor is: $$I(x)=e^{\int p(x)\ dx}$$ However, do I expand the terms and solve like this: $$\frac {dy}{dx}-\cos\ x\cdot y=4\cos x+4x(4+y)$$ so there are $p(x)$ and $y$ terms on the left and a $q(x)$ term on the right?

Integrating that is proving difficult and I think I have gone about arranging the equation wrong.

Thank you.

EDIT: This allows me to have: $$e^{\int -\cos(x)\ dx}$$ which is: $$e^{-\sin(x)}$$

  • $\begingroup$ there's a mistake in your $p$ and $q$, in the $LHS$, you still have a factor of $y$ $\endgroup$ – Oussama Boussif May 13 '17 at 11:15
  • $\begingroup$ Is there not meant to be a factor of y in the LHS? $\endgroup$ – John Appleseed May 13 '17 at 11:17
  • $\begingroup$ Exactly, but in your solution, there's still a factor of $y$, so I suggest you rearrange it again $\endgroup$ – Oussama Boussif May 13 '17 at 11:20
  • $\begingroup$ No I mean, the equation for an initial value problem is: $$\frac {dy}{dx}+p(x)\cdot y=q(x)$$ There is meant to be a y in there I thought. $\endgroup$ – John Appleseed May 13 '17 at 11:23
  • $\begingroup$ it is $$y(x)=-4+e^{2x^2-sin(x)}C$$ $\endgroup$ – Dr. Sonnhard Graubner May 13 '17 at 11:28

\begin{align} \dfrac{dy}{dx}&=(4+y)\cos x + 4x(4+y)\\ \implies\dfrac{dy}{dx}&=y(\cos x+4x)+4(\cos x+4x)\\ \implies\dfrac{dy}{dx}-y(\cos x+4x)&=4(\cos x+4x)\hspace{25pt}\cdots\text{(i)}\\ \end{align}

Now (i) is in the form of $\dfrac{dy}{dx}+y\cdotp(x)=q(x)$.

So, Integrating Factor, $I.F.=e^{-\int(\cos x+4x)\:dx}=e^{-(\sin x+2x^2)}$ .

Therefore, (i) can be written as: \begin{align} \dfrac{d}{dx}\left[y\cdot e^{-(\sin x+2x^2)}\right]&=4(\cos x+4x)\cdot e^{-(\sin x+2x^2)}\\ \int d\left[y\cdot e^{-(\sin x+2x^2)}\right]&=4\int(\cos x+4x)\cdot e^{-(\sin x+2x^2)}\ dx+c\hspace{25pt} [c=\text{integration const.]}\\ y\cdot e^{-(\sin x+2x^2)}&=-4e^{-(\sin x+2x^2)}+c \end{align} Now, as $y(0)=0\implies c=4$.

Therefore solution is, $y\cdot e^{-(\sin x+2x^2)}=4\left[1-e^{-(\sin x+2x^2)}\right]$.

  • $\begingroup$ Thank you very much! It was after all the simple issue with me not factoring the y value correctly and using the integrating factor correctly also. I now see where I went wrong! $\endgroup$ – John Appleseed May 13 '17 at 12:03
  • $\begingroup$ you welcome. my pleasure :) $\endgroup$ – k.Vijay May 13 '17 at 12:11

If you want to solve it as a linear ODE, you would have to arrange it in the form you mentioned. However, note that your integrating factor is incorrect, because you did not put in in the form you mentioned: $$\frac{dy}{dx}+p(x)y=q(x) \tag{1}$$ This is because you still have $y$ on the RHS. To do it correctly, do this instead: $$\begin{align} \frac {dy}{dx}&=(4+y)\cos x + 4x(4+y) \\ &=4\cos{x}+y\cos{x}+16x+4xy \\ &=4\cos{x}+16x+y(\cos{x}+4x) \end{align}$$ Hence: $$\frac{dy}{dx}+(-4x-\cos{x})\cdot y=4\cos{x}+16x$$ It is now in the form of $(1)$. Hence, your integrating factor should be: $$\mu(x)=e^{\int p(x)~dx}=e^{\int (-4x-\cos{x})~dx}=e^{-2x^2-\sin{x}}$$ Applying the reverse product rule and integrating both sides should now not be a problem.

However, note that an easier method to solve it is to realize that you can factor it as: $$\frac{dy}{dx}=(y+4)(4x+\cos{x})$$ And then solve it as a separable ODE: $$\int \frac{1}{y+4}~dy=\int (4x+\cos{x})~dx$$

  • 1
    $\begingroup$ Thank you! That also makes much more sense and I see where I went wrong, I was on the right track working away at this and I was close before I realised there was some solutions posted here! Thank you! $\endgroup$ – John Appleseed May 13 '17 at 12:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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