Solving Separable Differential Equations Examples 1

# Solving Separable Differential Equations Examples 1

Recall from the Solving Separable Differential Equations page that if we have a separable differential equation $M(x) + N(y) \frac{dy}{dx} = 0$, then we can rewrite it as:

(1)
\begin{align} \quad \int N(y) \: dy = \int - M(x) \: dx \end{align}

Provided that these integrals can be evaluated and that they're not too difficult to do so, then we can obtain solutions for the separable differential equation.

We will now look at some examples of solving separable differential equations. At this present time, we will not be concerned as to whether these solutions are always valid for all of $\mathbb{R}$. In fact, many of the solutions we present are only defined on a specific interval. We will look more into this later.

## Example 1

Find all solutions to the differential equation $\frac{dy}{dx} = xe^{x^2} e^{-\ln (y^2)}$.

We will first rewrite the differential equation above so that it is in the appropriate form.

(2)
\begin{align} \quad \frac{dy}{dx} = xe^{x^2} e^{-\ln (y^2)} \\ \quad \frac{dy}{dx} = xe^{x^2} e^{\ln \left (\frac{1}{y^2} \right )} \\ \quad \frac{dy}{dx} = \frac{xe^{x^2}}{y^2} \\ \quad y^2 \frac{dy}{dx} = xe^{x^2} \\ \quad \int y^2 \: dy = \int xe^{x^2} \: dx \end{align}

The integral on the lefthand side is relatively easy to compute, but for the integral on the righthand side we will use substitution. Let $u = x^2$. Then $du = 2x \: dx$ and so we have that $\int xe^{x^2} \: dx = \int \frac{e^u}{2} \: du = \frac{e^u}{2} + C = \frac{e^{x^2}}{2} + C$ and therefore for $C$ as a constant our solution to our differential equation is:

(3)
\begin{align} \quad \frac{y^3}{3} = \frac{e^{x^2}}{2} + C \\ \end{align} ## Example 2

Solve the initial value problem $\frac{dy}{dx} = \frac{4 \sin 2x}{y}$ where $y(0) = 1$. For what interval is this solution valid?

We will first rewrite the differential equation above as $y \frac{dy}{dx} = 4 \sin 2x$. So for $C > -4$ as a constant we have that:

(4)
\begin{align} \quad y \frac{dy}{dx} = 4 \sin 2x \\ \quad y \: dy = 4 \sin 2x \: dx \\ \quad \int y \: dy = \int 4 \sin 2x \: dx \\ \quad \frac{y^2}{2} = -2 \cos 2x + C \\ \quad y^2 = -4 \cos 2x + 2C \end{align}

Now we will solve the initial value problem. Note that we have two sets of solutions, that is $y = \sqrt{-4 \cos 2x + 2C}$ and $y = -\sqrt{-4 \cos 2x + 2C}$. We were given the initial value $y(0) = 1$ and so we're dealing with the positive square root $y = \sqrt{-4 \cos 2x +2C}$. Some solutions for the differential equation above with regards to the positive square root $y = \sqrt{-4 \cos 2x +2C}$ are given in the graph below: Now, plugging in $y(0) = 1$ we get that:

(5)
\begin{align} \quad 1 = y(0) = \sqrt{-4 + 2C} \\ \quad 1 = -4 + 2C \\ \quad 5 = 2C \\ \quad C = \frac{5}{2} \end{align}

Therefore our solution to the initial value problem is $y = \sqrt{-4 \cos 2x + 5}$.

We note that our solution is valid provided that $-4 \cos 2x + 5 ≥ 0$. However, the cosine function is bounded since $-1 ≤\cos 2x ≤ 1$ and so $-4 ≤ -4 \cos 2x ≤ 4$. As a result, $-4 ≤ -4 \cos 2x$ and so $-4 \cos 2x + 5 ≥ 1 ≥ 0$ for all $x \in \mathbb{R}$. Therefore our solution is valid for all $x \in \mathbb{R}$.

The following image is the graph of our solution $y = \sqrt{-4\cos 2x + 5}$: ## Example 3

Find all solutions to the differential equation $\frac{dy}{dx} = e^{-x}y^2 - e^{-x} + y^2 - 1$.

We first note that we can rewrite the following differential equation above as $\frac{dy}{dx} = (e^{-x} + 1)(y^2 - 1)$ and separate and solve it as follows:

(6)
\begin{align} \quad \frac{dy}{dx} = (e^{-x} + 1)(y^2 - 1) \\ \quad \frac{1}{y^2 - 1} \frac{dy}{dx} = (e^{-x} + 1) \\ \quad \frac{1}{y^2 - 1} \: dy = (e^{-x} + 1) \: dx \\ \quad \int \frac{1}{y^2 - 1} \: dy = \int (e^{-x} + 1) \: dx \end{align}

The integral on the lefthand side will be rather tedious to compute, but it can be done by partial fractions. We note that $\frac{1}{y^2 - 1} = \frac{1}{(y + 1)(y - 1)} = \frac{A}{(y + 1)} + \frac{B}{(y - 1)}$ for some $A, B \in \mathbb{R}$. Thus we have that $\frac{1}{(y+1)(y-1)} = \frac{A(y -1) + B(y + 1)}{(y + 1)(y - 1)}$ which implies that $1 = A(y - 1) + B(y + 1)$. If we let $y = -1$ then $A = -\frac{1}{2}$, and if we let $y = 1$ then $B = \frac{1}{2}$ and so:

(7)
\begin{align} \quad \frac{1}{y^2 - 1} = \frac{\frac{-1}{2}}{y + 1} + \frac{\frac{1}{2}}{y - 1} \end{align}

Thus we have that (ignoring adding the constant of integration):

(8)
\begin{align} \quad \int \frac{1}{y^2 - 1} \: dy = -\frac{1}{2} \int \frac{1}{y + 1} \: dy + \frac{1}{2} \int \frac{1}{y - 1} \: dy \\ \quad \int \frac{1}{y^2 - 1} \: dy = -\frac{1}{2} \ln \mid y + 1 \mid + \frac{1}{2} \ln \mid y - 1 \mid \\ \quad \int \frac{1}{y^2 - 1} \: dy = \ln \biggr \rvert \frac{1}{(y + 1)^{1/2}} \biggr \rvert + \ln \mid (y + 1)^{1/2} \mid \\ \quad \int \frac{1}{y^2 - 1} \: dy = \frac{1}{2} \ln \biggr \rvert \frac{y - 1}{y + 1} \biggr \rvert \end{align}

Therefore going back to our differential equation, we have that:

(9)
\begin{align} \quad \int \frac{1}{y^2 - 1} \: dy = \int (e^{-x} + 1) \: dx\\ \quad \frac{1}{2} \ln \biggr \rvert \frac{y - 1}{y + 1} \biggr \rvert = -e^{-x} + x + C \\ \quad \ln \biggr \rvert \frac{y - 1}{y + 1} \biggr \rvert = -2e^{-x} + 2x + 2C \\ \end{align}

Notice that both $y = 1$ and $y = -1$ are solutions to our differential equation as well. Thus all solutions are given by $\ln \biggr \rvert \frac{y - 1}{y + 1} \biggr \rvert = -2e^{-x} + 2x + 2C$, $y = 1$, and $y = -1$. 