Section 8.3 First Order Linear Differential Equations
In the previous section, we explored a specific techique to solve a specific type of differential equation called a separable differential equation. In this section, we develop and practice a technique to solve a type of differential equation called a first order linear differential equation.
Recall than a linear algebraic equation in one variable is one that can be written \(ax + b = 0\text{,}\) where \(a\) and \(b\) are real numbers. Notice that the variable \(x\) appears to the first power. The equations \(\sqrt{x}+1=0\) and \(\sin(x)3x = 0\) are both nonlinear. A linear differential equation is one in which the dependent variable and its derivatives appear only to the first power. We focus on first order equations, which involve first (but not higher order) derivatives of the dependent variable.
Subsection 8.3.1 Solving First Order Linear Equations
Definition 8.3.2. First Order Linear Differential Equation.
A first order linear differential equation is a differential equation that can be written in the form
where \(p\) and \(q\) are arbitrary functions of the independent variable \(x\text{.}\)
Example 8.3.3. Classifying Differential Equations.
Classify each differential equation as first order linear, separable, both, or neither.
\(\displaystyle \displaystyle \yp = xy\)
\(\displaystyle \displaystyle \yp = e^y + 3x\)
\(\displaystyle \displaystyle \yp  (\cos(x))y = \cos(x)\)
\(\displaystyle \displaystyle y\yp 3xy = 4\ln(x)\)
Both. We identify \(p(x) = x\) and \(q(x) = 0\text{.}\) The separated form of the equation is \(\displaystyle \frac{dy}{y} = x\,dx\text{.}\)
Neither. The \(e^y\) term makes the equation nonlinear. Because of the addition, it is not possible to write the equation in separated form.
First order linear. We identify \(p(x) = \cos(x)\) and \(q(x) = \cos(x)\text{.}\) The equation cannot be written in separated form.
Neither. Notice that dividing by \(y\) results in the nonlinear term \(\displaystyle \frac{4\ln(x)}{y}\text{.}\) It is not possible to write the equation in separated form.
Notice that linearity depends on the dependent variable \(y\text{,}\) not the independent variable \(x\text{.}\) The functions \(p(x)\) and \(q(x)\) need not be linear, as demonstrated in part (c) of Example 8.3.3. Neither \(\cos(x)\) nor \(\sin(x)\) are linear functions of \(x\text{,}\) but the differential equation is still linear.
Before working out a general technique for solving first order linear differential equations, we look at a specific example. Consider the differential equation
This is an easy differential equation to solve. On the left, the antiderivative of the derivative is simply the function \(xy\text{.}\) Using the substitution \(u = \sin(x)\) on the right and integrating results in the implicit solution
Solving for \(y\) yields the explicit solution
Though not obvious, the differential equation above is actually a linear differential equation. Using the product rule and implicit differentiation, we can write \(\displaystyle \frac{d}{dx}\big(xy\big) = x\frac{dy}{dx} + y\text{.}\) Our original differential equation can be written
If we divide by \(x\text{,}\) we have
which matches the form in Definition 8.3.2. Reversing our steps would lead us back to the original form our our differential equation.
As motivated by the problem we just explored, the basic idea behind solving first order linear differential equations is to multiply both sides of the differential equation by a function, called an integrating factor, that makes the left hand side of the equation look like an expanded Product Rule. We then condense the left hand side into the derivative of a product and integrate both sides. An obvious question is, “How do you find this integrating factor?”
Consider the first order linear equation
Let's call the integrating factor \(\mu(x)\text{.}\) We multiply both sides of the differential equation by \(\mu(x)\) to get
Our goal is to choose \(\mu(x)\) so that the left hand side of the differential equation looks like the result of a Product Rule. The left hand side of the equation is
Using the Product Rule and Implicit Differentiation,
Equating \(\frac{d}{dx} \big ( \mu(x) y \big )\) and \(\mu(x) \left ( \frac{dy}{dx} + p(x)y \right )\) gives
which is equivalent to
In order for the integrating factor \(\mu(x)\) to perform its job, it must solve the differential equation above. But that differential equation is separable, so we can solve it. The separated form is
Integrating,
or
If \(\mu(x)\) is chosen this way, after multiplying by \(\mu(x)\text{,}\) we can always write the differential equation in the form
Integrating and solving for \(y\text{,}\) the explicit solution is
Though this formula can be used to write down the solution to a first order linear equation, we shy away from simply memorizing a formula. The process is lost, and it's easy to forget the formula. Rather, we always always follow the steps outlined in Key Idea 8.3.5 when solving equations of this type.
Key Idea 8.3.5. Solving First Order Linear Equations.

