### An introduction to ordinary differential equations

#### What are ordinary differential equations (ODEs)?

An ordinary differential equation (ODE) is an equation that involves
some ordinary derivatives (as opposed to partial derivatives) of a function.
Often, our goal is to *solve* an ODE, i.e., determine what
function or functions satisfy the equation.

If you know what the derivative of a function is, how can you find the function itself? You need to find the antiderivative, i.e., you need to integrate. For example, if you are given \begin{gather*} \diff{x}{t}(t) = \cos t \end{gather*} then what is the function $x(t)$? Since the antiderivative of $\cos t$ is $\sin t$, then $x(t)$ must be $\sin t$. Except we forgot one important point: there is always an arbitrary constant that we cannot determine if we only know the derivative. Therefore, all we can detetermine from the above equation is that \begin{gather*} x(t) = \sin t + C \end{gather*} for some arbitrary constant $C$. You can verify that indeed $x(t)$ satisfies the equation $\diff{x}{t} = \cos t$.

In general, solving an ODE is more complicated than simple integration. Even so, the basic principle is always integration, as we need to go from derivative to function. Usually, the difficult part is determining what integration we need to do.

#### The simplest possible ODE

Let's start simpler, though. What is the simplest possible ODE? Let $x(t)$ be a function of $t$ that satisfies the ODE: \begin{gather} \diff{x}{t} = 0. \label{simplest_ode}\tag{1} \end{gather}

We can ask some simple questions. What is $x(t)$? Is $x(t)$ uniquely determined from this equation? If not, what else do you need to specify?

Equation \eqref{simplest_ode} just means that $x(t)$ is a constant function, $x(t)=C$. It is certainly not uniquely determined, as there is no way to specify the constant $C$ if we only have equations for the derivatives of $x$. In order to uniquely determine $x(t)$, one must provide some additional data in terms of the function $x(t)$ itself.

We could for example, specify that $x(t)$ must be equal to 31 when $t=11$, adding the condition
$$x(11)=31.$$
Then we know $C=31$ and the function is $x(t)=31$ for all $t$.
We frequently think of the variable $t$ as representing time and refer
to a condition such as $x(11)=31$ as an *initial condition*.

Let's write the initial condition more generally as $$x(t_0)=x_0,$$ where $t_0$ is some given time and $x_0$ is some given number. It's as though we initialize the system to be equal to the number $x_0$ at the time $t=t_0$. However, this “initial condition” also determines $x(t)$ for early times. As you can see from the solution $x(t)=31$ for all time $t$, this condition specifies the state of the system for times before and after $t=11$.

#### A slightly more complicated ODE

Let's make things a little more complicated. Consider the equation \begin{gather} \diff{x}{t} = m\sin t + n t^3, \label{simple_ode2}\tag{2} \end{gather} where $m$ and $n$ are just some real numbers. Equation \eqref{simple_ode2} isn't much more complicated than equation \eqref{simplest_ode} because the right hand side does not depend on $x$. It only depends on $t$. We are simply specifying what the derivative is in terms of $t$. The solution is just the antiderivative, or the integral.

Let's do the integral slightly differently this time. We'll use the definite integral from time $t=a$ to time $t=b$. Using the fundamental theorem of calculus, the integral of $\diff{x}{t}$ from $a$ to $b$ must be \begin{align*} x(b)-x(a) &= \int_a^b \diff{x}{t} dt\\ &= \int_a^b (m\sin t + n t^3) dt\\ &= -m\cos b + n b^4/4 - (-m\cos a + na^4/4). \end{align*}

We can write the solution in different ways. We could just replace $b$ with an arbitrary time $t$, \begin{gather*} x(t)= -m\cos t + n t^4/4 + m\cos a - na^4/4 +x(a). \end{gather*} This form makes it very obvious how the solution $x(t)$ would depend on an initial condition $x(t_0)=x_0$. If $x(7)=5,$ then \begin{gather*} x(t)= -m\cos t + n t^4/4 + m\cos 7 - n7^4/4 +5. \end{gather*}

On the other hand, if we aren't concerned with the form of the constant, we could just write the general solution as \begin{gather*} x(t) = -m\cos t + nt^4/4 + C \end{gather*} for some arbitrary constant $C$.

#### An ODE that isn't a simple integral

So far, the example ODEs we've seen could be solved simply by integrating. The reason they were so simple is that the equations for $\diff{x}{t}$ did not depend on the function $x(t)$ but only on the variable $t$. On the other hand, once the equation depends on both $\diff{x}{t}$ and $x(t)$, we have do more work to solve for the function $x(t)$.

Here's an ODE that includes $x(t)$: \begin{gather*} \diff{x}{t} = ax(t) + b \label{linear_ode}\tag{3} \end{gather*} where $a$ and $b$ are some constants. Since the right hand side depends on $x$ itself, we cannot simply integrate and use the fundamental theorem of calculus. To solve this ODE for $x(t)$, we'll need to do some manipulations and use the chain rule (i.e., a $u$-substitution).

The first thing to do is get all expressions involving $x$ on one side of the equation. If we subtract, we won't be able to put things in the right form for the chain rule, as we'll have terms without a $\diff{x}{t}$ in them. Instead, we divide both sides of the equation by $ax(t)+b$, \begin{gather*} \frac{\diff{x}{t}}{ax(t) + b} = 1. \end{gather*}

Now the right hand side is a simple function of $t$ (a constant function in this case). We can integrate both sides of the equation with respect to $t$, \begin{gather*} \int \frac{\diff{x}{t}dt}{ax(t) + b} = \int 1 dt. \end{gather*}

