Find a particular solution of the differential equation

Question:

Find a particular solution of the differential equation $(x+1) \frac{d y}{d x}=2 e^{-y}-1$, given that $y=0$ when $x=0$

Solution:

$(x+1) \frac{d y}{d x}=2 e^{-y}-1$

$\Rightarrow \frac{d y}{2 e^{-y}-1}=\frac{d x}{x+1}$

$\Rightarrow \frac{e^{y} d y}{2-e^{y}}=\frac{d x}{x+1}$

Integrating both sides, we get:

$\int \frac{e^{y} d y}{2-e^{y}}=\log |x+1|+\log \mathrm{C}$                   ...(1)

Let $2-e^{y}=t$.

$\therefore \frac{d}{d y}\left(2-e^{y}\right)=\frac{d t}{d y}$

$\Rightarrow-e^{y}=\frac{d t}{d y}$

$\Rightarrow e^{y} d t=-d t$

Substituting this value in equation (1), we get:

$\int \frac{-d t}{t}=\log |x+1|+\log \mathrm{C}$

$\Rightarrow-\log |t|=\log |\mathrm{C}(x+1)|$

$\Rightarrow-\log \left|2-e^{y}\right|=\log |\mathrm{C}(x+1)|$

$\Rightarrow \frac{1}{2-e^{y}}=\mathrm{C}(x+1)$

$\Rightarrow 2-e^{y}=\frac{1}{\mathrm{C}(x+1)}$          ...(2)

Now, at x = 0 and y = 0, equation (2) becomes:

$\Rightarrow 2-1=\frac{1}{C}$

$\Rightarrow C=1$

Substituting C = 1 in equation (2), we get:

$2-e^{y}=\frac{1}{x+1}$

$\Rightarrow e^{y}=2-\frac{1}{x+1}$

$\Rightarrow e^{y}=\frac{2 x+2-1}{x+1}$

$\Rightarrow e^{y}=\frac{2 x+1}{x+1}$

$\Rightarrow y=\log \left|\frac{2 x+1}{x+1}\right|,(x \neq-1)$

This is the required particular solution of the given differential equation.