## First-Order Differential Equations

### Learning Outcomes

• Write a first-order linear differential equation in standard form
• Find an integrating factor and use it to solve a first-order linear differential equation

See the example on the introduction page for a first-order linear differential equation.

### Definition

A first-order differential equation is linear if it can be written in the form

$a\left(x\right){y}^{\prime }+b\left(x\right)y=c\left(x\right)$,

where $a\left(x\right),b\left(x\right)$, and $c\left(x\right)$ are arbitrary functions of $x$.

Remember that the unknown function $y$ depends on the variable $x$; that is, $x$ is the independent variable and $y$ is the dependent variable. Some examples of first-order linear differential equations are

$\begin{array}{ccc}\hfill \left(3{x}^{2}-4\right)y^{\prime} +\left(x - 3\right)y& =\hfill & \sin{x}\hfill \\ \hfill \left(\sin{x}\right)y^{\prime} -\left(\cos{x}\right)y& =\hfill & \cot{x}\hfill \\ \hfill 4xy^{\prime} +\left(3\text{ln}x\right)y& =\hfill & {x}^{3}-4x.\hfill \end{array}$

Examples of first-order nonlinear differential equations include

$\begin{array}{ccc}\hfill {\left(y^{\prime} \right)}^{4}-{\left(y^{\prime} \right)}^{3}& =\hfill & \left(3x - 2\right)\left(y+4\right)\hfill \\ \hfill 4y^{\prime} +3{y}^{3}& =\hfill & 4x - 5\hfill \\ \hfill {\left(y^{\prime} \right)}^{2}& =\hfill & \sin{y}+\cos{x}.\hfill \end{array}$

These equations are nonlinear because of terms like ${\left({y}^{\prime }\right)}^{4},{y}^{3}$, etc. Due to these terms, it is impossible to put these equations into the same form as the definition.

## Standard Form

Consider the differential equation

$\left(3{x}^{2}-4\right){y}^{\prime }+\left(x - 3\right)y=\sin{x}$.

Our main goal in this section is to derive a solution method for equations of this form. It is useful to have the coefficient of ${y}^{\prime }$ be equal to $1$. To make this happen, we divide both sides by $3{x}^{2}-4$.

${y}^{\prime }+\left(\frac{x - 3}{3{x}^{2}-4}\right)y=\frac{\sin{x}}{3{x}^{2}-4}$

This is called the standard form of the differential equation. We will use it later when finding the solution to a general first-order linear differential equation. Returning to the definition, we can divide both sides of the equation by $a\left(x\right)$. This leads to the equation

${y}^{\prime }+\frac{b\left(x\right)}{a\left(x\right)}y=\frac{c\left(x\right)}{a\left(x\right)}$.

Now define $p\left(x\right)=\frac{b\left(x\right)}{a\left(x\right)}$ and $q\left(x\right)=\frac{c\left(x\right)}{a\left(x\right)}$. Then the definition becomes

${y}^{\prime }+p\left(x\right)y=q\left(x\right)$.

We can write any first-order linear differential equation in this form, and this is referred to as the standard form for a first-order linear differential equation.

### Example: Writing First-Order Linear Equations in Standard Form

Put each of the following first-order linear differential equations into standard form. Identify $p\left(x\right)$ and $q\left(x\right)$ for each equation.

1. $y^{\prime} =3x - 4y$
2. $\frac{3xy^{\prime} }{4y - 3}=2$ (here $x>0$)
3. $y=3y^{\prime} -4{x}^{2}+5$

Watch the following video to see the worked solution to Example: Writing First-Order Linear Equations in Standard Form.

You can view the transcript for “4.5.1” here (opens in new window).

### try it

Put the equation $\frac{\left(x+3\right)y^{\prime} }{2x - 3y - 4}=5$ into standard form and identify $p\left(x\right)$ and $q\left(x\right)$.

## Integrating Factors

We now develop a solution technique for any first-order linear differential equation. We start with the standard form of a first-order linear differential equation:

$y^{\prime} +p\left(x\right)y=q\left(x\right)$.

The first term on the left-hand side of ${y}^{\prime }+\frac{b\left(x\right)}{a\left(x\right)}y=\frac{c\left(x\right)}{a\left(x\right)}$ is the derivative of the unknown function, and the second term is the product of a known function with the unknown function. This is somewhat reminiscent of the power rule from the Differentiation Rules section. If we multiply ${y}^{\prime }+p\left(x\right)y=q\left(x\right)$ by a yet-to-be-determined function $\mu \left(x\right)$, then the equation becomes

$\mu \left(x\right){y}^{\prime }+\mu \left(x\right)p\left(x\right)y=\mu \left(x\right)q\left(x\right)$.

The left-hand side of $y^{\prime} +p\left(x\right)y=q\left(x\right)$ can be matched perfectly to the product rule:

$\frac{d}{dx}\left[f\left(x\right)g\left(x\right)\right]={f}^{\prime }\left(x\right)g\left(x\right)+f\left(x\right){g}^{\prime }\left(x\right)$.

Matching term by term gives $y=f\left(x\right),g\left(x\right)=\mu \left(x\right)$, and ${g}^{\prime }\left(x\right)=\mu \left(x\right)p\left(x\right)$. Taking the derivative of $g\left(x\right)=\mu \left(x\right)$ and setting it equal to the right-hand side of ${g}^{\prime }\left(x\right)=\mu \left(x\right)p\left(x\right)$ leads to

