# Calculus/Ordinary differential equations

**Ordinary differential equations** involve equations containing:

- variables
- functions
- their derivatives

and their solutions.

In studying integration, you *already* have considered solutions to very simple differential equations. For example, when you look to solving

for g(x), you are really solving the differential equation

## Notations and terminology edit

The notations we use for solving differential equations will be crucial in the ease of solubility for these equations.

This document will be using **three** notations primarily:

- f' to denote the derivative of f
- D
*f*to denote the derivative of*f* - to denote the derivative of
*f*(for separable equations).

### Terminology edit

Consider the differential equation

Since the equation's highest derivative is 2, we say that the differential equation is of *order* 2.

## Some simple differential equations edit

A key idea in solving differential equations will be that of integration.

Let us consider the second order differential equation (remember that a function acts on a value).

How would we go about solving this? It tells us that on differentiating twice, we obtain the constant 2 so, if we integrate twice, we should obtain our result.

Integrating once first of all:

We have transformed the apparently difficult second order differential equation into a rather simpler one, viz.

This equation tells us that if we differentiate a function once, we get . If we integrate once more, we should find the solution.

This is the *solution* to the differential equation. We will get for *all* values of and .

The values and are related to quantities known as *initial conditions*.

Why are initial conditions useful? ODEs (ordinary differential equations) are useful in modeling physical conditions. We may wish to model a certain physical system which is initially at rest (so one initial condition may be zero), or wound up to some point (so an initial condition may be nonzero, say 5 for instance) and we may wish to see how the system reacts under such an initial condition.

When we solve a system with given initial conditions, we substitute them after our process of integration.

### Example edit

When we solved say we had the initial conditions and . (Note, initial conditions need not occur at f(0)).

After we integrate we make substitutions:

Without initial conditions, the answer we obtain is known as the *general solution* or the solution to the *family of equations*. With them, our solution is known as a *specific solution*.

## Basic first order DEs edit

In this section we will consider *four* main types of differential equations:

- separable
- homogeneous
- linear
- exact

There are many other forms of differential equation, however, and these will be dealt with in the next section

### Separable equations edit

A *separable* equation is in the form (using dy/dx notation which will serve us greatly here)

Previously we have only dealt with simple differential equations with g(*y*)=1. How do we solve such a separable equation as above?

We group *x* and *dx* terms together, and *y* and *dy* terms together as well.

Integrating both sides with respect to y on the left hand side and x on the right hand side:

we will obtain the solution.

#### Worked example edit

Here is a worked example illustrating the process.

We are asked to solve

Separating

Integrating

Letting where k is a constant we obtain

which is the general solution.

#### Verification edit

This step does not need to be part of your work, but if you want to check your solution, you can verify your answer by differentiation.

We obtained

as the solution to

Differentiating our solution with respect to x,

And since , we can write

We see that we obtain our original differential equation, thus our work must be correct.

### Homogeneous equations edit

A *homogeneous* equation is in the form

This looks difficult as it stands, however we can utilize the substitution

so that we are now dealing with F(v) rather than F(y/x).

Now we can express y in terms of v, as *y*=*xv* and use the product rule.

The equation above then becomes, using the product rule

Then

which is a separable equation and can be solved as above.

However let's look at a worked equation to see how homogeneous equations are solved.

#### Worked example edit

We have the equation

This does not appear to be immediately separable, but let us expand to get

