# Introduction to differential equations

## The importance of DE (motivation)

Differential equations are equations which express a relationship between variables and their derivatives. Typically, when variable changes during time and other variable is depending. Differential equations play important role in describing problems e.g. from

• physics,
• dynamics,
• medicine,
• structural analysis,
• populations studies.

## What is a function?

1. Function has a domain/range.
2. For each value from domain it has one function value.
Left graph:  $y=\sqrt{x-1},\ x\geq 1$ is a function, since it has said domain and it assigns for each value from domain one function value.
Right graph:  $y=x^2$ is not a function. But because we assume that domain is either $(-\infty, \infty)$ or all values which make sense, it is a function also then.

### Implicit function

Implicit function is expressed as $f(x,y) = 0$ and $\boldsymbol x$ and $\boldsymbol y$ are not dependent variables. Such functions are not solved easily for $\boldsymbol y$ in terms of $\boldsymbol x$, so they are unwelcome.

Implicit function $x^2 + y^2 = r^2$ can be rewritten to its explicit form either as $y = \sqrt{r^2-x^2}$ or $y = -\sqrt{r^2-x^2}$.
To draw implicit function is a tedious task. Since to one value of $x$ may belong more than one function value, usually an iterative process is needed. The implicit function $f(x,y) = x^3+y^3 - 3xy$ depicted above can be converted (with a loss of information) to explicit form, which is easy to manipulate. We can find million ways how to convert, only some of them are shown.

A note about differentiating implicit function. To express $y' = dy/dx$ chain rule has to be applied (in such case $y$ become dependent on $x$):

\begin{align} x^3 + \color{red}{y^3} - \color{blue}{3xy} &= 0 \nonumber \\ 3x^2 + \color{red}{3y^2y'} - (\color{blue}{3xy' + 3y}) &= 0 \nonumber \\ y'(3y^2-3x) &= 3y-3x^2 \nonumber \\ \frac{dy}{dx} &= \frac{y-x^2}{y^2 - x},\hskip2em y^2 \neq x \nonumber \\ \end{align}

## Ordinary differential equations (ODE)

It is important to keep in mind that once we see $y'$, its meaning is a tangent at given point. As $k$ is tangent in $y = kx \implies \color{red}{k} = \color{blue}{y}/\color{green}{x}$, so $\color{red}{y'} = \color{blue}{dy}/\color{green}{dx}$.

If we are given simple differential equations $y'=x$, we have enough information to draw a tangent at each point. If we make a grid of points, we can draw small tangent at each grid point, as in the graphs shown below. Then we have graph of differential equations which is called direction field. These tangents are guides, they show where the solution might pass.

Differential equations drawn as a direction field for three different DE. Also one particular solution drawn in red color for each.
From left: $y'=x$, $y'=x+y$, $y'=(y+2)(y-2)$
When constructing direction by hand, it is efficient to find isoclines—lines connecting grid points with the same slope (these can be observed in the second example).

### Verification of explicit solution

#### Example

Verify that $y=e^{-x}$ is a solution of DE $y' + y = 0$.

We have a proposed solution of the differential equation. We mean, that if we substitute proposed solution into $y,\ y'$ within DE, the equality have to hold.

If $y=e^{-x}$, then it $y'=-e^{-x}$. Let us substitute $y,\ y'$ into DE to check, whether equality holds:

\begin{align} -e^{-x}+e^{-x} &= 0 \hskip2em x \in \Bbb{R}\nonumber \\ 0 &= 0 \nonumber \end{align}

It is shown above that $y=e^{-x}$ is a solution of DE $y'+y=0$

#### Example

Verify that $y=e^{x}$ is a solution of DE $y' = e^x$.

From the proposed solution $y=e^x \implies y'=e^x$. So it is obvious that $y=e^{x}$ is a solution of given DE, $x \in \Bbb{R}$.

#### Example

Verify that $y=x \arcsin x + \sqrt{1-x^2}$ is a solution of DE $d^2y/dx^2 = 1/\sqrt{1-x^2}$.

