Solve the differential equation $$y'\sin\left(x\right)+2\cdot y\cdot \cos\left(x\right)=1$$ I reckon this is a linear differential equation. We were taught to solve this by first finding the solution to the homogeneous equation $y'+P\left(x\right)\cdot y\:=\:0$ and then finding the solution to the particular equation and then summing the two, giving us the final solution $y=y_o+y_p$

Solving the homogeneous equation yields $$y_o=\sin^{-2}\left(x\right)\cdot e^{-2C}$$ I solved it by separating the equation thus so:$$\frac{dy}{dx}=-\frac{2\cdot y\cdot \cos\left(x\right)}{\sin\left(x\right)}\:$$ Integrating gives $$-\frac{1}{2}\ln\left|y\right|=\ln\left|\sin\left(x\right)\right|+C$$ And so $$y_o=\sin^{-2}\left(x\right)\cdot e^{-2C}$$

And now for the particular solution I just do $$y_p=\sin^{-2}\left(x\right)\cdot e^{-2C\left(x\right)}$$

!!Derivative calculation was wrong, edit below

Derivative: $$y'_p=-\frac{\cos\left(x\right)}{\sin\left(x\right)}\cdot e^{-2C\left(x\right)}-2\sin^{-2}\left(x\right)\cdot C'\left(x\right)\cdot e^{-2C\left(x\right)}$$

And now replacing it in the initial equation gives: $$-\cos\left(x\right)\cdot e^{-2C\left(x\right)}-2\sin^{-1}\left(x\right)\cdot C'\left(x\right)\cdot e^{-2C\left(x\right)}+2\cdot \sin^{-2}\left(x\right)\cdot e^{-2C\left(x\right)}\cdot \cos\left(x\right)=1$$

Usually at this point I can simplify some stuff so I can calculate the value of $C\left(x\right)$ and replace it in the particular solution. So I'm quite stuck at this point, since nothing can be simplified as far as I can see. What am I doing wrong? I saw that there is some other method for solving linear differential equations but I would really want to solve it using the method that was taught to us. Can anyone give me a few pointers of where I'm messing up? PS: this is not homework, I'm just prepping for an upcoming exam.

EDIT: Found my error, its when I calculate the derivative

Real derivative was: $y_p'=-\frac{2cos\left(x\right)}{sin^3\left(x\right)}\cdot e^{-2C\left(x\right)}-\frac{2C'\left(x\right)}{sin^2\left(x\right)}\cdot e^{-2C\left(x\right)}$

And in the end everything will simplify, yielding the final result: $y\:=\:\frac{e^{-2C}-cos\left(x\right)}{sin^2x}$

  • $\begingroup$ You should take the right expression of the Constante C. $\endgroup$ – hamam_Abdallah Jun 30 '17 at 18:34

Let me give you an alternative for first order ODEs of the form

$$y' + p y = q$$ where $p$ and $q$ are given functions of $x$. Suppose we want to write this equation in the following easy-to-integrate form

$$ \left( I y \right)' = I q, $$ where $I \neq 0 $ is some suitable function. Expanding the derivative, dividing through $I$ and comparing with your original equation you'll find

$$ I = \exp\left( \int^x p(s) \, \mathrm{d}s\right)$$ which is commonly known as the integrating factor of the ODE.

Let's work out your case now. You have

\begin{equation} y' + \frac{2 \cos{x}}{\sin{x}} y = \frac{1}{\sin{x}} \end{equation}

By introducing

$$ \color{blue}{ I = \exp\left( \int^x \frac{2 \cos{x}}{\sin{x}} \mathrm{d}s \right) = \exp (\log{\sin^2{x}}) = \sin^2{x} } $$

the previous equation reduces to

$$ ( \sin^2{(x)} \, y)' = \sin{x} $$

which can be easily integrated to

$$ y = \frac{A}{\sin^2 x} - \frac{\cos{x}}{\sin^2 x} = A \operatorname{csc}^2x - \cot{x} \operatorname{csc}x, \quad A \in \mathbb{R} $$

Hope you find this alternative helpful.

  • 1
    $\begingroup$ And the downvote is for...? $\endgroup$ – Dmoreno Jun 30 '17 at 18:34
  • 1
    $\begingroup$ You'll never know. Happens to me regularly. Sigh . . . $\endgroup$ – Robert Lewis Jun 30 '17 at 18:37
  • $\begingroup$ Upvoted. I solved it with my method and got the same result as you. My mistake was when calculating the derivative of $sin^{-2}\left(x\right)$. $\endgroup$ – MikhaelM Jun 30 '17 at 18:49
  • $\begingroup$ Glad to hear we got the same result! @MikhaelM $\endgroup$ – Dmoreno Jun 30 '17 at 18:52


In $(k\pi,k\pi+\pi) $, the equation without RHS is

$$\frac {y'}{y}=-2\frac {\cos (x)}{\sin (x)} $$

$$\ln (\frac {y}{C})=-2\ln (|\sin (x)|) $$

$$y_o=C(\sin (x) )^{-2}$$

you can now find a particular solution $$y_p=C (x)(\sin (x))^{-2} $$

with $$C'(x)=\sin^2 (x)=\frac {1-\cos (2x)}{2} $$ thus $$C (x)=\frac {x}{2}-\frac {\sin (2x)}{4} .$$


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.