# 4.2: 1st Order Ordinary Differential Equations

- Page ID
- 106821

We will discuss only two types of 1st order ODEs, which are the most common in the chemical sciences: **linear** 1st order ODEs, and **separable** 1st order ODEs. These two categories are not mutually exclusive, meaning that some equations can be both linear and separable, or neither linear nor separable.

## Separable 1st order ODEs

An ODE is called separable if it can be written as

\[\label{sep}\dfrac{dy}{dx}=\dfrac{g(x)}{h(y)}\]

A separable differential equation is the easiest to solve because it readily reduces to a problem of integration:

\[\label{sep2} \int h(y)dy=\int g(x)dx\]

For example: \(\dfrac{dy}{dx}=4y^2x\) can be written as \(y^{-2}dy=4xdx\) or \(\dfrac{1}{4}y^{-2}dy=xdx\). This equation is separable becuase the terms multiplying \(dy\) do not contain any terms involving \(x\), and the terms multiplying \(dx\) do not contain any terms involving \(y\). This allows you to integrate and solve for \(y(x)\):

\[ \begin{aligned} \int y^{-2}dy&=\int 4xdx \\ -\dfrac{1}{y}+c_1 &=2x^2+c_2 \\ y&=-\dfrac{1}{2x^2+c_3} \end{aligned} \nonumber\]

where \(c_3 = c_2-c_1\).

Let’s see how to separate other equations. If you wanted to finish these problems you would integrate both sides and solve for the dependent variable, as shown in the solved examples below. For now, let’s concentrate on how to separate the terms involving the independent variable from the terms involving the dependent variable:

Example 1:

