# Calc3.9

Frequently we encounter equations in which we are solving for a function instead of a number. If such an equation involves an unknown function as well as its derivatives, it is called a differential equation. These equations have numerous applications in a variety of fields, including physics, engineering, chemistry, and biology. In this lecture, we will dipping our toes into the theory of ordinary differential equations, which means differential equations in which the unknown function(s) involves only one variable.

# The Basics

We can immediately solve some of the most basic equations, such as y' = ky, where k is a constant, from our knowledge of the basic derivatives.

## Integrable Equations

The easiest differential equations to solve, at least in theory, are those where we can manipulate the equation algebraically to get y' on one side and some expression only involving x and constants on the other side. Then, we can just integrate both sides to get y. Integrable equations may not be presented in this format right away; often times, some manipulation is required to reach an integrable format. Take a look at $xy' -2x^2 =1 \$. We can manipulate this to get

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

and integrate to get

$y= \int x^{-1}dx+\int 2xdx = \ln(|x|) + x^2$

Let's check that this fits:

$x (\frac{1}{x} +2x) - 2x^2 = 1+2x^2-2x^2=1$

as expected.

## Separable Equations

Most equations are not integrable. But sometimes, we're very lucky, and we find that we separate the dy and the dx from each other, and that we can arrange the equation such that only terms of y appear on one side, and only terms of x on the other. Let's do an example of this by solving $y^2y'-\cos(x)=1 \$.

We can rewrite this

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

and separate it as

$y^2dy=(1+\cos(x))dx \$

Now it's a simple matter of integrating!

$\int y^2dy=\int (1+\cos(x))dx$

$\frac{y^3}{3}+c=x+\sin(x)$

which is an implicit equation with explicit solution

$y=\sqrt[3]{3x+3\sin(x)+c}$

where we change the arbitrary constant c.

Not all separable equations are this obviously separable; sometimes much manipulation is needed to get it into a separable form.

## First-Order Equations

A first-order equation involves only $y, y' \$ and no higher order derivatives. We've already seen such an equation in our separable example, but that wasn't linear. Right now, we're going to solve all linear first order equations.

### Constant Co-efficients

This is the simplest one, which we've already addressed. $y'+ay=0 \$ has the obvious solution $y=e^{-ax} \$. It isn't hard to check that all multiples of this solution are also solutions.

### Variable Co-efficients

We begin by considering $P(x)y'+Q(x)y=0 \$. Where ever $P(x)\neq 0 \$, we can divide out by P to get $y'' +a(x)y =0 \$, which will make our lives much easier. Points $x_0 \$ where $P(x_0)=0 \$ are called singular points and require special treatment we won't address here. Fortunately, we've already solved all these equations, since they're separable:

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

$dy + a(x)ydx = 0 \$

$\frac{dy}{y} =- a(x)dx$

$\ln |y| = C - \int a(x)dx \$

$y = ke^{-\int a(x)dx} \$

where k is an arbitrary constant.

## Second-Order Equations

A second order equation is an equation which contains a $y'' \$ term, but no higher derivatives. We will consider only linear equations for now: this means that the coefficients of the derivatives of y do not contain terms in y.

### Constant Co-efficients

When we solved $y'+ay=0 \$, we found that $y=e^{-ax} \$ was a solution. Note that $-a=t \$ is a root of the equation $t+a=0 \$. Therefore, it makes sense to suppose that solutions of the equation $y''+ay'+by=0 \$ may be found with $y=e^{r_1x}, y=e^{r_2x} \$, where $t=r_1, r_2 \$ are roots of the equation $t^2+at+b=0 \$. Let r represent a specific root (either the first or second), and observe:

$y=e^{rx}, y' = r e^{rx}, y''=r^2 e^{rx} \$

$y''+ay'+b=r^2e^{rx}+are^{rx}+be^{rx}= e^{rx} (r^2+ar+b)= e^{rx}(0) = 0 \$

as desired. Hence we have found two possible solutions. An interesting thing happens if we consider linear combinations of these two solutions:

$u=py_1+qy_2=pe^{r_1x}+qe^{r_2x} \$

Taking all the relevant derivatives, we have

$u'' = r_1^2pe^{r_1x}+r_2^2qe^{r_2x}, u' = r_1pe^{r_1x}+qr_2e^{r_2x}, u=pe^{r_1x}+qe^{r_2x} \$

and examining the behavior of u in the LHS of the differential equation

$u'' + au' + bu = r_1^2pe^{r_1x}+r_2^2qe^{r_2x} + ar_1pe^{r_1x}+aqr_2e^{r_2x} + bpe^{r_1x}+bqe^{r_2x} =pe^{r_1x}(r_1^2+ar_1+b) + qe^{r_2x}(r_2^2 +ar_2+b)$

$= pe^{r_1x}(0) + qe^{r_2x}(0) = 0+0 = 0 \$

reveals u is also a solution.

What about when the discriminant is 0, that is, when $r_1=r_2 \$? In this case, lets drop the subscript and just call our root $r=-a/2 \$.

Obviously, $y=e^{rx} \$ will still be a solution, but is there a second solution, as there was before? The key insight needed to answer this question is that for a double root $r=-a/2 \$, not only is the characteristic polynomial $t^2+at+b=0 \$, so is the derivative $2t+a=0 \$. Therefore, it makes sense to consider the derivative of the solution $y=e^{rx} \$ with respect to r as another possible solution. Let's check:

$y=xe^{rx}, y'= e^{rx}+xre^{rx}, y'' = re^{rx}+re^{rx}+xr^2e^{rx} \$

$y''+ay'+by=2re^{rx}+xr^2e^{rx}+ae^{rx}+axre^{rx}+bxe^{rx} = (2r+a)e^{rx}+(r^2+ar+b)xe^{rx} = (0)e^{rx}+(0)xe^{rx}=0 \$.

As before, any linear combination $u=pe^{rx}+qxe^{rx} \$ is also a solution.

## Higher-Order Equations

It should come as no surprise by now to learn that given an equation $y^{(n)}+c_{n-1}y^{(n-1}+\dots+c_0=0$, a general solution is given by $y=a_1e^{r_1x}+a_2e^{r_2x}+\dots+a_ne^{r_nx} \$, where the $r_j \$ are roots of the polynomial $\sum_{k=0}^n c_kt^k \$. If two roots $r_i=r_j \$ are equal, then $e^{r_jx}, xe^{r_jx} \$ are both solutions; if three roots $r_i=r_j=r_k \$ are equal, then $e^{r_kx}, xe^{r_kx}, x^2e^{r_kx} \$ are all solutions; if four roots $r_i=r_j=r_k=r_l \$ are equal, then $e^{r_lx}, xe^{r_lx}, x^2e^{r_lx}, x^3e^{r_lx} \$ are all solutions, and so on.