# First order linear differential equations

## Solution by substitution—homogeneous DE

Let us have differential equations e.g.

\begin{align} \frac{dy}{dx} - \frac{y}{x} - \sin \frac y x &= 0 \nonumber \\ (1+ \frac{x^2}{y^2})\ dx + (1-\frac y x)\ dy &= 0 \nonumber \end{align}

Both above DE can be solved by means of substitution $u=x/u$ or $u=y/x$.

Let us talk now about DE in the standard form of

$$\color{red}{M(x,y)\ dx + N(x,y)\ dy = 0}$$

If $\boldsymbol{M(x,y)}$ and $\boldsymbol{N(x,y)}$ are homogeneous functions of the same order, then the substitution will lead to a differential equation, in which the variables are separable.

So we have to explain the term homogeneous as well. If $M(x,y)$ and $N(x,y)$ can be written in form

\begin{align} M(x,y) &= x^n\cdot g_1(u) \nonumber \\ N(x,y) &= x^n\cdot g_2(u) \nonumber \hskip2em \text{where}\ \color{red}{u = \frac y x} \end{align}

then both members are homogeneous of order $n$. The substitution written as $u = y/x$ is equivalent to $y = u\cdot x$, so we have to use

$$\color{red}{dy = du\ x + u\ dx}$$

Note: sometimes it is preferable to use rather $u = x/y$. In such case the test proving that substitution leads to DE with separable variables is

\begin{align} M(x,y) &= y^n\cdot g_1(u) \nonumber \\ N(x,y) &= y^n\cdot g_2(u) \nonumber \hskip2em \text{where}\ u = \frac x y \end{align}

### Example

Solve $2xy\ dx + (x^2+y^2)\ dy = 0$ by substitution $u=y/x$.

It is a good practice to test first, whether DE is really homogeneous.

$$x^2(2\frac y x)\ dx + x^2(1+ \frac{y^2}{x^2})\ dy = 0$$

We can locate above both members $M(x,y)$ and $N(x,y)$ and it is shown that they are homogeneous of the 2nd order.

\begin{align} M(x,y) &= x^2\cdot g_1(u) \nonumber \\ N(x,y) &= x^2 \cdot g_2(u) \nonumber \end{align}
$$y=\frac y x \implies y = ux \implies dy = du\ x + u\ dx \\$$

Now we can apply the substitution and solve DE.

\begin{align} 2\frac y x \ dx + (1+\frac {y^2}{x^2})\ dy &= 0 \nonumber \\ 2u\ dx + (1+u^2)(du\ x + u\ dx) &= 0 \nonumber \\ 2u\ dx + u\ dx + du\ x + u^2x\ du + u^3\ dx &= 0 \nonumber \\ dx(3u+u^3) + du\ x(1+u^2) &= 0 \nonumber \\ \frac 1 x dx+ \frac{1+u^2}{3u+u^3}du &= 0 \nonumber \end{align}

Note that $(\log|3u + u^3|)' = (3 + 3u^2)/(3u+u^3)$.

\begin{align} \log |x| + \frac 1 3 \log|u^3 + 3u| &= c \nonumber \\ \log |x| &= -\frac 1 3 \log |u^3+3u| + c \nonumber \\ x &= \frac{c}{\sqrt{u^3 + 3u}} \nonumber \\ x^3 &= \frac{c}{{u^3 + 3u}} \nonumber \\ x^3u^3 + x^3 \cdot 3u &= c \nonumber \\ x^3\frac{y^3}{x^3} + x^3 \cdot 3\frac{y}{x} &= c \nonumber \\ \end{align}

The last one can be simplified to

$$\underline{\underline{y^3+3x^2y = c}}.$$

### Example

Solve $(x+y)\ dx -(x-y)\ dy = 0$ by substitution $u=y/x$.

It is a good practice to test first, whether DE is really homogeneous:

$$x(1+\frac y x) \ dx - x(1-\frac{y}{x})\ dy = 0$$

Voluntary test shows that both $M(x,y)$ and $N(x,y)$ are homogeneous of the first order and we can use the substitution to convert DE into DE, which can be solved by separating variables.

Since $u=y/x,\ y=ux \implies dy = du\ x + u\ dx$.

