Differential Equations

Solve the differential equation $x \; y \; \dfrac{dy}{dx} = y + 2$.
Also find the particular solution when the initial conditions are $y \left(2\right) = 0$.


The given differential equation is $\;\;$ $x \; y \; \dfrac{dy}{dx} = y + 2$

i.e. $\dfrac{y \; dy}{y + 2} = \dfrac{dx}{x}$ $\;\;\; \cdots \; (1)$

Integrating equation $(1)$ gives

$\displaystyle \int \dfrac{y \; dy}{y + 2} = \int \dfrac{dx}{x}$ $\;\;\; \cdots \; (2)$

$\begin{aligned} \text{Now, } \int \dfrac{y}{y + 2} dy & = \int \dfrac{y + 2}{y + 2} \; dy - 2 \int \dfrac{dy}{y + 2} \\\\ & = \int dy - 2 \int \dfrac{dy}{y + 2} \\\\ & = y - 2 \log \left|y + 2\right| + \log \left|c_1\right| \;\;\; \cdots \; (3a) \end{aligned}$

and $\displaystyle \int \dfrac{dx}{x} = \log \left|x\right| + \log \left|c_2\right|$ $\;\;\; \cdots \; (3b)$

$\therefore$ $\;$ In view of equations $(3a)$ and $(3b)$, equation $(2)$ becomes

$y - 2 \log \left|y + 2\right| + \log \left|c_1\right| = \log \left|x\right| + \log \left|c_2\right|$

i.e. $y - 2 \log \left|y + 2\right| = \log \left|x\right| + \log \left|c_2\right| - \log \left|c_1\right|$

i.e. $y - 2 \log \left|y + 2\right| = \log \left|x\right| + \log \left|\dfrac{c_2}{c_1}\right|$

i.e. $y - 2 \log \left|y + 2\right| = \log \left|x\right| + \log \left|c\right|$ $\;$ where $c = \dfrac{c_2}{c_1}$

i.e. $y = \log \left|x\right| + \log \left|\left(y + 2\right)^2\right| + \log \left|c\right|$

i.e. $y = \log \left|c \; x \; \left(y + 2\right)^2\right|$

i.e. $e^y = c \; x \; \left(y + 2\right)^2$ $\;\;\; \cdots \; (4)$

Equation $(4)$ is the general solution of the given differential equation.

Given: when $x = 2$, $y = 0$

Substituting the values of x and y in equation $(4)$ gives

$e^0 = c \times 2 \times \left(0 + 2\right)^2$

i.e. $1 = 8 c$ $\implies$ $c = \dfrac{1}{8}$ $\;\;\; \cdots \; (5)$

Substituting the value of c from equation $(5)$ in equation $(4)$ gives

$e^y = \dfrac{1}{8} \times x \times \left(y + 2\right)^2$

i.e. $8 e^y = x \left(y + 2\right)^2$ $\;\;\; \cdots \; (6)$

Equation $(6)$ is the particular solution of the given differential equation when $y \left(2\right) = 0$.