# Cassi's question at Yahoo! Answers regarding a first order linear ODE

#### MarkFL

Staff member
Here is the question:

Initial value problem?

Find all the solutions of y'+ycotx=2cosx on the interval (o, pi). Prove that exactly one of these is a solution on (-infinity, +infinity)
I have posted a link there to this thread so the OP can view my work.

#### MarkFL

Staff member
Hello Cassi,

We are given the ODE:

$$\displaystyle y'+y\cot(x)=2\cos(x)$$

If we multiply through by $\sin(x)\ne0$ (which we can do given the interval) we obtain:

$$\displaystyle \sin(x)\frac{dy}{dx}+\frac{d}{dx}(\sin(x))y=2\sin(x)\frac{d}{dx}(\sin(x))$$

Observing that we have the product rule on the right, we may integrate as:

$$\displaystyle \int\,d\left(\sin(x)y \right)=2\int \sin(x)\,d(\sin(x))$$

$$\displaystyle \sin(x)y=\sin^2(x)+C$$

And thus, dividing through by $\sin(x)$, we obtain:

$$\displaystyle y(x)=\sin(x)+C\csc(x)$$

Now, for any choice of $C\ne0$, we encounter division by zero for $x=k\pi$ where $k\in\mathbb{Z}$, and so the only solution defined over all the reals is:

$$\displaystyle y(x)=\sin(x)$$