Online Textbook Practice Tests 1500 Calculus Problems Solved About

8.5: First-Order Linear Differential Equations

Separation of Variables is a valuable framework that enables us to solve many types of differential equations. Unsurprisingly, the method fails when a differential equation cannot be separated. In these cases, specialized techniques must be applied to attain solutions if doing so is possible. In this section our strategy is to reverse-engineer the Product Rule, forcing one side of a differential equation to be the product of two functions. We will solve differential equations of the form \begin{equation} y' + P(x) y = Q(x) \pd \label{eq:linear} \end{equation} We call equations in this form first-order linear differential equations because \(y\) and \(y'\) both have a power of \(1.\) Our goal is to manipulate the left side of \(\eqref{eq:linear}\) to be the derivative of a product of functions.

In \(\eqref{eq:linear},\) we multiply both sides by a function \(\mu(x) \col\) \begin{equation} \mu(x) y' + P(x) \mu(x) y = Q(x) \mu(x) \pd \label{eq:linear-mu} \end{equation} We choose \(\mu(x)\) to satisfy \(\mu'(x) = P(x) \mu(x).\) Then \(\eqref{eq:linear-mu}\) becomes \begin{equation} \mu(x) y' + \mu'(x) y = Q(x) \mu (x) \cma \label{eq:linear-mu-d} \end{equation} where the left side matches the Product Rule expansion of \([y \mu(x)]'.\) Thus, we rewrite \(\eqref{eq:linear-mu-d}\) as \[ \deriv{}{x} [y \mu(x)] = Q(x) \mu(x) \cma \] and integrating both sides yields \begin{align} y \mu(x) &= C + \int Q(x) \mu(x) \di x \nonumber \nl y &= \frac{C}{\mu(x)} + \frac{1}{\mu(x)} \int Q(x) \mu(x) \di x \label{eq:linear-equation-y} \pd \end{align} We call \(\mu(x)\) an integrating factor. Since we choose \(\mu(x)\) to satisfy \(\mu'(x) = P(x) \mu(x),\) we solve for \(\mu(x)\) using Separation of Variables, as follows: \begin{align} \deriv{\mu}{x} &= P(x) \mu(x) \nonumber \nl \frac{1}{\mu} \dd \mu &= P(x) \di x \nonumber \nl \ln|\mu| &= \int P(x) \di x \nonumber \nl \mu(x) &= e^{\int P(x) \di x} \pd \label{eq:mu} \end{align} Substituting \(\eqref{eq:mu}\) into \(\eqref{eq:linear-equation-y}\) then produces a general solution to \(\eqref{eq:linear}\)—namely, \begin{equation} y = Ce^{-\int P(x) \di x} + e^{-\int P(x) \di x} \int Q(x) e^{\int P(x) \di x} \di x \pd \label{eq:linear-sol} \end{equation}

We omit the constant of integration in \(\mu(x) = e^{\int P(x) \di x}\) because we only need one integrating factor.