\begin{align} (x+ux)\ dx - (x-ux)(du\ x + u\ dx) &= 0 \nonumber \\ dx\ x(1+u^2)+du\ (x^2)(u-1) &= 0 \nonumber \\ \frac 1 x dx + \frac{u-1}{1+u^2}du &= 0 \nonumber \\ \frac 1 x dx + (\frac{u}{1+u^2} - \frac{1}{1+u^2})\ du &= 0 \nonumber \\ \log|x|+\frac 1 2 \log (1+u^2) - \arctan u &= c \nonumber \\ \frac 1 2 \log x^2+\frac 1 2 \log (1+u^2) - \arctan u &= c \nonumber \\ \frac 1 2 \log (x^2+x^2 u^2) &= \arctan u + c \nonumber \\ \end{align}

And if we go back against the substitution $u = y/x$ we have the final answer

$$\underline{\underline{\frac 1 2 \log (x^2+y^2) = \arctan \frac y x + c }}.$$

### Example

Solve $xy'-y-x \sin(y/x) = 0$ by substitution $u=y/x$.

First, let us show that the DE is homogeneous:

\begin{align} x\ {dy}+(-y-x\sin x\frac xy x)\ dx &= 0 \nonumber \\ x\ {dy}+x(-\frac{y}x-\sin x\frac xy x)\ dx &= 0 \nonumber \end{align}

The DE can be recognized as a homogeneous of the first order. If $u=y/x$ then $y = ux \implies dy = du\ x + u\ dy$.

\begin{align} \frac{du\ x + u\ dx}{dx} - u - \sin u &= 0 \nonumber \\ du\ x + u\ dx -u\ dx -\sin u\ dx &= 0 \nonumber \\ -\frac{1}{\sin u}\ du + \frac{1}{x}\ dx &= 0 \nonumber \end{align}

The integrating of $\int{1/\sin u\ du} = -\log|\cos \frac u 2| + \log|\sin \frac u 2|$ is shown here as a result only with no steps.

\begin{align} \log|\cos \frac{y}{2x}| - \log |\sin \frac{y}{2x}| + \log |x| + c &= 0 \nonumber \\ \log|\tan\frac{y}{2x}| - \log|x| -c &= 0 \nonumber \\ \tan \frac{y}{2x} &= xc \nonumber \end{align}

We can form an explicit solution

$$\underline{\underline{y = 2x\arctan(xc)}}.$$

### Example

Solve $(2x^2y + y^3)\ dx + (xy^2-2x^3)\ dy = 0$ by substitution $u=x/y$.

Firstly, we should bring the DE into such form, that the homogeneous type of DE can be recognized:

$$y^3(2\frac{x^2}{y^2} + 1)\ dx + y^3(\frac{x}{y} - 2\frac{x^3}{y^3})\ dy = 0$$

Since we can locate $y^3$ in front of both members $M(x,y)$, $N(x,y)$ which depend on $g_1(u)$ and $g_2(u)$, the given DE is homogeneous of the third order.

$$(2u^2 +1)\ dx + (u-2u^3)\ dy = 0$$

The trouble is we have variable $u$ together with $dx,\ dy$. Since $x=uy$, $dx=du\ y + dy\ u$. Then

$$(2u^2 +1)(du\ y + dy\ u) + (u-2u^3)\ dy = 0 \nonumber \\$$

Now it is DE which can be solved by separating variables.

\begin{align} 2u^2\ du\ y + du\ y + \color{silver}{2u^3\ dy} + u\ dy + u\ dy \color{silver}{-2u^3\ dy} &= 0 \nonumber \\ 2u^2\ du\ y + y\ du + 2u\ dy &= 0\nonumber\\ du(2u^2y+y)+ 2u\ dy &= 0 \nonumber \\ du\ y(2u^2+1) + 2u\ dy&=0 \nonumber \\ du\frac{2u^2+1}{u} + \frac 2 y dy &= 0 \nonumber \\ du(2u+\frac 1 u) + \frac 2 y dy &= 0 \nonumber \\ u^2 + \log |u| + 2\log |y| &= c \nonumber \\ u^2 + \log|uy^2| &= c\nonumber \\ \frac{x^2}{y^2} + \log |\frac x y y^2| &= c \nonumber \\ \end{align}

The solution has to be expressed in implicit form

$$\underline{\underline{\frac{x^2}{y^2} + \log|xy| = c}} \hskip2em x\neq 0,\ y\neq 0$$

### Example

Solve $\frac y x \cos \frac y x\ dx - (\frac x y \sin y x + \cos y x)\ dy = 0$ by substitution $u=y/x$.

If we substitute $u = y/x$ into DE it can be observed that it is homogeneous DE of degree of zero.