First, it can be observed, that $1-x^2$ have to be greater than zero or

$$-1\leq x \leq 1$$

Now the domain is valid also for $\arcsin x$. Note that $d^2y/dx^2$ is an other notation of writing $y''$. We have to differentiate proposed solution two times, than we can substitute into DE.

\begin{align} y' &= \arcsin x + \frac{x}{\sqrt{1-x^2}} + \frac 1 2 \cdot \frac{1}{\sqrt{1-x^2}}(-2x) = \arcsin x \nonumber \\ y'' &= \frac{1}{\sqrt{1-x^2}} \nonumber \end{align}

It is shown above that $y=x \arcsin x + \sqrt{1-x^2}$ is a solution of DE $d^2y/dx^2 = 1/\sqrt{1-x^2}$.

Note: The first derivative is somehow complicated and one might have doubts whether $y'$ has been evaluated correctly. In the case of doubts, the numerical check can be done by calculator from random two points which are close to each other. The slope between these points has to be in chord with $y'(x)$.

#### Example

Verify that $y=x^2$ is a solution of DE $xy'=2y$.

$$y=x^2 \implies y'= 2x \nonumber$$

Now substitute into DE:

\begin{align} x\cdot 2x& = 2y\hskip2em x \in \Bbb{R} \nonumber \\ 2x^2 &= 2y \nonumber \\ x^2 &= y \nonumber \end{align}

It was shown above that $y=x^2$ is a solution of the DE.

#### Example

Verify that $(1+x^2)y'=xy$ has a solution $y=\sqrt{1+x^2}$.

$$y=\sqrt{1+x^2} \implies y' = \frac 1 2 \cdot \frac {1}{\sqrt{1+x^2}}\cdot 2x = \frac{x}{\sqrt{1+x^2}}$$

Now substitute into DE:

\begin{align} (1+x^2)\frac{x}{\sqrt{1+x^2}} = xy \nonumber \\ \sqrt{1+x^2} = y \nonumber \end{align}

The equality holds, $y=\sqrt{1+x^2}$ is a solution.

### Verification of implicit solution

#### Example

Verify that $y^2-1=(x+2)^2$ is a solution of DE $y^2-1-(2y+xy)y'=0$.

Let us differentiate solution to express $y'$:

\begin{align} y^2-1 &=(x+2)^2 \nonumber \\ 2yy' &= 2x+4 \nonumber \\ y' &= \frac{x+2}{y} \nonumber \end{align}

Now $y'$ can be substituted into DE:

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

Since $y^2-1$ is equal to $(x+2)^2$, both paranthesis cancel each other and then

\begin{align} (x+2)^2-{(x+2)^2} &= 0 \nonumber \\ 0 &= 0 \nonumber \end{align}

Therefore $y^2-1=(x+2)^2$ is a solution of DE $y^2-1-(2y+xy)y'=0$.

#### Example

Determine, whether

$$e^{2y} + e^{2x} = 1$$

is implicit function which is an implicit solution of differential equation

$$e^{x-y} + e^{y-x} \frac{dy}{dx} = 0$$

First let us differentiate solution to express $y'$:

\begin{align} 2e^{2y}y' + 2e^{2x} = 0 \nonumber \\ y' = \frac{-2e^{2x}}{2e^{2y}} = -\frac{e^{2x}}{e^{2y}} \nonumber \end{align}

Now let us substitute prepared $y'$ into DE.

\begin{align} e^{x-y} + e^{y-x}\frac{-e^{2x}}{e^{2y}} = 0 \nonumber \\ \frac{e^x}{e^y} +\frac{e^y}{e^x}(-e^xe^x\cdot \frac{1}{e^y}\cdot \frac{1}{e^y}) = 0 \nonumber \\ \frac{e^x}{e^y} - (e^x\cdot \frac 1{e^y}) = 0 \nonumber \\ 0 = 0 \nonumber \\ \end{align}

#### Example

Is $x^2+y^2 + 1 = 0$ an implicit solution of $dy/dx = -x/y$?

