Find the general solution for each of the following differential equations. \frac{d y}{d x}+y \cot x=x^{2} \cot x+2 x
Find the general solution for each of the following differential equations. \frac{d y}{d x}+y \cot x=x^{2} \cot x+2 x

Solution:

\frac{d y}{d x}+\operatorname{ycot} x=x^{2} \cot x+2 x\dots(1)
To solve (1) we will use following formula
\begin{array}{l} \int \cot x d x=\log |\sin x| \\ a^{\log _{a} b=} \mathrm{b} \\ \int u \cdot v d x=\mathrm{u} \cdot \int v d x-\int\left(\frac{d u}{d x} \cdot \int v d x\right) \mathrm{d} \mathrm{x} \\ \int \cos x d x=\sin x \\ \frac{d}{d x}\left(x^{n}\right)=\mathrm{n} x^{n-1} \end{array}
General solution for the differential equation in the form of \frac{d y}{d x}+\mathrm{Py}=\mathrm{Q}
General solution is given by,
\begin{array}{l} \text { y. }(I . F .)=\int Q \cdot(I . F .)^{\mathrm{d} x+\mathrm{c}} \\ y .(I . F .)=\int Q \cdot(I . F .) d x+c \end{array}
Where, integrating factor,
\begin{array}{l} \text { I.F. }=e \int^{P d x} I . F .=e \int p d x \\ \frac{d y}{d x}+y \cot x=x^{2} \cot x+2 x \ldots \ldots . . \end{array}
Equation (1) is of the form
\frac{d y}{d x}+\mathrm{P} \mathrm{y}=\mathrm{Q}
Where, \mathrm{P}=\cot x and \mathrm{Q}=x^{2} \cot x+2 \mathrm{x}
Therefore, integrating factor is
\begin{array}{l} \text { I.F. }=e \int^{P d x} I . F .=e \int p d x \\ =e \int \cot x d x \\ =e^{\log _{\mid}|\sin x|} \ldots \ldots \ldots\left(\because \int \cot x d x=\log _{\mid} \sin x \mid\right) \\ =\sin x \ldots \ldots \ldots\left(\because a^{\log _{a} b}=b\right) \end{array}
General solution is
\begin{array}{l} \text { y. }(\text { I. } F .)=\int Q \cdot(I . F .) \mathrm{d} \mathrm{x}+\mathrm{c} \\ y .(I . F .)=\int Q \cdot(\text { I.F. }) d x+c \\ \therefore y \cdot(\sin x)=\int\left(x^{2} \cot x+2 x\right) \cdot(\sin x) \mathrm{dx}+\mathrm{c} \\ \therefore \mathrm{y} \cdot(\sin x)=\int\left(x^{2} \cot x \cdot \sin x+2 x \sin x\right) \mathrm{d} \mathrm{x}+\mathrm{c} \\ \therefore \mathrm{y} \cdot(\sin x)=\int\left(x^{2} \frac{\cos x}{\sin x} \cdot \sin x+2 x \sin x\right) \mathrm{dx}+\mathrm{c} \\ \therefore \mathrm{y} \cdot(\sin x)=\int \mathrm{x}^{2} \operatorname{Cos} \mathrm{x} \mathrm{dx}+\int 2 \mathrm{x} \sin \mathrm{x} \mathrm{d} \mathrm{x}+\mathrm{c} \ldots \ldots \ldots \text { eq }(2) \end{array}
I=\int x^{2} \operatorname{Cos} x d x
Let, u=x^{2} and v=\cos x
\begin{array}{l} I=x^{2} \int \operatorname{Cos} x d x-\int \frac{d}{d t}\left(x^{2}\right) \cdot \int \operatorname{Cos} x d x \\ I=x^{2} \operatorname{Sin} x-\int 2 x \operatorname{Sin} x d x \end{array}
Substituting I in (2),
y \cdot \operatorname{Sin} x=x^{2} \cdot \operatorname{Sin} x+c
Dividing above equation by \sin x,
\mathrm{y}=\mathrm{x}^{2}+\frac{c}{\sin x}
Therefore, general solution is
y=x^{2}+c(\operatorname{cosec} x)