\documentclass[a4paper,12pt]{article}
\newcommand{\ds}{\displaystyle}
\newcommand{\un}{\underline}
\parindent=0pt
\begin{document}

{\bf Question}

Find the general solution of the following differential equations

\begin{description}
\item[(i)]
$\ds\frac{dy}{dx}+y=x$

\item[(ii)]
$x\ds\frac{dy}{dx}=2x-y$

\item[(iii)]
$\ds\frac{dy}{dx}-\ds\frac{y}{x}=x^2-3$

\item[(iv)]
$\sin x\left(\ds\frac{dy}{dx}\sin x+2y\cos x\right)=\sec^2 x$

\item[(v)]
$x^2\ds\frac{dy}{dx}+2xy=3\sin x+1$

\item[(vi)]
$\tan x \ds\frac{dy}{dx}\ds\frac{dy}{dx}+y=-y\tan^2 x$

\end{description}

\medskip

{\bf Answer}
\begin{description}
\item[(i)]
$\ds\frac{dy}{dx}+y=x$

Not variables separable. Not homogeneous. Possibly exact.

LHS=$\ds\frac{d}{dx}(xy)$

Thus

$\begin{array} {crcl} & \ds\frac{d}{dx}(xy) & = & x\\ \Rightarrow
& xy & = & \ds\int x \,dx+c \end{array}$

$\Rightarrow \un{xy=\ds\frac{x^2}{2}+c}$

\newpage
\item[(ii)] %note ref to class notes%
$x\ds\frac{dy}{dx}=2x-y$

Solve as a linear equation.

$x\ds\frac{dy}{dx}+y=2x \Rightarrow
\ds\frac{dy}{dx}+\ds\frac{y}{x}=2 (\star)$

of $\ds\frac{dy}{dx}+Py=Q \Rightarrow P=\ds\frac{1}{x},\ Q=2$

Thus integrating factor is

\begin{eqnarray*} R & = & \exp\left(\ds\int P\,dx\right)\\ R & = &
\exp\left(\ds\int \ds\frac{dx}{d}\right)\\ & = & \exp(\ln x)\\ & =
& x \end{eqnarray*}

Thus multiplying $(\star)$ by $R$ we have:

$\begin{array} {crcl} & x\ds\frac{dy}{dx}+x\ds\frac{y}{x} & = &
2x\\ \Rightarrow & x\ds\frac{dy}{dx}+y & = & 2x \end{array}$

(what we started off with!)

Thus from notes

$$\ds\frac{d}{dx}(xy)=2x \Rightarrow \un{xy=x^2+c}$$

\item[(iii)]
$\ds\frac{dy}{dx}-\ds\frac{y}{x}=x^2-3\ \ (\star)$ of
$\ds\frac{dy}{dx}+Py=Q$

$\Rightarrow P=-\ds\frac{1}{x},\ Q=x^2-3$

Thus integrating factor is
$R=\exp\left(\ds\int-\ds\frac{1}{x}\,dx\right)=\exp(-\ln
x)=\ds\frac{1}{x}$

Thus $\times (\star)$ by $R$

$$\ds\frac{1}{x}\ds\frac{dy}{dx}-\ds\frac{y}{x^2}=(x^2-3)\ds\frac{1}{x}$$

$\begin{array} {crcl} \rm{or} &
\ds\frac{d}{dx}\left(y\ds\frac{1}{x}\right) & = &
\ds\frac{(x^2-3)}{x}\\ \Rightarrow & \ds\frac{y}{x} & = &
\ds\int\ds\frac{(x^2-3)}{x}\,dx +c\\ \Rightarrow & \ds\frac{y}{x}
& = & \ds\int x \,dx-3\ds\int\ds\frac{dx}{x}+c\\ \Rightarrow &
\ds\frac{y}{x} & = &\ds\frac{x^2}{2}-3\ln x+c\end{array}$


$\ \Rightarrow \un{2y = x^3-6x\ln x+cx}$

\item[(iv)]%note ref to class notes%

$\sin x\left(\ds\frac{dy}{dx}\sin x+2y\cos x\right)=\sec^2 x$

$$\ds\frac{dy}{dx}+2y\ds\frac{\cos x}{\sin x}=\ds\frac{1}{\cos^2
x\sin^2 x}\ (\star)$$

of $\ds\frac{dy}{dx}+Py=Q \Rightarrow P=2\ds\frac{\cos x}{\sin
x},\ Q=\ds\frac{1}{\cos^2 x\sin^2 x}$

Thus integrating factor

$$R=\exp\left(\ds\int 2\ds\frac{\cos x}{\sin x}
\,dx\right)=\exp(2\ln \sin x)$$

$2\ds\int\cot x \,dx=2\ln \sin x$ standard integral.

Thus
\begin{eqnarray*} R & = & \exp(2\ln\sin x)\\ & = & \exp(\ln[\sin
x]^2)\\ & = & \sin^2 x \end{eqnarray*}

Thus $\times (\star)$ by $\sin^2 x$ to get

$$\sin^2 x \ds\frac{dy}{dx}+2y\cos x\sin x=\ds\frac{1}{\cos^2 x}$$

i.e., what we started off with! Thus from notes LHS is

$\begin{array} {crcl} & \ds\frac{d}{dx}([\sin^2 x]y) & = &
\ds\frac{1}{\cos^2 x}\\ \Rightarrow & y\sin^2 x & = &
\ds\int\sec^2 x \,dx \end{array}$

$\ \Rightarrow \un{y\sin^2 x = \tan x+c}$ (both standard
integrals)

\item[(v)]
$x^2\ds\frac{dy}{dx}+2xy=3\sin x+1$

This is exact or linear with LHS:

$\begin{array} {crcl} &\ds\frac{d}{dx}(x^2y) & = & 3\sin x+1\\
\Rightarrow & x^2y & = & \ds\int(3\sin x+1) \,dx \end{array}$

$\un{x^2y=3\cos x +x+c}$

\item[(vi)]
$\tan x \ds\frac{dy}{dx}\ds\frac{dy}{dx}+y=-y\tan^2 x$

$\Rightarrow \ds\frac{dy}{dx}=y\ds\frac{(1+\tan^2 x)}{\tan x}=0\
(\star)$

cf $\ds\frac{dy}{dx}+Py=Q$

This is linear:

$\Rightarrow P=\ds\frac{1+\tan^2 x}{\tan x},\ Q=0$

Integrating factor

\begin{eqnarray*} R & = &
\exp\left(\ds\int\ds\frac{1+\tan^2x}{\tan x} \,dx\right)\\ & = &
\exp\left(\ds\int\cot x \,dx +\ds\int \tan x \,dx\right)\\ & = &
\exp\left(\ds\int\ds\frac{\cos x}{\sin x}
\,dx+\ds\int\ds\frac{\sin x}{\cos x} \,dx\right)\\ & = &
\exp(\ln(\sin x)-\ln(\cos x))\\ & = &
\exp\left(\ln\left(\ds\frac{\sin x}{\cos x}\right)\right)\\ & = &
\exp(\ln(\tan x))\\ & = & \tan x \end{eqnarray*}

Thus multiplying $(\star)$ through by $R$ we have

$\begin{array} {crcl} & \tan x\ds\frac{dy}{dx} = (1+\tan^2x)y & =
& 0\\ \Rightarrow & \tan x \ds\frac{dy}{dx}+\sec^2 xy & = & 0\\
\Rightarrow & \ds\frac{d}{dx}(y \tan x) & = & 0\end{array}$

$\ \Rightarrow \un{y\tan x=c}$
\end{description}

\end{document}