If we differentiate proposed solution, we get $2x + 2yy' = 0 \implies y'=-x/y$. That looks well but the trouble here is that $x^2+y^2 + 1 = 0$ is not a function, so it can not be a solution.

## First order DE, higher order DE

The first order DE involves variable differentiated once. If we can observe presence either of $y''$ or $e^{(4)}$, it is not first order differential equation.

#### Example

Determine the order of the following DE:

\begin{align} dy + (xy - \cos x)dx &= 0 \label{ref:intro_ex1} \\ y'' + xy'' + 2y(y')^3 + xy &= 0 \label{ref:intro_ex2}\\ \left(\frac{d^2y}{dx^2}\right)^3 -(y''')^4 + x &= 0 \label{ref:intro_ex3}\\ e^{y'''} + xy'' + y &= 0 \label{ref:intro_ex4} \end{align}

Answers: DE $(\ref{ref:intro_ex1})$ is first order DE, DE $(\ref{ref:intro_ex2})$ is second order DE, DE $(\ref{ref:intro_ex3})$ is third order DE, DE $(\ref{ref:intro_ex4})$ is third order DE.

## Particular, singular and general solution

As the graphs (direction fields) above suggest, a differential equation does not have one, but many solutions. That is caused by presence of integrating constant(s). Let us for example consider differential equation $y'=x$. Then $y(x) = 1/2x^2$ is a solution of given DE. And $y(x) = 1/2x^2 + c$ is a solution as well.

In the next chapters we will be talking about

1. General solution: general solution contains every particular solution, can be also considered as a family of solutions.
2. Particular solution: does not contain arbitrary constant $c$. The arbitrary constant is solved in accordance with initial or boundary values of the problem.
3. Singular solution: sometimes, DE has also other general, but unusual solution, which can not be obtained from the family of general solutions.

For example $y=xy' + (y')^2$ is a first order DE with general solution $y=cx+c^2$. However it is not general solution in the real meaning of this term, because it does not include every particular solution. Because the function $y=-x^2/4$ is also a solution, which can not be obtained from the group of solutions no matter what the value $c$ is.

## Initial value for DE

Initial values are conditions, which allow us to determine the values of arbitrary constants $c_1,\ c_2, \dots,\ c_n$. Normally, the number of arbitrary constants equals to the order of DE. We might say that for the first order DE we need one initial value to determine constant $c$. For the second order DE we need two initial values to solve both $c_1,\ c_2$.

#### Example

Differential equation $y' + 2y = 3$ has a solution $y=3/2+c/e^{2x}$. What is the particular solution if initial value is $y(0)=1$?

The solution seems to be a general solution and can be drawn by means of direction field. But direction field (and the general solution) expresses a family of solutions. We have to find such solution which fulfills $y(0) = 1$ or—in other words—solution, which passes point $[0,1]$.

\left. \begin{aligned} x &= 0 \\ y &=1 \\ \end{aligned} \ \right \} \implies \ 1 = \frac 3 2 + \frac{c}{e^{2\cdot 0}} \implies c = -\frac 1 2

Then the particular solution is

$$y = \frac 3 2 - \frac 1 2 \cdot \frac 1 {e^{2x}}$$

#### Example

Differential equation $yy' = (y+1)^2$ has a family of solutions $1/(y+1) + \log|y+1| = x+c,\ y \neq -1$. Find the particular solution for which $y(2) = 0$.

From the family of solutions we have to find the solution which passes point $[2,0]$: \left. \begin{aligned} x &= 2 \\ y &=0 \\ \end{aligned} \ \right \} \implies \ \frac{1}{0+1} + \log|0+1| = 2+c \implies c=-1

The value of constant $c$ is determined from initial value and particular solution (in implicit form) can be written as:

$$\frac{1}{y+1} + \log|y+1| = x-1,\ y \neq -1$$

Note: the function defined as $y=-1$, which we have to discard above, is also solution of the given DE and is a singular solution.

## More problems solved...

#### Example

Prove that the function $y=ae^x + be^{-x}$ is a solution of differential equation $y'' - y = 0$

Let us get first $y''$ from the solution:

\begin{align} y' &= ae^x - be^{-x} \nonumber \\ y'' &= ae^x + be^{-x} \nonumber \end{align}

If we substitute both $y,\ y''$ into DE the equality holds, so $y=ae^x + be^{-x}$ is a solution of given DE.

#### Example

Show that $y = 2/(x+2),\ x \neq -2$ is a solution of DE $xy' +y = y^2$.

\begin{align} y &= \frac{2}{x+2} \nonumber \\ y' = 2\left((x+2)^{-1}\right)' &= -2 (x+2)^{-2} \nonumber \end{align}

Let us substitute $y,\ y'$ into DE:

\begin{align} x(-2(x+2)^{-2}) + \frac{2}{x+2} &= \frac{4}{(x+2)^2} \hskip2em /\cdot(x+2)^2 \nonumber \\ -2x + 2x + 4 &= 4 \nonumber \\ 4 &= 4 \nonumber \end{align}

The equality holds, so $y = 2/(x+2),\ x \neq -2$ is a solution of the given DE.

#### Example

Test whether family of solution $y=c_1 +c_2e^{-x} + x^3/3$ satisfies differential equation $y''+y' -x^2-2x=0$.

We need $y',\ y''$ from the solution and test, whether, when substituted into DE, equality holds.

\begin{align} y&=c_1 +c_2e^{-x} + x^3/3 \nonumber \\ y'&= -c_2e^{-x} + x^2 \nonumber \\ y''&=c_2e^{-x} + 2x \nonumber \\ \end{align}

Let us substitute into DE:

\begin{align} (c_2e^{-x} + 2x) + (-c_2e^{-x} + x^2) -x^2 - 2x &= 0 \nonumber \\ 0 &= 0 \nonumber \end{align}

#### Example

Find DE whose solution is a family $y=cx+c^3$

There is an arbitrary constant $c$, which is involved in solution. Since there is only one constant, the DE is of the first order. Let us differentiate solution, express $c$ and substitute into solution. Then we have differential equation.

\begin{align} y &= cx+c^3 \nonumber \\ y' &= c \nonumber \\ c &= y' \nonumber \\ \end{align}

Then

$$\underline{\underline{y = y'x + (y')^3}} \nonumber$$

#### Example

Find DE whose solution is a family $x^2 - cy+c^2 = 0$

\begin{align} x^2 - cy+c^2 &= 0 \nonumber \\ 2x - cy' &= 0 \implies c = \frac{2x}{y'} \nonumber \\ x^2 - \frac{2x}{y'}y + \frac{4x^2}{(y')^2} &= 0 \nonumber \\ x^2(y')^2 - 2xyy' + 4x^2 &= 0\nonumber \end{align}

#### Example

Prove that $y=e^{-x/2+c}$ is a solution of DE $2y'+y=0$. Find particular solution if

• $y(0) = 2,$
• $y(0) = -2$.

Make a direction field for DE and draw the particular solutions.

Firstly, let us differentiate supposed solution so it can be substituted into DE.

\begin{align} y &= e^{-\frac x 2+c} \nonumber \implies y' = -\frac 1 2 e^{-\frac{x}{2}+c} \nonumber \\ 2y'+y&=0 \nonumber \\ 2(-\frac 1 2 e^{-\frac{x}{2}+c}) + (e^{-\frac x 2 +c}) &= 0 \nonumber \\ 0 &= 0 \nonumber \\ \end{align}

The supposed solution is really the solution. Now let us solve arbitrary constant $c$ for given initial values in order to express particular solutions.

\begin{align} y(x=0) = 2:&\hskip2em 2 = e^{-0+c} \implies c = \log 2 \nonumber \\ y(x=0) = -2:&\hskip2em -2 = e^{-0+c} \nonumber \\ \end{align}

The particular solution for initial value $y(0) = 2$ is $y = e^{-x/2+0.693}$ and is shown in graph. There is no particular solution passing the point $[0,-2]$.

List of chapters