DiffEq Home

## Separable ODEs

A separable ODE is of the form $\frac{dy}{dx}=\frac{M(x)}{N(y)}.$ Steps to solve: \begin{align*} N(y)\,dy&=M(x)\, dx\\ \int N(y)\,dy&=\int M(x)\, dx + c.\\ \end{align*}

Example. Solve the following IVP (initial value problem) $$\label{7} \frac{dy}{dx}=\frac{2x-3}{y-5},\; y(0)=3$$ and find the valid interval of the solution. Find the maximum value of the solution.

Solution. \begin{align*} \frac{dy}{dx}&=\frac{2x-3}{y-5} \\ (y-5)\,dy&=(2x-3)\,dx\\ \int (y-5)\,dy&=\int (2x-3)\,dx\\ \frac{y^2}{2}-5y&=2\frac{x^2}{2}-3x+c\\ y^2-10y&=2(x^2-3x+c)\\ y^2-10y-2x^2+6x-2c&=0 \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\; (8) \end{align*} Note that the initial condition is $$y(0)=3$$. So we have \begin{align*} 3^2-10\cdot 3-2c&=0\\ 2c&=-21 \end{align*} From (8) we get \begin{align*} y^2-10y-2x^2+6x+21&=0 \text{ (implicit solution)}\\ y&=\frac{10\pm \sqrt{100-4(-2x^2+6x+21)}}{2}\\ y&=\frac{10\pm 2\sqrt{25-(-2x^2+6x+21)}}{2}\\ y&=5\pm \sqrt{2x^2-6x+4} \end{align*} So we have two possible solutions: $y=5+ \sqrt{2x^2-6x+4} \text{ and } y=5- \sqrt{2x^2-6x+4}.$ Note that the first one does note satisfy the initial condition $$y(0)=3$$. Thus the solution is $y=5- \sqrt{2x^2-6x+4} \text{ (explicit solution)}.$ Obviously the maximum value of the solution is 5 because $$\sqrt{2x^2-6x+4}\geq 0$$. The solution is defined when \begin{align*} 2x^2-6x+4&\geq 0\\ 2(x^2-3x+2)&\geq 0\\ 2(x-1)(x-2)&\geq 0 \end{align*} The domain of $$y$$ is $$(-\infty,1]\cup [2,\infty)$$. Because of the initial condition $$y(0)=3$$, the valid interval of the solution is $$(-\infty,1]$$.

Example. Solve the following ODE. $$$\frac{dy}{dx}=e^{-y}x\cos x$$$

Solution. \begin{align*} \frac{dy}{dx}&=\frac{x\cos x}{e^y}&&\\ e^y\, dy&=x\cos x\, dx&\\ \int e^y\, dy&=\int x\cos x\, dx&\\ e^y &=\int u\, dv && u=x,\, dv=\cos x\, dx\\ &=uv-\int v\, du && du=dx,\, v=\int dv=\int \cos x\, dx=\sin x\\ &=x\sin x-\int \sin x\, dx &&\\ &=x\sin x+\cos x +c && \end{align*} The general solution is $$y=\ln|x\sin x+\cos x +c|$$.

Substitution for homogeneous ODEs:
The ODE $$\displaystyle\frac{dy}{dx}=f(x,y)$$ is called homogeneous if $$f(x,y)$$ is a function of $$\displaystyle\frac{y}{x}$$.

Steps to solve: Substitute $$v=y/x$$ or, $$y=vx$$. Then $$\displaystyle\frac{dy}{dx}=x\displaystyle\frac{dv}{dx}+v$$. Write $$f(x,y)$$ as a function of $$v$$. Then it becomes a separable ODE of $$v$$ and $$x$$.

Example. Solve the following ODE. $\begin{equation*} \frac{dy}{dx}=\frac{x^2+3y^2}{2xy} \end{equation*}$ Solution. \begin{align} \frac{dy}{dx}&=\frac{(x^2+3y^2)/x^2}{2xy/x^2}\nonumber\\ \frac{dy}{dx}&=\frac{1+3(y/x)^2}{2(y/x)} \;\;\;\;\; (9) \end{align} Let $$v=y/x$$ or, $$y=vx$$. Then $$\displaystyle\frac{dy}{dx}=x\displaystyle\frac{dv}{dx}+v$$. So from (9) we get \begin{align} x\frac{dv}{dx}+v&=\frac{1+3v^2}{2v}\nonumber\\ x\frac{dv}{dx}&=\frac{1+3v^2}{2v}-v=\frac{1+v^2}{2v}\nonumber\\ \frac{2v}{1+v^2}\, dv&=\frac{dx}{x} \nonumber \end{align} \begin{align} \int\frac{2v}{1+v^2}\, dv&=\int \frac{dx}{x} \text{ (substitute } u=1+v^2) \nonumber\\ \ln|1+v^2|&=\ln|x|+\ln c \nonumber\\ \ln|1+v^2|&=\ln|cx| \nonumber\\ 1+v^2&=cx \nonumber\\ 1+\frac{y^2}{x^2}&=cx \nonumber\\ x^2+y^2&=cx^3 \nonumber \end{align}

Last edited