= Solution
For $y\ne0$, the <Bernoulli differential equation> becomes linear under $u=1/y$. Multiplying the equation by $-y^{-2}$ gives
$$
u'-\frac2xu=x^2\cos x.
$$
On an interval with $x\ne0$, the <integrating factor> is $x^{-2}$, hence
$$
\frac d{dx}\left(\frac u{x^2}\right)=\cos x,
\qquad u=x^2(C+\sin x).
$$
Therefore the complete set of solution branches is
$$
\boxed{y=0\quad\text{or}\quad
y(x)=\frac1{x^2(C+\sin x)}.}
$$
The original equation requires $x\ne0$; each nonzero branch additionally requires $C+\sin x\ne0$. The zero solution is restored explicitly because the reciprocal substitution excludes it.
Back to article page