\begin{align} u\cos u \cdot dx - (u^{-1}\sin u + \cos u)(du\ x + u\ dx) &= 0 \nonumber \\ \color{silver}{u\cos u \cdot dx} - du\ xu^{-1}\sin u - u^{-1}\sin u\cdot u\ dx -\cos u\cdot du\ x \color{silver}{- \cos u\cdot u\ dx} &= 0 \nonumber \\ -\cos u\cdot du\ x - du\ x\ u^{-1}\sin u -u^{-1}\sin u \cdot u\ dx &= 0 \nonumber \\ dx(-\color{blue}{u^{-1}}\sin u \cdot \color{blue}{u}) + du(-\cos u\cdot \color{red}{x} - \color{red}{x}u^{-1}\sin u) &= 0 \nonumber \\ \frac 1 x dx + du(\frac{-\cos u-u^{-1}\sin u}{-\sin u}) &= 0\nonumber \\ \frac 1 x dx + du(\cot u +\frac 1 u) &= 0 \nonumber \\ \log|x| + \log|u| + \log|\sin u | &= c \nonumber \\ \log |xu\sin{u} | &= c \nonumber \\ \log |{x \frac{ y} {x}}{\sin{\frac{ y}{ x}}}| &= c \nonumber \end{align}

The last one can be simplified to

$$\underline{\underline{y\ \sin \frac y x = C}}.$$

### Example

Solve $x^2{dy}/{dx} - xy = y^2$.

\begin{align} x^2\ dy -xy\ dx &= y^2\ dx \nonumber \\ x^2\ dy &= (y^2 + xy)\ dx \nonumber \\ y^2\big(\frac{x^2}{y^2}\big)\ dy &= y^2(1+\frac{x}{y})\ dx \nonumber \\ \end{align}

We have obtained the DE which is homogeneous of degree of 2. The substitution is $u = x/y \implies dx = du\ y + u\ dy$.

\begin{align} u^2dy &= (1+u)\ dx \nonumber \\ u^2dy &= (1+u)(du\ y + u\ dy) \nonumber \\ \color{silver}{u^2dy} &= du\ y + u\ dy + u\ du\ y +\color{silver}{u^2\ dy}\nonumber \\ -u\ dy &= du(y+uy) \nonumber \\ -u\ dy &= du\ y(1+u) \nonumber \\ -\frac{1}{y}dy &= du\frac{1+u}{u}\nonumber \\ -\log |y| &= \log|u|+u+c\nonumber \\ \log|y|+\log|\frac x y| &= -\frac x y + C\nonumber \\ \log x &= -\frac x y + C \nonumber \\ \log x - C &= -\frac x y \nonumber \\ \end{align}

Then

$$\underline{\underline{y = \frac{x}{C-\log x}}}.$$

### Example

Solve $dy/dx=(x^2+y^2)/(2x^2)$.

Note, sometimes $u=y/x$ is convenient, sometimes rather $u = x/y$ is convenient. In this case better to use $u = y/x \implies dy = du\ x + u\ dx$.

\begin{align} dy \cdot 2\color{red}{x^2} &= dx\cdot \color{red}{x^2}(\frac{y^2}{x^2}+1) \nonumber \\ 2x\ du + 2u\ dx &= (u^2+1)\ dx \nonumber \\ 2x\ du + 2u\ dx &= (u^2\ dx) + dx \nonumber \\ 2du\ x &= dx(u^2-2u+1)\nonumber \\ \frac{1}{u^2-2u+1}\ du &= \frac 1 2 \cdot \frac 1 x dx \nonumber \\ \frac{1}{(u-1)^2}\ du &= \frac 1 2 \cdot \frac 1 x dx \nonumber \\ (u-1)^{-2}du &= \frac 1 2 \cdot \frac 1 x dx \nonumber \\ \end{align}

Let us integrate both sides.

\begin{align} -(u-1)^{-1} &= \frac{1}{2}\log|x| + c \nonumber \\ -(\frac y x -1)^{-1} &= \frac{1}{2}\log|x| + c \nonumber \\ -\frac{1}{\frac{y}{x} - \frac x x} &= \frac{1}{2}\log|x| + c \nonumber \\ -\frac{1}{\frac{y-x}{x}} &= \frac{1}{2}\log|x| + c \nonumber \\ \frac{x}{x-y} &= \frac{1}{2}\log|x| + c \nonumber \\ x &= (\frac 1 2 \log|x|+c)(x-y) \nonumber \\ \frac{x}{\frac 1 2 \log |x| + c} &= x - y \nonumber \\ y &= x-\frac{x}{\frac 1 2 \log|x|+c} \nonumber \end{align}

Then $y$ can be expressed as

$$\underline{\underline{y = x(1-\frac{1}{\frac 1 2 \log|x|+c})}}.$$

List of chapters