# First order differential equations

## Solution by substitution—Bernoulli's DE

Let us have DE

$$\begin{equation} \frac{dy}{dx}+P(x)y = f(x)\cdot \color{red}{y^n} \label{ref:bern_std} \end{equation}$$

Such DE reminds us linear DE except the member $y^n$. For $n=1$ it is solvable by separating variables. For other $n$ it can be transformed into linear DE by means of substitution

$$\begin{equation} \color{red}{u = y^{1-n}}. \label{ref:bern0} \end{equation}$$

If we multiply DE by

$$\begin{equation} \color{red}{(1-n)y^{-n}} \label{ref:bern_mult} \end{equation}$$

the problematic member $y^n$ on the right side will be canceled (note/hint: you may realize relationship between above $u = y^{1-n}$ and $(1-n)y^{-n}$; just differentiate $u$ with respect to $y$.)

\begin{align} \color{blue}{(1-n)y^{-n}\frac{dy}{dx}} + (1-n)y^{-n}P(x)y &= (1-n)y^{-n}f(x)y^{n} \label{ref:bern1} \\ \color{blue}{\frac{d}{dx}y^{1-n}} + (1-n)y^{-n}P(x)y &= (1-n)f(x) \label{ref:bern2} \\ \end{align}
$$\begin{equation} \color{blue}{\frac{du}{dx}} + (1-n)y^{-n}P(x)y = (1-n)f(x) \label{ref:bern3} \end{equation}$$

From $(\ref{ref:bern1})$ to $(\ref{ref:bern2})$ we go against chain rule (from $(\ref{ref:bern2})$ to $(\ref{ref:bern1})$ there is $y$ differentiated with respect to $x$).

From $(\ref{ref:bern2})$ to $(\ref{ref:bern3})$ we have to recognize just the substitution $(\ref{ref:bern0})\ u = y^{1-n}$ itself.

The DE $(\ref{ref:bern_std})$ has been transformed into linear DE.

### Example

Solve $y' + xy = x\cdot y^{-3}, \hskip1em y \neq 0$.

We have to multiply the DE by $y^3$ to eliminate $y^{-3}$ on the right side. Let us follow the proposed way of using substitution $u = y^{1-n} = y^{1 - (-3)} = y^4$. Now let us multiply both sides of DE by $u' = 4y^3$ (see $(\ref{ref:bern_mult})$).

\begin{align} 4y^3y'+4y^4x &= 4x \nonumber \\ \frac{du}{dx} + \color{red}{4x}u &= 4x \nonumber \\ \end{align}

We transformed given DE into linear DE which is solved by means of integrating factor $\mu(x)$:

\begin{align} &\mu(x) = e^{\intop{P(x)\ dx}} = e^{\intop{4x\ dx}} = e^{2x^2} \nonumber \\ &e^{2x^2} \frac{du}{dx} + e^{2x^2} 4 ux = e^{2x^2} 4x \nonumber \end{align}

Since we are solving linear DE, we have an experience that on the left side is $d/dx\ \mu(x) u$ to be found:

\begin{align} \frac{d}{dx} (e^{2x^2})u &= e^{2x^2}4x \nonumber\\ e^{2x^2}u &= \intop{e^{2x^2}4x \ dx} \nonumber\\ e^{2x^2}u &= e^{2x^2} + c \nonumber\\ u &= 1 + ce^{-2x^2} \nonumber \end{align}

Now let us go against the substitution to get final solution.

$$\underline{\underline{y^4 = 1 + ce^{-2x^2}}}$$

### Example

Solve $xy' + y = y^{2} \log x$.

First let us bring DE into the standard form $(\ref{ref:bern_std})$:

$$\frac{dy}{dx} = \frac{1}{x}y = y^2\frac{\log x}{x}$$

We need to eliminate $y^2$ on the right side to convert DE into linear DE. Let us follow the proposed way of using substitution $u = y^{1-n} = y^{1 - 2} = y^{-1}$. Now let us multiply both sides of DE by $u' = -y^{-2}$ (see $(\ref{ref:bern_mult})$).

\begin{align} -y^{-2}\frac{dy}{dx} - y^{-2}\frac{1}{x}y &= -\frac{\log x}{x} \nonumber \\ \frac{d}{dx}u - y^{-1}\frac{1}{x} &= -\frac{\log x}{x} \nonumber \\ \frac{d}u{dx} \color{red}{-\frac{1}{x}}u &= -\frac{\log x}{x} \nonumber \\ \end{align}

We have linear DE with integrating factor $P(x) = -1/x$:

$$\mu(x) = e^{\int{P(x)\ dx}} = e^{-\int{\frac 1 x\ dx}} = e^{-\log x} = x^{-1} \nonumber \\$$

Now let us use integrating factor to multiply both sides:

\begin{align} x^{-1}\frac{du}{dx} - x^{-1}\frac 1 x u &= -x^{-1}\frac{\log x}{x} \nonumber \\ \frac {d}{dx}(x^{-1})u &= -\frac{\log x}{x^2} \nonumber \\ x^{-1} u &= \frac{\log x}{x} + \frac 1 x + c \nonumber \\ u &= {\log x} + 1 + cx \nonumber \\ y^{-1} &= {\log x} + 1 + cx \nonumber \\ 1 &= y\ {\log x} + y + cxy \nonumber \\ \end{align}

That might be simplified into

$$\underline{\underline{y = \frac{1}{\log x+1 + cx}}}$$

### Example

Solve $dy/dx + 6y = 30e^{3x}y^{2/3}$.

The DE is already in the standard form $(\ref{ref:bern_std})$. In order to eliminate $y^{2/3}$ on the right side, we have to multiply whole DE by $y^{-2/3}$. We will use substitution $u=y^{1-n} = y^{(1-2/3)} = y^{1/3}$. Then we have to multiply DE by $u' = 1/3\ y^{-2/3}$ (check $(\ref{ref:bern_mult})$).

\begin{align} \frac 1 3 y^{{-2}/{3}} \frac{dy}{dx} + \frac 1 3 y^{-2/3} 6y &= 30e^{3x}y^{2/3}\frac 1 3 y^{-2/3} \nonumber \\ \frac {du}{dx} + 2y^{1/3} &= 10e^{3x} \nonumber \\ \frac {du}{dx} + 2u &= 10e^{3x} \nonumber \end{align}

Now it is linear DE with $P(x) = 2 \implies \mu(x) = e^{2x}$. Let us multiply DE by the integrating factor, then we know that on the left side we will find $d/dx\ \mu(x)u$:

\begin{align} \frac{d}{dx} e^{2x}u &= e^{2x}\cdot10 e^{3x} \nonumber \\ e^{2x}u &= \frac{10}{5}e^{5x} + c \nonumber \\ u &= 2e^{3x} + \frac{c}{e^{2x}} \nonumber \\ y^{1/3} &= 2e^{3x}+ce^{-2x} \nonumber \end{align}

Then the solution is

$$\underline{\underline{y = (2e^{3x}+ce^{-2x})^3}}$$

### Example

Solve $6y' - 2y = xy^4,\hskip1em y(0)=-2$.

It can be observed that the DE is of Benoulli type. However it is needed to bring the DE into standard form firstly.

$$y'-\frac 1 3 y = \frac 1 6 xy^4$$

The substitution has to be $u = y^{1-n} = y^{-3}$ and we multiply DE by $u' = -3y^{-4}$.

\begin{align} -3y^{-4}y' - (-3y^{-4})(\frac{1}{3}y) &= -3y^{-4}\frac 1 6 xy^4 \nonumber \\ \frac{du}{dx} + y^{-3} &= -\frac{3}6 x \nonumber \\ \frac{du}{dx} + u\cdot 1 &= -\frac{3}6 x \nonumber \\ \end{align}

Now it is linear DE with $P(x) = 1$ and the integrating factor is $\mu(x) = e^x$.

$$e^x \frac{du}{dx} + e^xu = -e^x\frac 1 2 x$$

It is expected that what is on the left side is $d/dx\ \mu(x)u$ and you can check that is is indeed.

\begin{align} \frac{d}{dx}e^xu &= -e^x\frac{1}{2}x \nonumber \\ e^xu &= -\frac1 2 \int x e^x dx \nonumber \end{align}

The integral $\int x e^x dx = xe^x - e^x$ have to be evaluated by parts.

From $(uv)' = u'v + uv' \implies u'v = (uv)' - uv' \implies \int {u'v\ dx} = uv - \int{uv' dx}$:

$$\int {x e^x \ dx} = \begin{vmatrix} v = x & v' = 1 \\ u' = e^x & u = e^x \end{vmatrix} = xe^x-\int{e^x\ dx = xe^x-e^x + c}$$
\begin{align} e^xu &= -\frac1 2 ( x e^x -e^x) +c \nonumber \\ u &= -\frac 1 2(x-1)+ce^{-x} \nonumber \end{align}

The general solution is then

$$y^{-3} = -\frac 1 2(x-1)+ce^{-x}. \nonumber$$

Applying initial value to determine $c$:

\begin{align} \big(\frac{1}{-2}\big)^3 &= -\frac{1}{2} (0-1) + ce^0 \nonumber \\ -\frac 1 2 - \frac 1 8 &= c \implies c = -\frac 5 8 \nonumber \end{align}

The particular solution is then

$$\underline{\underline{y^{-3} = -\frac 1 2 (x-1) - \frac 5 8 e^{-x}}}$$

List of chapters