Solve $y d x-x d y=x^2 y d x$.
$$\begin{aligned} &\text { Given that, }\quad y d x-x d y=x^2 y d x\\ &\begin{array}{l} \Rightarrow & \frac{1}{x^2}-\frac{1}{x y} \cdot \frac{d y}{d x}=1 \quad \text { [dividing throughout by } x^2 y d x \text { ] }\\ \Rightarrow & -\frac{1}{x y} \cdot \frac{d y}{d x}+\frac{1}{x^2}-1=0 \\ \Rightarrow & \frac{d y}{d x}-\frac{x y}{x^2}+x y=0 \\ \Rightarrow & \frac{d y}{d x}-\frac{y}{x}+x y=0 \\ \Rightarrow & \frac{d y}{d x}+\left(x-\frac{1}{x}\right) y=0 \end{array} \end{aligned}$$
which is a linear differential equation.
On comparing it with $\frac{d y}{d x}+P y=Q$, we get
$$\begin{aligned} P & =\left(x-\frac{1}{x}\right), Q=0 \\ \mathrm{IF} & =e^{\int P d x} \\ & =e^{\int\left(x-\frac{1}{x}\right) d x} \\ & =e^{\frac{x^2}{2}-\log x} \\ & =e^{\frac{x^2}{x}}, e^{-\log x} \\ & =\frac{1}{x} e^{\frac{x^2}{2}} \end{aligned}$$
$$\begin{aligned} &\text { The general solution is }\\ &\begin{array}{l} & y \cdot \frac{1}{x} e^{x^2 / 2} =\int 0 \cdot \frac{1}{x} e^{x^2 / 2} d x+C \\ \Rightarrow & y \cdot \frac{1}{x} e^{x^2 / 2} =C \\ \Rightarrow & y =C x e^{-x^2 / 2} \end{array} \end{aligned}$$
Solve the differential equation $\frac{d y}{d x}=1+x+y^2+x y^2$, when $y=0$ and $x=0$.
$$\begin{aligned} \text{Given that,}\quad \frac{d y}{d x} & =1+x+y^2+x y^2 \\ \Rightarrow\quad\frac{d y}{d x} & =(1+x)+y^2(1+x) \\ \Rightarrow\quad\frac{d y}{d x} & =\left(1+y^2\right)(1+x) \\ \Rightarrow\quad\frac{d y}{1+y^2} & =(1+x) d x \end{aligned}$$
$$\begin{aligned} &\text { On integrating both sides, we get }\\ &\tan ^{-1} y=x+\frac{x^2}{2}+K\quad\text{.... (i)} \end{aligned}$$
When $y=0$ and $x=0$, then substituting these values in Eq. (i), we get
$$\begin{aligned} \tan ^{-1}(0) & =0+0+K \\ \Rightarrow \quad K & =0 \\ \Rightarrow \quad \tan ^{-1} y & =x+\frac{x^2}{2} \\ \Rightarrow \quad y & =\tan \left(x+\frac{x^2}{2}\right) \end{aligned}$$
Find the general solution of $\left(x+2 y^3\right) \frac{d y}{d x}=y$.
Given that, $$\left(x+2 y^3\right) \frac{d y}{d x}=y$$
$$\begin{array}{ll} \Rightarrow & y \cdot \frac{d x}{d y}=x+2 y^3 \\ \Rightarrow & \frac{d x}{d y}=\frac{x}{y}+2 y^2 \quad\text{[dividing throughout by y]}\\ \Rightarrow & \frac{d x}{d y}-\frac{x}{y}=2 y^2 \end{array}$$
which is a linear differential equation.
On comparing it with $\frac{d x}{d y}+P x=Q$, we get
$$ \begin{aligned} P & =-\frac{1}{y}, Q=2 y^2 \\ \mathrm{IF} & =e^{\int-\frac{1}{y} d y}=e^{-\int \frac{1}{y} d y} \\ \therefore\quad & =e^{-\log y}=\frac{1}{y} \end{aligned}$$
$$\begin{array}{ll} \text { The general solution is } & x \cdot \frac{1}{y}=\int 2 y^2 \cdot \frac{1}{y} d y+C \\ \Rightarrow & \frac{x}{y}=\frac{2 y^2}{2}+C \\ \Rightarrow & \frac{x}{y}=y^2+C \\ \Rightarrow & x=y^3+C y \end{array}$$
If $y(x)$ is a solution of $\left(\frac{2+\sin x}{1+y}\right) \frac{d y}{d x}=-\cos x$ and $y(0)=1$, then find the value of $y\left(\frac{\pi}{2}\right)$.
Given that, $\quad\left(\frac{2+\sin x}{1+y}\right) \frac{d y}{d x}=-\cos x$
$\Rightarrow \quad \frac{d y}{1+y}=-\frac{\cos x}{2+\sin x} d x$
On integrating both sides, we get
$$\int \frac{1}{1+y} d y=-\int \frac{\cos x}{2+\sin x} d x$$
$\Rightarrow \quad \log (1+y)=-\log (2+\sin x)+\log C$
$$\begin{array}{r} \Rightarrow & \log (1+y)+\log (2+\sin x)=\log C \\ \Rightarrow & \log (1+y)(2+\sin x)=\log C \\ \Rightarrow & (1+y)(2+\sin x)=C \\ \Rightarrow & 1+y=\frac{C}{2+\sin x} \\ \Rightarrow & y=\frac{C}{2+\sin x}-1\quad\text{.... (i)} \end{array}$$
$$ \begin{aligned} &\text { When } x=0 \text { and } y=1 \text {, then }\\ &1=\frac{C}{2}-1\\ \Rightarrow\quad &=C=4 \end{aligned}$$
On putting C = 4 in Eq. (i), we get
$$\begin{aligned} y & =\frac{4}{2+\sin x}-1 \\ \therefore\quad y\left(\frac{\pi}{2}\right) & =\frac{4}{2+\sin \frac{\pi}{2}}-1=\frac{4}{2+1}-1 \\ & =\frac{4}{3}-1=\frac{1}{3} \end{aligned}$$
If $y(t)$ is a solution of $(1+t) \frac{d y}{d t}-t y=1$ and $y(0)=-1$, then show that $y(1)=-\frac{1}{2}$.
$$\begin{aligned} &\text { Given that, }\\ &(1+t) \frac{d y}{d t}-t y=1\\ &\Rightarrow \quad \frac{d y}{d t}-\left(\frac{t}{1+t}\right) y=\frac{1}{1+t} \end{aligned}$$
which is a linear differential equation.
On comparing it with $\frac{d y}{d t}+P y=Q$, we get
$$\begin{aligned} P & =-\left(\frac{t}{1+t}\right), Q=\frac{1}{1+t} \\ I F & =e^{-\int \frac{t}{1+t} d t}=e^{-\int\left(1-\frac{1}{1+t}\right) d t=e^{-[t-\log (1+t)]}} \\ & =e^{-t} \cdot e^{\log (1+t)} \\ & =e^{-t}(1+t) \end{aligned}$$
The general solution is
$$\begin{aligned} y(t) \cdot \frac{(1+t)}{e^t} & =\int \frac{(1+t) \cdot e^{-t}}{(1+t)} d t+C \\ \Rightarrow\quad y(t) & =\frac{e^{-t}}{(-1)} \cdot \frac{e^t}{1+t}+C^{\prime}, \text { where } C^{\prime}=\frac{C e^t}{1+t} \\ \Rightarrow\quad y(t) & =-\frac{1}{1+t}+C^{\prime} \end{aligned}$$
When $t=0$ and $y=-1$, then
$$\begin{aligned} -1 & =-1+C^{\prime} \Rightarrow C^{\prime}=0 \\ y(t) & =-\frac{1}{1+t} \Rightarrow y(1)=-\frac{1}{2} \end{aligned}$$