Definitions

# Examples of differential equations

Differential equations arise in many problems in physics, engineering, etc. The following examples show how to solve differential equations in a few simple cases when an exact solution exists.

## Separable first order linear ordinary differential equations

A separable linear ordinary differential equation of the first order has the general form:

$frac\left\{dy\right\}\left\{dt\right\} + f\left(t\right) y = 0$

where $f\left(t\right)$ is some known function. We may solve this by separation of variables (moving the y terms to one side and the t terms to the other side),

$frac\left\{dy\right\}\left\{y\right\} = -f\left(t\right), dt$

Antidifferentiating, we find

$ln |y| = left\left(-int f\left(t\right),dtright\right) + C,$

where C is a constant. Then, by exponentiation, we obtain

$y = pm e^\left\{left\left(-int f\left(t\right),dtright\right) + C\right\} = pm e^\left\{-int f\left(t\right),dt\right\} cdot e^\left\{C\right\} = A e^\left\{-int f\left(t\right),dt\right\}$

with A another arbitrary constant. It is easy to confirm that this is a solution by plugging it into the original differential equation:

$frac\left\{dy\right\}\left\{dt\right\} + f\left(t\right) y = A e^\left\{-int f\left(t\right),dt\right\} cdot -f\left(t\right) + f\left(t\right) cdot A e^\left\{-int f\left(t\right),dt\right\} = 0$

Some elaboration is needed because $f\left(t\right)$ is not in necessarily a constant—indeed, it might not even be integrable. Arguably, one must also assume something about the domains of the functions involved before the equation is fully defined. Are we talking about complex functions, or just real, for example? The usual textbook approach is to discuss forming the equations well before considering how to solve them.

## Non-separable first order linear ordinary differential equations

Some first order linear ODEs (ordinary differential equations) are not separable like in the above example. In order to solve non-separable first order linear ODEs one must use what is known as an integrating factor. Consider first order linear ODEs of the general form:

$frac\left\{dy\right\}\left\{dx\right\} + p\left(x\right)y = q\left(x\right)$

The method for solving this equation relies on a special integrating factor, μ:

$mu = e^\left\{int_\left\{\right\}^\left\{\right\} p\left(x\right), dx\right\}$

We choose this integrating factor because it has the special property that its derivative is itself times the function we are integrating, that is:

$frac\left\{d\left\{mu\right\}\right\}\left\{dx\right\} = e^\left\{int_\left\{\right\}^\left\{\right\} p\left(x\right), dx\right\} cdot p\left(x\right) = mu p\left(x\right)$

Multiply both sides of the original differential equation by μ to get:

$mu\left\{frac\left\{dy\right\}\left\{dx\right\}\right\} + mu\left\{p\left(x\right)y\right\} = mu\left\{q\left(x\right)\right\}$

Because of the special μ we picked, we may substitute $d\left\{mu\right\}/dx$ for $mu p\left(x\right)$, simplifying the equation to:

$mu\left\{frac\left\{dy\right\}\left\{dx\right\}\right\} + y\left\{frac\left\{d\left\{mu\right\}\right\}\left\{dx\right\}\right\} = mu\left\{q\left(x\right)\right\}$

Using the product rule in reverse, we get:

$frac\left\{d\right\}\left\{dx\right\}\left\{\left(mu\left\{y\right\}\right)\right\} = mu\left\{q\left(x\right)\right\}$

Integrating both sides:

$mu\left\{y\right\} = left\left(intmu q\left(x\right), dxright\right) + C$

Finally, to solve for $y$ we divide both sides by $mu$:

$y = frac\left\{left\left(intmu q\left(x\right), dxright\right) + C\right\}\left\{mu\right\}$

Since μ is a function of x, we cannot simplify any further directly.

## A simple example

Suppose a mass is attached to a spring which exerts an attractive force on the mass proportional to the extension/compression of the spring. For now, we may ignore any other forces (gravity, friction, etc). We shall write the extension of the spring at a time $t$ as $x\left(t\right)$. Now, using Newton's second law we can write (using convenient units):

$frac\left\{d^2x\right\}\left\{dt^2\right\} = - x$

If we look for solutions that have the form $C e^\left\{kt\right\}$, where $C$ is a constant, we discover the relationship $k^2 + 1 = 0$, and thus $k$ must be one of the complex numbers $i$ or $-i$. Thus, using Euler's theorem we can say that the solution must be of the form:

$x\left(t\right) = A cos t + B sin t$

To determine the unknown constants $A$ and $B$, we need initial conditions, i.e. equalities that specify the state of the system at a given time (usually $t = 0$).

For example, if we suppose at $t = 0$ the extension is a unit distance ($x = 1$), and the particle is not moving ($dx/dt = 0$). We have

$x\left(0\right) = A cos 0 + B sin 0 = A = 1,$

and so $A = 1$.

$x\text{'}\left(0\right) = -A sin 0 + B cos 0 = B = 0,$

and so $B = 0$.

Therefore $x\left(t\right) = cos t$. This is an example of simple harmonic motion.

## A more complicated model

The above model of an oscillating mass on a spring is plausible but not really realistic. For a start, we have imagined a perpetual motion machine, violating the second law of thermodynamics. Therefore, we will add some friction for realism. Experimental scientists tell us that friction will tend to decelerate the mass and have magnitude proportional to its velocity (i.e. $dx/dt$). Our new differential equation, expressing the balancing of the acceleration and the forces, is

$frac\left\{d^2x\right\}\left\{dt^2\right\} = - c frac\left\{dx\right\}\left\{dt\right\} - x$

where $c$ is our coefficient of friction, and $c > 0$. Again looking for solutions of the form $A e^\left\{kt\right\}$, we find that

$k^2 + c k + 1 = 0.$

This is a quadratic equation which we can solve. If $c < 2$ we have complex roots $a pm i b$, and the solution (with the above boundary conditions) will look like this:

$x\left(t\right) = e^\left\{at\right\} left\left(cos bt - frac\left\{a\right\}\left\{b\right\} sin bt right\right)$

(We can show that $a < 0$)

This is a damped oscillator, and the plot of displacement against time would look something like this:

which does resemble how one would expect a vibrating spring to behave as friction removed the energy from the system.