Separable ordinary differential equations

Let's consider,$y'=f(x,y)$ with $y$, an ODE of first order . We will say that the EDO is separable if we can rewrite it as $h(y) \cdot y'=g(x)$, that is, if we can move everything that depends on $y$ to one side of the equality and everything that depends on $x$ to the other.

An example of separable ODE would be $y'=2xy$, since we can put everything that depends on the varible $y$ to one side of the equality and everything that depends on $x$ to other by dividing the entire equationby $y$: $$\displaystyle y'=2xy \Longrightarrow \frac{1}{y}y'=2x$$ In our case, then $$\displaystyle h(y)=\frac{1}{y}, \ g(x)=2x$$

Then we integrate both sides of the equality and we obtain the solution: $$\displaystyle h(y) \cdot y'=g(x) \Longrightarrow h(y)\cdot \frac{dy}{dx}=g(x) \Longrightarrow h(y)dy=g(x)dx \Longrightarrow$$ $$\int h(y) dy=\int g(x)dx+C$$ Let's note that we have added a constant, since, when integrating a function, we do not know if there was a constant. Now we try to isolate $y$ in terms of $x$ and obtain the solution.

For example, in the case shown previously: $$\displaystyle \frac{1}{y}y'=2x \Rightarrow \frac{1}{y}\cdot \frac{dy}{dx}=2x \Rightarrow \frac{dy}{y}=2x \cdot dx \Rightarrow \int \frac{dy}{y}=\int 2x \cdot dx+C \Rightarrow \\ \Rightarrow \ln |y|=x^2+C \Rightarrow |y|= e^{x^2+C}=e^{x^2} \cdot e^C=K\cdot e^{x^2}, \ k>0 \Rightarrow$$ $$\Rightarrow y(x)=k \cdot e^{x^2}, \ k > 0$$

Something that is worth noting is that when we operated to get all the variables in one side, we may be losing some of the solutions. In a way in order to put all the $y$ on one side we assumed that $y \neq 0$. However, if we look at the ODE we can realize that $y=0$ is actually a solution of the ODE, as far as $k$ is also zero.

As we have already said, sometimes, we will have to solve a PVI. In the example we found all the solutions of the ODE. To find the solution of a PVI it is enough to impose the initial conditions and find the concrete constant that assures that the initial condition is satisfied.

Let's consider, for example the PVI: $$\left\{\begin{matrix} y'=2xy \\ y(0)=1 \end{matrix}\right.$$ From the previous example we know that the solutions are: $y(x)=k\cdot e^{x^2} k \in \mathbb{R}$.

Let's look, then, tat he value of $k$ so that we have $y(0)=1$: $$y(0)=1 \Rightarrow 1= y(0)=k\cdot e^0 \Rightarrow k=1$$ Therefore, the solution to our PVI is: $y(x)=e^{x^2}$.

We are going to show some more examples:

Solve the ODE: $$y'=4xe^-y$$ This is a separable ODE since we can put everything that depends on $x$ to one side and everything that depends on $y$ to other.

In effect: $$y'\cdot e^y=4x $$ Now we proceed as we said: $$\displaystyle y'=\cdot e^y=4x \Rightarrow \frac{dy}{dx}e^y=4x \Rightarrow e^y\cdot dy= 4x \cdot dx \Rightarrow \int e^y \cdot dy= \int 4x \cdot dx \Rightarrow$$ $$\Rightarrow e^y=2x^2+C \Rightarrow y(x)= \ln\Big(2x^2+C\Big)$$ where $C$ is the constant that would be determined by the initial conditions.

Solve the ODE: $$2x+5=y' \cdot \sin y$$ We observe that in this case we already have separated variables.

So let's proceed to the integrals: $$2x+5 = y'\sin y \Rightarrow 2x+5= \sin y \cdot \frac{dy}{dx} \Rightarrow \int (2x+5) \ dx = \int \sin y \ dy \Rightarrow$$ $$\Rightarrow x^2+5x+C= -\cos y \Rightarrow y(x)=\arccos (-x^2-5x-C) $$

Solve the ODE: $$y'=x \cdot (y^2+1)$$ It is again a separable ODE when we divide all the terms by $y^2+1$. So its solution is obtained in the following way:

$$\displaystyle \frac{y'}{y^2+1}=x \Rightarrow \frac{dy}{dx} \cdot \frac{1}{y^2+1}=x \Rightarrow \frac{dy}{y^2+1}=x \cdot dx \Rightarrow \int \frac{dy}{y^2+1}=\int x \cdot dx \Rightarrow $$ $$\Rightarrow \arctan y=x+C \Rightarrow y(x)=\tan (x+C)$$

Practice exercises