Substituting *y*=*xv* which is the same as substituting *v*=*y*/*x*:

Now

Canceling *v* from both sides

Separating

Integrating both sides

which is our desired solution.

### Linear equations edit

A linear first order differential equation is a differential equation in the form

Multiplying or dividing this equation by any non-zero function of *x* makes no difference to its solutions so we could always divide by *a*(*x*) to make the coefficient of the differential 1, but writing the equation in this more general form may offer insights.

At first glance, it is not possible to integrate the left hand side, but there is one special case. If *b* happens to be the differential of *a* then we can write

and integration is now straightforward.

Since we can freely multiply by any function, lets see if we can use this freedom to write the left hand side in this special form.

We multiply the entire equation by an arbitrary, *I*(*x*), getting

then impose the condition

If this is satisfied the new left hand side will have the special form. Note that multiplying *I* by any constant will leave this condition still satisfied.

Rearranging this condition gives

We can integrate this to get

We can set the constant *k* to be 1, since this makes no difference.

Next we use *I* on the original differential equation, getting

Because we've chosen *I* to put the left hand side in the special form we can
rewrite this as

Integrating both sides and dividing by we obtain the final result

We call *I* an *integrating factor*. Similar techniques can be used on some other calculus problems.

#### Example edit

Consider

First we calculate the integrating factor.

Multiplying the equation by this gives

or

We can now integrate

### Exact equations edit

An exact equation is in the form

- f(
*x*,*y*) d*x*+ g(*x*,*y*) d*y*= 0

and, has the property that

- D
_{x}f = D_{y}g

(If the differential equation does not have this property then we can't proceed any further).

As a result of this, if we have an exact equation then there exists a function h(*x*, *y*) such that

- D
_{y}h = f and D_{x}h = g

So then the solutions are in the form

- h(
*x*,*y*) = c

by using the fact of the total differential.
We can find then h(*x*, *y*) by integration

## Basic second and higher order ODE's edit

The generic solution of a *n*^{th} order ODE will contain *n* constants of integration. To calculate them we need *n* more equations.
Most often, we have either

- boundary conditions, the values of
*y*and its derivatives take for two different values of*x*

or

- initial conditions, the values of
*y*and its first*n-1*derivatives take for one particular value of*x*.

### Reducible ODE's edit

1. If the independent variable, *x*, does not occur in the differential equation then its order can be lowered by one. This will reduce a second order ODE to first order.

Consider the equation:

Define

Then

Substitute these two expression into the equation and we get

- =0

which is a first order ODE

#### Example edit

Solve

if at *x*=0, *y*=D*y*=1

First, we make the substitution, getting

This is a first order ODE. By rearranging terms we can separate the variables

Integrating this gives

We know the values of *y* and *u* when *x*=0 so we can find *c*

Next, we reverse the substitution

and take the square root

To find out which sign of the square root to keep, we use the initial condition, D*y*=1 at *x*=0, again, and rule out the negative square root.
We now have another separable first order ODE,

Its solution is

Since *y*=1 when *x*=0, *d*=2/3, and

2. If the dependent variable, *y*, does not occur in the differential equation then it may also be reduced to a first order equation.

Consider the equation:

Define

Then

Substitute these two expressions into the first equation and we get

- =0

which is a first order ODE

### Linear ODEs edit

An ODE of the form

is called **linear**. Such equations are much simpler to solve than typical non-linear ODEs. Though only a few special cases can be solved exactly in terms of elementary functions, there is much that can be said about the solution of a generic linear ODE. A full account would be beyond the scope of this book

If *F(x)=0* for all *x* the ODE is called **homogeneous**

Two useful properties of generic linear equations are

- Any linear combination of solutions of an homogeneous linear equation is also a solution.
- If we have a solution of a nonhomogeneous linear equation and we add any solution of the corresponding homogenous linear equation we get another solution of the nonhomogeneous linear equation

#### Variation of constants edit

Suppose we have a linear ODE,

and we know one solution, *y=w(x)*

The other solutions can always be written as *y=wz*. This substitution in the ODE will give us terms involving every differential of *z* upto the *n*^{th}, no higher, so we'll end up with an *n*^{th} order linear ODE for *z*.

We know that *z* is constant is one solution, so the ODE for *z* must not contain a *z* term, which means it will effectively be an *n-1*^{th} order linear ODE. We will have reduced the order by one.

Lets see how this works in practice.

##### Example edit

Consider

One solution of this is *y=x ^{2}*, so substitute

*y=zx*into this equation.

^{2}Rearrange and simplify.

This is first order for D*z*. We can solve it to get

Since the equation is linear we can add this to any multiple of the other solution to get the general solution,

#### Linear homogeneous ODE's with constant coefficients edit

Suppose we have a ODE

we can take an inspired guess at a solution (motivate this)

For this function D^{n}*y*=p^{n}y so the ODE becomes

*y=0* is a trivial solution of the ODE so we can discard it. We are then left with the equation

This is called the *characteristic* equation of the ODE.

It can have up to *n* roots, p_{1}, p_{2} … p_{n}, each root giving us a different solution of the ODE.

Because the ODE is linear, we can add all those solution together in any linear combination to get a general solution

To see how this works in practice we will look at the second order case. Solving equations like this of higher order uses exactly the same principles; only the algebra is more complex.

##### Second order edit

If the ODE is second order,

then the characteristic equation is a quadratic,

with roots

What these roots are like depends on the sign of *b*^{2}-4*c*, so we have three cases to consider.

*1) b ^{2} > 4c*

In this case we have two different real roots, so we can write down the solution straight away.

*2) b ^{2} < 4c*

In this case, both roots are imaginary. We could just put them directly in the formula, but if we are interested in real solutions it is more useful to write them another way.

Defining k^{2}=4c-b^{2}, then the solution is

For this to be real, the *A*'s must be complex conjugates

Make this substitution and we can write,

If *b* is positive, this is a damped oscillation.

*3) b ^{2} = 4c*

In this case the characteristic equation only gives us one root, *p=-b/2*. We must use another method to find the other solution.

We'll use the method of variation of constants. The ODE we need to solve is,

rewriting *b* and *c* in terms of the root. From the characteristic equation we know one solution is so we make the substitution , giving

This simplifies to D^{2}*z*=0, which is easily solved. We get

so the second solution is the first multiplied by *x*.

Higher order linear constant coefficient ODE's behave similarly: an exponential for every real root of the characteristic and a exponent multiplied by a trig factor for every complex conjugate pair, both being multiplied by a polynomial if the root is repeated.

E.g., if the characteristic equation factors to

the general solution of the ODE will be

The most difficult part is finding the roots of the characteristic equation.

#### Linear nonhomogeneous ODEs with constant coefficients edit

First, let's consider the ODE

a nonhomogeneous first order ODE which we know how to solve.

Using the integrating factor *e ^{-x}* we find

This is the sum of a solution of the corresponding homogeneous equation, and a polynomial.

Nonhomogeneous ODE's of higher order behave similarly.

If we have a single solution, *y _{p}* of the nonhomogeneous ODE, called a

*particular*solution,

then the general solution is *y=y _{p}+y_{h}*, where

*y*is the general solution of the homogeneous ODE.

_{h}Find *y _{p}* for an arbitrary

*F(x)*requires methods beyond the scope of this chapter, but there are some special cases where finding

*y*is straightforward.

_{p}Remember that in the first order problem *y _{p}* for a polynomial

*F(x)*was itself a polynomial of the same order. We can extend this to higher orders.

*Example:*

Consider a particular solution

Substitute for *y* and collect coefficients

So *b _{2}=0*,

*b*,

_{1}=-7*b*, and the general solution is

_{0}=1This works because all the derivatives of a polynomial are themselves polynomials.

Two other special cases are

where *P _{n}*,

*Q*,

_{n}*A*, and

_{n}*B*are all polynomials of degree

_{n}*n*.

Making these substitutions will give a set of simultaneous linear equations for the coefficients of the polynomials.