${\mu }^{\prime }\left(x\right)=\mu \left(x\right)p\left(x\right)$.

This is a first-order, separable differential equation for $\mu \left(x\right)$. We know $p\left(x\right)$ because it appears in the differential equation we are solving. Separating variables and integrating yields

$\begin{array}{ccc}\hfill \frac{{\mu }^{\prime }\left(x\right)}{\mu \left(x\right)}& =\hfill & p\left(x\right)\hfill \\ \hfill {\displaystyle\int \frac{{\mu }^{\prime }\left(x\right)}{\mu \left(x\right)}dx}& =\hfill & {\displaystyle\int p\left(x\right)dx}\hfill \\ \hfill \text{ln}|\mu \left(x\right)|& =\hfill & {\displaystyle\int p\left(x\right)dx+C}\hfill \\ \hfill {e}^{\text{ln}|\mu \left(x\right)|}& =\hfill & {e}^{\displaystyle\int p\left(x\right)dx+C}\hfill \\ \hfill |\mu \left(x\right)|& =\hfill & {C}_{1}{e}^{\displaystyle\int p\left(x\right)dx}\hfill \\ \hfill \mu \left(x\right)& =\hfill & {C}_{2}{e}^{\displaystyle\int p\left(x\right)dx}\hfill \end{array}$

Here ${C}_{2}$ can be an arbitrary (positive or negative) constant. This leads to a general method for solving a first-order linear differential equation. We first multiply both sides of ${y}^{\prime }+p\left(x\right)y=q\left(x\right)$ by the integrating factor $\mu \left(x\right)$. This gives

$\mu \left(x\right){y}^{\prime }+\mu \left(x\right)p\left(x\right)y=\mu \left(x\right)q\left(x\right)$.

The left-hand side of the above equation can be rewritten as $\frac{d}{dx}\left(\mu \left(x\right)y\right)$.

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

Next integrate both sides with respect to $x$.

$\begin{array}{ccc}\hfill {\displaystyle\int \frac{d}{dx}\left(\mu \left(x\right)y\right)dx}& =\hfill & {\displaystyle\int \mu \left(x\right)q\left(x\right)dx}\hfill \\ \hfill \mu \left(x\right)y& =\hfill & {\displaystyle\int \mu \left(x\right)q\left(x\right)dx}\hfill \end{array}$

Divide both sides by $\mu \left(x\right)\text{:}$

$y=\dfrac{1}{\mu \left(x\right)}\left[\displaystyle\int \mu \left(x\right)q\left(x\right)dx+C\right]$.

Since $\mu \left(x\right)$ was previously calculated, we are now finished. An important note about the integrating constant $C\text{:}$ It may seem that we are inconsistent in the usage of the integrating constant. However, the integral involving $p\left(x\right)$ is necessary in order to find an integrating factor for ${y}^{\prime }+\frac{b\left(x\right)}{a\left(x\right)}y=\frac{c\left(x\right)}{a\left(x\right)}$. Only one integrating factor is needed in order to solve the equation; therefore, it is safe to assign a value for $C$ for this integral. We chose $C=0$. When calculating the integral inside the brackets in $\frac{d}{dx}\left(\mu \left(x\right)y\right)=\mu \left(x\right)q\left(x\right)$, it is necessary to keep our options open for the value of the integrating constant, because our goal is to find a general family of solutions to ${y}^{\prime }+\frac{b\left(x\right)}{a\left(x\right)}y=\frac{c\left(x\right)}{a\left(x\right)}$. This integrating factor guarantees just that.

### Problem-Solving Strategy: Solving a First-order Linear Differential Equation

1. Put the equation into standard form and identify $p\left(x\right)$ and $q\left(x\right)$.
2. Calculate the integrating factor $\mu \left(x\right)={e}^{\displaystyle\int p\left(x\right)dx}$.
3. Multiply both sides of the differential equation by $\mu \left(x\right)$.
4. Integrate both sides of the equation obtained in step $3$, and divide both sides by $\mu \left(x\right)$.
5. If there is an initial condition, determine the value of $C$.

### Example: Solving a First-order Linear Equation

Find a general solution for the differential equation $xy^{\prime} +3y=4{x}^{2}-3x$. Assume $x>0$.

Watch the following video to see the worked solution to Example: Solving a First-Order Linear Equation.

For closed captioning, open the video on its original page by clicking the Youtube logo in the lower right-hand corner of the video display. In YouTube, the video will begin at the same starting point as this clip, but will continue playing until the very end.

### try it

Find the general solution to the differential equation $\left(x - 2\right)y^{\prime} +y=3{x}^{2}+2x$. Assume $x>2$.

Now we use the same strategy to find the solution to an initial-value problem.

### Example: A First-order Linear Initial-Value Problem

Solve the initial-value problem

${y}^{\prime }+3y=2x - 1,y\left(0\right)=3$.

Watch the following video to see the worked solution to Example: A First-Order Linear Initial-Value Problem.

For closed captioning, open the video on its original page by clicking the Youtube logo in the lower right-hand corner of the video display. In YouTube, the video will begin at the same starting point as this clip, but will continue playing until the very end.

### try it

Solve the initial-value problem $y^{\prime} -2y=4x+3, y\left(0\right)=-2$.