Solve the differential equation $\frac{d y}{d x}+1=e^{x+y}$.
Given differential equation is $\quad \frac{d y}{d x}+1=e^{x+y}\quad\text{.... (i)}$
On substituting $x+y=t$, we get
$$1+\frac{d y}{d x}=\frac{d t}{d x}$$
Eq. (i) becomes $$\frac{d t}{d x}=e^t$$
$$ \begin{array}{ll} \Rightarrow & e^{-t} d t=d x \\ \Rightarrow & -e^{-t}=x+C \\ \Rightarrow & \frac{-1}{e^{x+y}}=x+C \\ \Rightarrow & -1=(x+C) e^{x+y}\\ \Rightarrow & (x+C) e^{x+y}+1=0 \end{array}$$
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}$$