Write the differential equation in the form
\begin{equation*} \frac{dy}{dx} + p(x)y = q(x)\text{.} \end{equation*} 
Compute the integrating factor
\begin{equation*} \mu(x) = e^{\int p(x)\,dx}\text{.} \end{equation*} 
Multiply both sides of the differential equation by \(\mu(x)\text{,}\) and condense the left hand side to get
\begin{equation*} \frac{d}{dx}\big( \mu(x)y \big) = \mu(x)q(x)\text{.} \end{equation*} Integrate both sides of the differential equation with respect to \(x\text{,}\) taking care to remember the arbitrary constant.
Solve for \(y\) to find the explicit solution to the differential equation.
Let's practice the process by solving the two first order linear differential equations from Example 8.3.3.
Example 8.3.6. Solving a First Order Linear Equation.
Find the general solution to \(\yp = xy\text{.}\)
We solve by following the steps in Key Idea 8.3.5. Unlike the process for solving separable equations, we need not worry about losing constant solutions. The answer we find will be the general solution to the differential equation. We first write the equation in the form
By identifying \(p(x) = x\text{,}\) we can compute the integrating factor
Multiplying both side of the differential equation by \(\mu(x)\text{,}\) we have
The left hand side of the differential equation condenses to yield
We integrate both sides with respect to \(x\) to find the implicit solution
or the explicit solution
Example 8.3.7. Solving a First Order Linear Equation.
Find the general solution to \(\yp (\cos(x))y = \cos(x)\text{.}\)
The differential equation is already in the correct form. The integrating factor is given by
Multiplying both sides of the equation by the integrating factor and condensing,
Using the substitution \(u = \sin(x)\text{,}\) we can integrate to find the implicit solution
The explicit form of the general solution is
We continue our practice by finding the particular solution to an initial value problem.
Example 8.3.8. Solving a First Order Linear Initial Value Problem.
Solve the initial value problem \(\displaystyle x\yp  y = x^3\ln(x)\text{,}\) with \(y(1)=0\text{.}\)
We first divide by \(x\) to get
The integrating factor is given by
Multiplying both sides of the differential equation by the integrating factor and condensing the left hand side, we have
Using Integrating by Parts to find the antiderivative of \(x\ln(x)\text{,}\) we find the implicit solution
Solving for \(y\text{,}\) the explicit solution is
The initial condition \(y(1) = 0\) yields \(C = 1/4\text{.}\) The solution to the initial value problem is
Differential equations are a valuable tool for exploring various physical problems. This process of using equations to describe real world situations is called mathematical modeling, and is the topic of the next section. The last two examples in this section begin our discussion of mathematical modeling.
Example 8.3.9. A Falling Object Without Air Resistance.
Suppose an object with mass \(m\) is dropped from an airplane. Find and solve a differential equation describing the vertical velocity of the object assuming no air resistance.
The basic physical law at play is Newton's second law,
Using the fact that acceleration is the derivative of velocity, mass × acceleration can be writting \(mv'\text{.}\) In the absence of air resistance, the only force of interest is the force due to gravity. This force is approximately constant, and is given by \(mg\text{,}\) where \(g\) is the gravitational constant. The word equation above can be written as the differential equation
Because \(g\) is constant, this differential equation is simply an integration problem, and we find
Since \(v = C\) with \(t=0\text{,}\) we see that the arbitrary constant here corresponds to the initial vertical velocity of the object.
The process of mathematical modeling does not stop simply because we have found an answer. We must examine the answer to see how well it can describe real world observations. In the previous example, the answer may be somewhat useful for short times, but intuition tells us that something is missing. Our answer says that a falling object's velocity will increase linearly as a function of time, but we know that a falling object does not speed up indefinitely. In order to more fully describe real world behavior, our mathematical model must be revised.
Example 8.3.11. A Falling Object with Air Resistance.
Suppose an object with mass \(m\) is dropped from an airplane. Find and solve a differential equation describing the vertical velocity of the object, taking air resistance into account.
We still begin with Newon's second law, but now we assume that the forces in the object come both from gravity and from air resistance. The gravitational force is still given by \(mg\text{.}\) For air resistance, we assume the force is related to the velocity of the object. A simple way to describe this assumption might be \(kv^{p}\text{,}\) where \(k\) is a proportionality constant and \(p\) is a positive real number. The value \(k\) depends on various factors such as the density of the object, surface area of the object, and density of the air. The value \(p\) affects how changes in the velocity affect the force. Taken together, a function of the form \(kv^{p}\) is often called a power law. The differential equation for the velocity is given by
(Notice that the force from air resistance opposes motion, and points in the opposite direction as the force from gravity.) This differential equation is separable, and can be written in the separated form
For arbitrary positive \(p\text{,}\) the integration is difficult, making this problem hard to solve analytically. In the case that \(p=1\text{,}\) the differential equation becomes linear, and is easy to solve either using either separation of variables or integrating factor techniques. We assume \(p=1\text{,}\) and proceed with an integrating factor so we can continue practicing the process. Writing
we identify the integrating factor
Then
so
or
In the solution above, the exponential term decays as time increases, causing the velocity to approach the constant value \(mg/k\) in the limit as \(t\) approaches infinity. This value is called the terminal velocity. If we assume a zero initial velocity (the object is dropped, not thrown from the plane), the velocities from Examples 8.3.9 and Example 8.3.11 are given by \(v = gt\) and \(v = \displaystyle \frac{mg}{k}\left (1  e^{\frac{k}{m}t}\right )\text{,}\) respectively. These two functions are shown in Figure 8.3.12, with \(g = 9.8, m=1\text{,}\) and \(k=1\text{.}\) Notice that the two curves agree well for short times, but have dramatically different behaviors as \(t\) increases. Part of the art in mathematical modeling is deciding on the level of detail required to answer the question of interest. If we are only interested in the initial behavior of the falling object, the simple model in Example 8.3.9 may be sufficient. If we are interested in the longer term behavior of the object, the simple model is not sufficient, and we should consider a more complicated model.
Exercises 8.3.2 Exercises
Problems
Exercise Group.
In the following exercises, Find the general solution to the first order linear differential equation.
1.
\(\displaystyle \yp = 2y  3\)
2.
\(\displaystyle x^2\yp + xy = 1\)
3.
\(\displaystyle x^2\yp  xy = 1\)
4.
\(\displaystyle x\yp +4y = x^3x\)
5.
\(\displaystyle (\cos^2 x \sin(x))\yp + (\cos^3 x)y = 1\)
6.
\(\displaystyle \frac{\yp}{x} = 12y\)
7.
\(\displaystyle x^3\yp3x^3y=x^4e^{2x}\)
8.
\(\displaystyle \yp + y = 5\sin(2x)\)
Exercise Group.
In the following exercises, Find the particular solution to the initial value problem.
9.
\(\displaystyle \yp = y + 2xe^x\text{,}\) \(y(0) = 2\)
10.
\(\displaystyle x\yp + 2y = x^2  x + 1\text{,}\) \(y(1) = 1\)
11.
\(\displaystyle x\yp + (x+2)y = x\text{,}\) \(y(1) = 0\)
12.
\(\displaystyle \yp + 2y = 0\text{,}\) \(y(0) = 3\)
13.
\(\displaystyle (x+1)\yp + (x+2)y = 2xe^{x}\text{,}\) \(y(0) = 1\)
14.
\(\displaystyle (\cos(x))\yp + (\sin(x))y = 1\text{,}\) \(y(0) = 3\)
15.
\(\displaystyle (x^21)\yp + 2y = (x+1)^2\text{,}\) \(y(0) = 2\)
16.
\(\displaystyle x\yp2y = \frac{x^3}{1+x^2}\text{,}\) \(y(1) = 0\)
Exercise Group.
In the following exercises, classify the differential equation as separable, first order linear, or both, and solve the initial value problem using an appropriate method.
17.
\(\displaystyle \yp = y + yx^2\text{,}\) \(y(0) = 5\)
18.
\(\displaystyle xe^y \yp = x^2\sin(x)\text{,}\) \(y(0) = 0\)
19.
\(\displaystyle (x1)\yp+y = x^21\text{,}\) \(y(0) = 2\)
20.
\(\displaystyle \yp = y^2+y2\text{,}\) \(y(0) = 1\)
Exercise Group.
In the following exercises, draw a slope field for the differential equation. Use the slope field to predict the behavior of the solution to the initial value problem for large \(x\) values. Solve the initial value problem, and verify your prediction.
21.
\(\displaystyle \yp = xy\text{,}\) \(y(0) = 0\)
22.
\(\displaystyle (X+1)\yp + y = \frac{1}{x+1}\text{,}\) \(y(0) = 2\)