SOLVING FIRST-ORDER LINEAR DIFFERENTIAL EQUATIONS
Consider the first-order linear differential equation \[y' + P(x) y = Q(x) \pd\] The following steps enable you to find the general solution:
  1. Multiply both sides of the equation by an integrating factor, \[\mu(x) = e^{\int P(x) \di x} \cma\] to obtain \[y' e^{\int P(x) \di x} + P(x) e^{\int P(x) \di x} y = Q(x) e^{\int P(x) \di x} \pd\] The left side is the derivative of the product \(y e^{\int P(x) \di x}.\)
  2. Integrate both sides to get \[y e^{\int P(x) \di x} = C + \int Q(x) e^{\int P(x) \di x} \di x \pd\]
  3. Solve for \(y.\)
EXAMPLE 1
Solve \[ y' + 2x y = e^{-x^2} \pd \]
This equation is a first-order linear differential equation, matching \(\eqref{eq:linear}\) with \(P(x) = 2x\) and \(Q(x) = e^{-x^2}.\) We can't separate the equation, so we instead multiply by an integrating factor to transform the left side into a Product Rule expansion. Since \(P(x) = 2x,\) an integrating factor is \[\mu(x) = e^{\int 2x \di x} = e^{x^2} \pd\] (We neglect any constant of integration because we need only one integrating factor, so we choose the simplest.) Multiplying both sides of the differential equation by \(\mu(x) = e^{x^2}\) gives \begin{equation*} e^{x^2} y' + 2xy e^{x^2} = 1 \pd \end{equation*} The left side is the Product Rule expansion of \(\par{y e^{x^2}}',\) so we rewrite the equation as \[\par{ye^{x^2}}' = 1 \pd \] Integrating both sides then gives \[ye^{x^2} = x + C \implies \boxed{y = xe^{-x^2} + Ce^{-x^2}}\]
EXAMPLE 2
Using an integrating factor, solve the initial value problem \[x^3 y' + x^2y = x \cmaa x \gt 0 \cmaa y(1) = 2 \pd\]
The equation doesn't match the form of \(\eqref{eq:linear},\) so we divide both sides by \(x^3\) (since \(x \ne 0\)) to get \begin{equation} y' + \frac{1}{x} y = \frac{1}{x^2} \pd \label{eq:ex-x2y} \end{equation} We then see \(P(x) = 1/x.\) An integrating factor is then \[\mu(x) = e^{\int(1/x) \di x} = e^{\ln|x|} = \abs x \pd\] Because we are given \(x \gt 0,\) we can write \(\mu(x) = x.\) Multiplying both sides of \(\eqref{eq:ex-x2y}\) by \(\mu(x) = x\) then yields \begin{equation*} xy' + y = \frac{1}{x} \cma \end{equation*} where the left side is the Product Rule expansion of \((xy)'.\) We then rewrite the equation as \[(xy)' = \frac{1}{x} \cma\] and we integrate both sides to get \begin{equation*} xy = \ln|x| + C \pd \end{equation*} Substituting \(y(1) = 2\) shows \[1(2) = \ln 1 + C \implies C = 2 \pd\] Thus, the solution is \[ xy = \ln x + 2 \implies \boxed{y = \frac{1}{x} \ln x + \frac{2}{x}} \] (The absolute value bars are dropped because \(x \gt 0\) is given.)
EXAMPLE 3
Solve \[y' + 2y \cos x = \cos x \pd\]
Comparing this equation to \(\eqref{eq:linear},\) we see \(P(x) = 2 \cos x\) and \(Q(x) = \cos x.\) We then choose an integrating factor to be \[\mu(x) = e^{\int P(x) \di x} = e^{\int 2 \cos x \di x} = e^{2 \sin x} \pd\] Multiplying both sides of the differential equation by this factor produces \begin{equation*} y' e^{2 \sin x} + 2 e^{2 \sin x} (\cos x) y = e^{2 \sin x} \cos x \pd \end{equation*} The left side is, by the Product Rule, the derivative of \(y e^{2 \sin x}.\) We then rewrite the equation and integrate: \begin{align*} \par{y e^{2 \sin x}}' &= e^{2 \sin x} \cos x \nl ye^{2 \sin x} &= \int e^{2 \sin x} \cos x \di x \pd \end{align*} To evaluate the integral on the right, we substitute \(u = 2 \sin x;\) then \(\dd u = 2 \cos x \di x.\) Doing so shows \[\tfrac{1}{2} \int e^u \di u = \tfrac{1}{2} e^{u} + C = \tfrac{1}{2} e^{2 \sin x} + C \pd\] Hence, the solution is \[ye^{2 \sin x} = \tfrac{1}{2} e^{2 \sin x} + C \implies \boxed{y = \tfrac{1}{2} + Ce^{-2 \sin x}}\]

A first-order linear differential equation takes the form \[y' + P(x) y = Q(x) \cma\] which is called linear because the powers of \(y\) and \(y'\) are both \(1.\) To find the general solution of a first-order linear differential equation, use the following steps:

  1. Multiply both sides of the equation by an integrating factor, \[\mu(x) = e^{\int P(x) \di x} \cma\] to obtain \[y' e^{\int P(x) \di x} + P(x) e^{\int P(x) \di x} y = Q(x) e^{\int P(x) \di x} \pd\] The left side is the derivative of the product \(y e^{\int P(x) \di x}.\)
  2. Integrate both sides to get \[y e^{\int P(x) \di x} = C + \int Q(x) e^{\int P(x) \di x} \di x \pd\]
  3. Solve for \(y.\)