\[ y' = e^{−y} (3 − x) \nonumber\]

\[ \frac{dy}{dx} = e^{−y} (3 − x) \nonumber\]

Separated ODE:

\[e^y dy = (3 − x)dx \nonumber\]

Example 2:

\[ \theta' = \frac{t^2}{ \theta} \nonumber\]

\[ \frac{d \theta}{dt} = \frac{t^2}{ \theta} \nonumber\]

Separated ODE:

\[ \theta d \theta = t^2dt \nonumber\]

Example 3:

\[ \frac{dA(t)}{dt} = \frac{2−t}{1−A(t)} \nonumber\]

Separated ODE:

\[(1 − A(t))dA = (2 − t)dt \nonumber\]

Example \(\PageIndex{1}\)

Solve the following differential equation: \(\frac{dy}{dx} = yx^2\)

**Solution**

We first ‘separate’ the terms involving \(y\) from the terms involving \(x\):

\[\frac{1}{y} dy = x^2 dx \nonumber\]

and then integrate both sides (it is crucial not to forget the integration constants):

\[ \int \frac{1}{y} dy = \int x^2 dx \rightarrow \ln y + c_1 = \frac{1}{3} x^3 + c_2 \nonumber\]

Remember that our goal is to find \(y(x)\), so our job now is to solve for \(y\):

\[ \begin{align*} \ln y + c_1 &= \frac{1}{3} x^3 + c_2 \\[4pt] \ln y &= \frac{1}{3} x^3 + c_2 − c_1 \\[4pt] &= \dfrac{1}{3} x^3 + c_3 \end{align*}\]

\[y = \exp \left( \frac{1}{3} x^3 + c_3 \right) = \exp \left( \dfrac{1}{3} x^3 \right) \exp(c_3) = \textcolor{red}{Ke^{x^3/3}} \nonumber\]

Notice that \(c_2 − c_1\) is a constant, so we re-named it \(c_3\). In addition, \(exp(c_3)\) is also a constant, so we re-named it \(K\). The names of the constants are not important.

Just to be on the safe side, let’s verify that \(Ke^{x^3/3}\) is indeed the solution of this differential equation. We’ll do it by substitution. On the left-hand side of the equation we have \(\frac{dy}{dx}\), and on the right-hand side we have \(yx^2\). We’ll replace \(y\) by \(Ke^{x^3/3}\) on both sides, and verify that the two sides are identical (the equality holds).

\[\frac{dy}{dx} = Ke^{x^3/3}x^2 \nonumber\]

\[yx^2 = Ke^{x^3/3}x^2 \nonumber\]

We just verified that the function \(Ke^{x^3/3}\) satisfies \(\frac{dy}{dx} = yx^2\), so we know our solution is correct!

Example \(\PageIndex{1}\) illustrates why you need to be very comfortable with the properties of the logarithmic and exponential functions. These functions appear everywhere in the physical sciences, so if you found this challenging you need to review your algebra!

Example \(\PageIndex{2}\)

Solve the following differential equation: \(\dfrac{dx}{dt} = x^2 t\)

This might look similar to example \(\PageIndex{1}\), but notice that in this case, \(x\) is the dependent variable.

**Solution**

We first ‘separate’ the terms involving \(x\) from the terms involving \(t\):

\[\dfrac{1}{x^2}dx=t dt \nonumber\]

and then integrate both sides (it is crucial not to forget the integration constants):

\[\int\dfrac{1}{x^2}dx=\int tdt\rightarrow -x^{-1}+c_1=t^2/2+c_2 \nonumber\]

Remember that our goal is to find \(x(t)\), so our job now is to solve for \(x\):

\[-x^{-1}+c_1=t^2/2+c_2 \nonumber\]

\[x^{-1}=-t^2/2+(c_1-c_2) \nonumber\]

\[x(t) =-\dfrac{1}{\dfrac{t^2}{2}+(c_2-c_1)}=\displaystyle{\color{Maroon}-\dfrac{1}{t^2/2+c}}. \nonumber\]

where \(c=(c_2-c_1)\).

Just to be on the safe side, let’s verify that our solution satisfies the differential equation. We’ll do it by substitution. On the left-hand side of the equation we have \(\dfrac{dx}{dt}\), and on the right-hand side we have \(t x^2\). We’ll replace \(x\) by \(-\dfrac{1}{t^2/2+c}\) on both sides, and verify that the two sides are identical (the equality holds).

\[\dfrac{dx}{dt} = \dfrac{t}{(t^2/2+c)^2} \nonumber\]

\[x^2t=\dfrac{t}{(t^2/2+c)^2} \nonumber\]

We just verified that the function \(-\dfrac{1}{t^2/2+c}\) satisfies \(\dfrac{dx}{dt} = tx^2\), so we know our solution is correct!

This example is also available as a video: http://tinyurl.com/kxdfqxq

Watch an additional solved example. http://tinyurl.com/kem7e6h

External Links:

## Linear 1st order ODEs

A general first-order linear ODE can be written

\[\label{linear}\dfrac{dy}{dx}+p(x) y=q(x)\]

Note that the linearity refers to the \(y\) and \(dy/dx\) terms, \(p(x)\) and \(q(x)\) do not need to be linear in \(x\). You may need to reorganize terms around to write your equation in the form shown in Equation \ref{linear}. For example, \(dy=(8 e^x-3y)dx\) is linear, because it can be re-organized as

\[\label{exlin1}\dfrac{dy}{dx}+3y=8e^x\]

Comparing Equations \ref{linear} and \ref{exlin1}, we see that in this case, \(p(x) = 3\) and \(q(x)=8e^x\). In this example \(p(x)\) is a constant, but this need not to be the case. The term \(p(x)\) can be any function of \(x\).

First order linear ODEs can be solved by multiplying by the integrating factor \(e^{ \int p(x)dx }\). This sounds very strange at first sight, but we will see how it works with the example of Equation \ref{exlin1}.

Our very first step is to write the equation so it looks like Equation \ref{linear}. We then calculate the integrating factor, in this case \(e^{ \int 3dx }=e^{3x}\). We next multiply both sides of the equation by the integrating factor:

\[\dfrac{dy}{dx} e^{3x}+3ye^{3x}=8e^xe^{3x}=8e^{4x} \nonumber\]

In the next step, we recognize that the left-hand side is the derivative of the dependent variable multiplied by the integrating factor:

\[\dfrac{dy}{dx} e^{3x}+3ye^{3x}=\dfrac{d}{dx} (y e^{3x}) \nonumber\]

This last step is the multiplication rule in reverse. If you start with \(\dfrac{d}{dx} (y e^{3x})\), you can apply the multiplication rule to obtain \(\dfrac{dy}{dx} e^{3x}+3ye^{3x}\). The whole point of calculating the integrating factor is that it guarantees that the left-hand side of the equation will always be the derivative of the dependent variable multiplied by the integrating factor. This will allow us to move \(dx\) to the right side, and integrate:

\[\dfrac{d}{dx} (y e^{3x})=8e^{4x} \nonumber\]

\[d(y e^{3x})=8e^{4x}dx \nonumber\]

\[\int d(y e^{3x})=\int 8e^{4x}dx \nonumber\]

The left-side of the above equation is \(\int d(y e^{3x})=y e^{3x}\), in the same way that \(\int dy=y\). The right side is \(\int 8e^{4x}dx=2e^{4x}+c\). Note that we included the integration constant only on one side. This is because we already saw that if we included integration constants in both sides we could group them into a single constant.

So far we have

\[y e^{3x}=2e^{4x}+c \nonumber\]

Now we need to solve for the dependent variable, in this case \(y(x)\). Dividing both terms by \(e^{3x}\):

\[y =2e^{x}+c e^{-3x} \nonumber\]

which is the general solution of Equation \ref{exlin1}. Before moving on let’s verify that this function satisfies Equation \ref{exlin1} by substituting \(y\) by \(y =2e^{x}+c e^{-3x}\):

\[\dfrac{dy}{dx}=2e^x-3ce^{-3x} \nonumber\]

\[3y = 6e^{x}+3c e^{-3x} \nonumber\]

\[\dfrac{dy}{dx}+3y =2e^x-3ce^{-3x} +6e^{x}+3c e^{-3x}=8e^{x} \nonumber\]

which equals the right-hand side of Equation \ref{exlin1}. This verifies that \(y =2e^{x}+c e^{-3x}\) is indeed the general solution of Equation \ref{exlin1}. If we were given an initial condition we could calculate the value of \(c\) and obtain the particular solution.

Let’s review and list the steps we used to find the solution of a linear 1st order ODE:

- Re-arrange the terms so the equation has the form \(\dfrac{dy}{dx}+p(x) y=q(x)\)
- Multiply both sides of the equation by the integrating factor \(e^{\int p(x)dx}\)
- Recognize that the left-hand side can be written as \(\dfrac{d}{dx} \left( y e^{\int p(x)dx}\right)\)
- Move \(dx\) to the right-hand side and integrate. Remember the integration constants!
- Solve for the dependent variable
- If given, use the initial condition to calculate the value of the arbitrary constant.
- Verify your solution is correct by substitution into the differential equation.

See another solved example to see this method in action: http://tinyurl.com/lzluktp

External Links: http://www.youtube.com/watch?v=HAb9JbBD2ig