Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

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

$$\frac{dy}{dx} = y\sin x-2\sin x, \quad y(0) = 0.$$

Initial Value Problem

Hint says: Find an integrating factor

share|cite|improve this question
Welcome to this Math Stack Exchange. Notice that your "question" is kind of a rude implication that the community is just expected to compute your answer, like a robot. It's more helpful if you actually ask a question, and give as much information as you can about why you are stuck. For example, do you not know what an "integrating factor " is? – alex.jordan Oct 4 '12 at 21:05
No I do not. What is an integrating factor? – Ryan Oct 4 '12 at 21:06
I still cannot figure this out. – Ryan Oct 4 '12 at 21:30

When we have a linear differential equation $y'+P(x)y=Q(x)$ of order 1 then $\mu (x)=e^{\int P(x) dx}$will be an integrating factor. In your case, it is $\mu(x)=e^{\cos(x)}$. Now multiply it both sides of the equation and you see $$d(e^{\cos(x)}y)=-2\sin(x)e^{\cos(x)}$$ The rest is easy.

share|cite|improve this answer
What do I do next? – Ryan Oct 4 '12 at 21:15
@Ryan: Did you get the right answer? :-) – Babak S. Oct 5 '12 at 7:17
I think with your help, Ryan got the right answer! +1 – amWhy Mar 23 '13 at 0:44

If a differential equation has the form

$$ y'(x)+p(x)y(x)=q(x)\,, \quad (1), $$ then the integrating factor is given by

$$ m(x)= {\rm e}^{\int p(x) dx}\,. $$

You need to write your ode in the form of $(1)$ and then find the integrating factor. Then just multiply the original equation by the interating factor and integrate

$$ (m(x)y)'= q(x) \Rightarrow \frac{d}{dx}(e^{\cos(x)}y)=-2\sin(x)e^{\cos(x)} $$

$$ \Rightarrow e^{\cos(x)}y(x)=2\int e^{\cos(x)}(-\sin(x))dx + C = 2e^{\cos(x)} +C $$

$$ y(x)= 2 + C \,{\rm e}^{-\cos(x)} \,.$$

To find $C$, you need to use the initial condition $y(0)=0$,

$$ y(0) = 0 = 2 + C{\rm e}^{-\cos(0)} \Rightarrow C = -2 {\rm e}$$

Substituting the value of $C$ in the solution gives

$$ y(x)= 2 - 2 \,{\rm e}^{1-\cos(x)} \,.$$

share|cite|improve this answer
So I got the integral, but how would I integrate: e^(coax)y(x)? – Ryan Oct 4 '12 at 21:20

The simplest type of this ODE is that separable rather than linear. So it is not necessary to treat it as a linear ODE to solve.

$\dfrac{dy}{dx}=y\sin x-2\sin x$

$\dfrac{dy}{dx}=(y-2)\sin x$

$\dfrac{dy}{y-2}=\sin x~dx$

$\int\dfrac{dy}{y-2}=\int\sin x~dx$

$\ln(y-2)=-\cos x+c$

$y-2=Ce^{-\cos x}$

$y=Ce^{-\cos x}+2$

$y(0)=0$ :



$\therefore y=-2ee^{-\cos x}+2=2-2e^{1-\cos x}$

share|cite|improve this answer

Hint: Write it as $\frac{y'}{y-2}=\sin(x)$ and integrate.

share|cite|improve this answer
The answer above is correct. However, if the person asking the question insists you use the hint, then you write the ODE as $ – Stefan Smith Oct 4 '12 at 21: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.