At first glance, the left hand side might look ugly. But it is in a special form that makes it easy to integrate. It contains a $\diff{x}{t} dt$ factor, and the remaining dependence on $t$ is only through the function $x(t)$. If we change variables (do a $u$-substitution) of the form $u=x(t)$, then $du = \diff{x}{t} dt$, and we just replace the remaining appearances of $x(t)$ with $u$. The left hand side is then a simple integral in terms of the new variable $u$, which we can integrate and substitute back $u=x(t)$: \begin{align*} \int \frac{\diff{x}{t}dt}{ax(t) + b} &=\int \frac{du}{au + b}\\ &= \frac{1}{a} \log |au+b| + C_1 \\ &= \frac{1}{a} \log |ax(t)+b| + C_1, \end{align*} for some arbitrary constant $C_1$.

Since this expression must be equal to $\int 1 dt = t+C_2$ for another arbitrary constant $C_2$, we obtain an equation for $x(t)$ and $t$, \begin{align*} \frac{1}{a} \log |ax(t)+b| + C_1 & = t + C_2. \end{align*} Let $C_3=C_2-C_1$, and then solve the equation for $x(t)$: \begin{align*} \frac{1}{a} \log |ax(t)+b| &= t + C_3\\ |ax(t)+b| &= \exp(at + aC_3)\\ ax(t)+b &= \pm \exp(at + aC_3)\\ x(t) &= \pm \frac{1}{a}\exp(at + aC_3) -b/a. \end{align*} (The notation $\exp(z)$ is just another way of writing the exponential $e^z$.)

We can write this equation more simply by defining a new arbitrary constant $C= \pm \frac{1}{a}\exp(aC_3)$. Then, the solution to our ODE can be written as \begin{align} x(t) &= Ce^{at} -b/a. \label{linear_ode_sol}\tag{4} \end{align}

Can you verify that this solution for $x(t)$ does indeed satisfy the original ODE $\diff{x}{t}=ax+b$? Since checking that a solution satisfies an ODE is much easier and less error-prone than solving the ODE, verifying the solution is an essential step in the solution process.

Let's check our solution. If $x=Ce^{at} -b/a$, then $\diff{x}{t} = Cae^{at}$. On the other hand, $ax+b = Cae^{at}-b+b = Cae^{at}$. Yes, these expressions match, $\diff{x}{t}=ax+b$, and we can be confident of our solution.

In order to determine the constant $C$, we need an additional condition. For example, if $x(3)=4$, then $C$ must satisfy \begin{align*} 4 &= Ce^{3a} -b/a \end{align*} so that \begin{align*} C &= (4 +b/a)e^{-3a}. \end{align*}

Our solution for this initial condition is \begin{align*} x(t) &= (4 +b/a)e^{-3a}e^{at} -b/a \end{align*} or \begin{align*} x(t) &= (4 +b/a)e^{a(t-3)} -b/a. \end{align*}

#### A shortcut method to solving simple ODEs

For the above solution, we did some extra steps in order to demonstrate that the manipulations were really nothing more than a $u$-substitution. Usually, we'll skip many of these steps and use a shortcut method. However, before jumping into the shortcut method, make sure you understand how the above $u$-substitution works.

Let's revisit our solution method to see how we can take some shortcuts. The first thing we could do differently is avoid changing to the variable $u$. We could keep everything in terms of $x$, in which case, the $u$-substitution would be replacing $x(t)$ with $x$ and $\diff{x}{t}{dt}$ with $dx$.

Next, observe the results of the substitution. We started with \begin{align*} \frac{\diff{x}{t}}{ax + b} = 1 \end{align*} and ended up with \begin{align*} \int \frac{dx}{ax + b} = \int 1 dt, \end{align*} where now we wrote everything in terms of $x$ rather than $u$. To accomplish this manipulation, we multiplied by $dt$ and did our substitution to replace $\diff{x}{t}dt$ by $dx$. It was as though we canceled the $dt$ from the numerator with the $dt$ from the denominator. The derivative $\diff{x}{t}$ isn't really a fraction of numbers $dx$ and $dt$, but in an integral, applying the chain rule (i.e., $u$-substitution) makes it behave like it is a fraction.

Hence, in practice, we can safely treat $\diff{x}{t}$ like a fraction when used in this context of forming an integral to solve a differential equation. To solve the equation $\diff{x}{t}=ax+b$, we multiply both sides of the equation by $dt$ and divide both sides of the equation by $ax+b$ to get \begin{gather*} \frac{dx}{ax+b} = dt. \end{gather*} Then, we integrate both sides to obtain \begin{gather*} \int \frac{dx}{ax+b} = \int dt. \end{gather*} Just remember that these manipulations are really a shortcut way to denote using the chain rule.

The simple ODEs of this introduction give you a taste of what ordinary differential equations are and how we can solve them. You can check out some examples involving equations that you can solve just with the techniques learned here.

#### Thread navigation

##### Math 5447, Fall 2020

#### Similar pages

- Exponential growth and decay: a differential equation
- Spruce budworm outbreak model
- The Forward Euler algorithm for solving an autonomous differential equation
- Introduction to bifurcations of a differential equation
- Ordinary differential equation examples
- Solving linear ordinary differential equations using an integrating factor
- Examples of solving linear ordinary differential equations using an integrating factor
- Another differential equation: projectile motion
- Solving single autonomous differential equations using graphical methods
- Single autonomous differential equation problems
- More similar pages