First Order Linear Differential Equation – Form, Solution, and Examples

The first order linear differential equation is one of the most fundamental and frequently used differential equations. Knowing how to manipulate them and learning how to solve them is essential in advanced mathematics, physics, engineering, and other disciplines. 

A differential equation can be identified as a first order linear differential equation using its standard form: $\boldsymbol{\dfrac{dy}{dx} + P(x)y = Q(x)}$. We normally use the integrating factor method to solve first order differential equations.

In this article, we’ll show you a straightforward approach to identifying and solving first-order linear differential equations. Understanding the basic elements of differential equations and how to utilize integrating factors are a prerequisite in our discussion. Don’t worry, we’ve linked important reference articles as we go.

For now, let’s go ahead and understand the components of a first order linear differential equation! You’ll eventually learn how to work on different types of first order linear differential equations later in our discussion.

What Is a First Order Linear Differential Equation?

From its name, we can see that a first order linear differential equation only has the first power in the differential term.  More importantly, a first order linear differential equation is a differential equation that has a general form shown below.

\begin{aligned}y^{\prime}(x) + P(x)y &= Q(x)\\\dfrac{dy}{dx} + P(x)y &= Q(x)\end{aligned}

Keep in mind that $P(x)$ and $Q(x)$ must be continuous functions throughout the given interval. In this form, we can see that the derivative, $\dfrac{dy}{dx}$, is isolated and the two functions are both defined by a single variable, $x$.  Here are some examples of first order linear differential equations:

EXAMPLES OF FIRST ORDER LINEAR DIFFERENTIAL EQUATIONS

\begin{aligned}&(1)\phantom{xx}\dfrac{dy}{dx} + \dfrac{1}{x}y = \cos x\\&(2)\phantom{xxx}y^{\prime} + e^xy  = 2e^x\\&(3)\phantom{xxx}y + 6x^2  = 4y^{\prime} + 10 \end{aligned}

There are instances when first order linear differential equations are still not in their standard form, so familiarize yourself with the general form since rewriting equations in standard form is key when solving them.

Let’s take a look at the third example: $ y + 6x^2  = 4y^{\prime} + 10$. At first glance, it may not appear that the equation is a first order linear differential equation. To confirm its nature, we can try to isolate $y^{\prime}$ and write the equation in standard form.

\begin{aligned}y + 6x^2  &= 4y^{\prime} + 10\\\dfrac{1}{4}y + \dfrac{3}{2}x^2  &= y^{\prime} + \dfrac{5}{2} \\y^{\prime} + \dfrac{1}{4}y &= \dfrac{1}{2}(5 – 3x^2)\end{aligned}

In this form, we can confirm that the equation is indeed a first order linear differential equation, where $P(x) =\dfrac{1}{4}$ and $Q(x) = \dfrac{1}{2}(5 – 3x^2)$. When we encounter equations that can’t be written in the standard form, we call the equation nonlinear. Now that we’ve learned how to identify first order differential equations, it’s time for us to learn how to find the solutions for these types of equations.

How To Solve First Order Linear Differential Equations?

When given a first order linear differential equation that is written in the standard form, $\dfrac{dy}{dx} + P(x)y = Q(x)$, we can apply the following process to solve the equation. We’ll apply the integrating factor method, but this time, we’ve simplified the steps specifically for first order linear differential equations.

  • Now that the equation is in standard form, identify the expressions for $P(x)$ and $Q(x)$.
  • Evaluate the expression of the integrating factor, $\mu(x) = e^{\int P(x) \phantom{x}dx}$.
  • Multiply both sides of the equation by the resulting expression for $\mu(x)$.
  • Integrate both sides of the resulting equation – keep in mind that the left-hand side of the equation is always $\dfrac{d}{dx}\left(\mu(x) y\right)$.
  • Simplify the equation and solve for $y$.
  • If the equation is an initial value problem, use the initial value to solve for the arbitrary constant.
  • Since we’re working with $\mu(x) = e^{\int P(x) \phantom{x}dx}$, take note of any possible restrictions for $x$.

To better understand these steps, let us show you how to solve the first order linear differential equation, $xy^{\prime} + 4y = 3x^2 – 2x$. First, rewrite the equation in standard form to identify $P(x)$ and $Q(x)$.

\begin{aligned}xy^{\prime} + 4y &= 3x^2 – 2x\\y^{\prime} + \dfrac{4}{x}y &= 3x – 2\\y^{\prime} + \underbrace{{\color{DarkOrange}\dfrac{4}{x}}}_{\displaystyle{\color{DarkOrange}P(x)}}y &=\underbrace{{\color{Teal}3x – 2}}_{\displaystyle{\color{Teal}Q(x)}}\end{aligned}

This means that the integrating factor is equal to $\mu(x) = e^{\int x/4 \phantom{x}dx}$. Evaluate the integral in the exponent then simplify the expression for $\mu(x)$.

\begin{aligned}\int \dfrac{4}{x} \phantom{x}dx &= 4 \int \dfrac{1}{x} \phantom{x}dx\\&= 4 \ln x\\&=\ln x^4\\\\\mu(x) &= e^{\int 4/x \phantom{x}dx} \\&= e^{\ln x^4}\\&= x^4\end{aligned}

Multiply both sides of the equation by the integrating factor, $\mu(x) = x^4$, then rewrite the equation so that it’s easy for us to integrate both sides of the equation.

\begin{aligned}y^{\prime} + \dfrac{4}{x}y &= 3x – 2\\ {\color{blue}x^4}y^{\prime} + {\color{blue}x^4} \cdot \dfrac{4}{x}y &={\color{blue}x^4}( 3x – 2)\\x^4y^{\prime} + 4x^3 y &= 3x^5 – 2x^4\\\dfrac{d}{dx} (x^4y) &= 3x^5 – 2x^4\end{aligned}

Integrate both sides of the equation then solve for $y$ – make sure to account for the arbitrary constant and how $x^4$ affects it.

\begin{aligned}\int \dfrac{d}{dx} (x^4y) \phantom{x}dx &= \int (3x^5 – 2x^4) \phantom{x}dx\\x^4y &= \dfrac{3x^6}{6} – \dfrac{2x^5}{5} +C\\y&= \dfrac{x^2}{2} – \dfrac{2x}{5} + \dfrac{C}{x^4}\end{aligned}

This means that the general solution to the first order linear equation is equal to $y = \dfrac{x^2}{2} – \dfrac{2x}{5} + \dfrac{C}{x^4}$. Keep in mind that $\mu(x) = e^{\int 4/x \phantom{x}dx}$, our solution will only be valid when $x >0$.

Now, what if our equation has an initial condition where $y(1) = 0$. We’ve learned that this now turns our equation into an initial value problem. For equations with initial values or conditions, we’ll return a particular solution instead. Use $x = 1$ and $y = 0$ to find $C$ and the equation’s particular solution.

\begin{aligned}y(1) &= 0\\0 &= \dfrac{1^2}{2} – \dfrac{2(1)}{5} + \dfrac{C}{1^4}\\C &= \dfrac{2}{5} – \dfrac{1}{2}\\&= -\dfrac{1}{10}\end{aligned}

With an initial condition, $y(1) = 0$, our solution will now have a particular solution of $y = \dfrac{x^2}{2} – \dfrac{2x}{5} – \dfrac{1}{10x^4}$ or $y = \dfrac{x^2}{2} – \dfrac{2x}{5} – \dfrac{1}{10}x^4$.

Apply a similar process when solving other first order linear differential equations and initial value problems involving linear ODEs. We’ve prepared more examples for you to work on, so when you’re ready, head over to the section below!

Example 1

Rewrite the following first order linear differential equations into the standard form. Once done, find the expressions for $P(x)$ and $Q(x)$.

a. $y^{\prime} = 5x – 6y$
b. $\dfrac{2x y^{\prime} }{5y – 2} = 4$
c. $\dfrac{(x + 2) y^{\prime}}{3x – 4y + 6} = 4$

Solution

Knowing the standard form of first order linear differential equations is important if you want to master the process of solving them. Recall that all first order linear differential equations can be rewritten in the form of $y^{\prime} + P(x)y = Q(x)$.

Start with $y^{\prime} = 5x – 6y$ and rewrite the equation in standard form as shown below.

\begin{aligned}y^{\prime} &= 5x – 6y\\y^{\prime} + 6y &= 5x\\y^{\prime} + \underbrace{{\color{DarkOrange}6}}_{\displaystyle{\color{DarkOrange}P(x)}}y &=\underbrace{{\color{Teal}5x}}_{\displaystyle{\color{Teal}Q(x)}}\end{aligned}

This means that for the first expression, $P(x) = 6$ and $Q(x) = 5x$. Apply a similar approach to rewrite the next two equations. Below are the results for the two equations:

\begin{aligned}\dfrac{2x y^{\prime} }{5y – 2} &= 4\\2xy^{\prime} &= 4(5y -2)\\2xy^{\prime} &= 20y – 8\\y^{\prime} &= \dfrac{10}{x}y – \dfrac{4}{x}\\y^{\prime}- \dfrac{10}{x}y&=  – \dfrac{4}{x} \\y^{\prime} + \underbrace{{\color{DarkOrange}- \dfrac{10}{x}}}_{\displaystyle{\color{DarkOrange}P(x)}}y &=\underbrace{{\color{Teal}- \dfrac{4}{x}}}_{\displaystyle{\color{Teal}Q(x)}}\end{aligned}

\begin{aligned}\dfrac{(x + 2) y^{\prime}}{3x – 4y + 6} &= 4\\ (x +2)y^{\prime} &= 4(3x – 4y + 6)\\(x +2)y^{\prime} &= 12x – 16y + 24\\(x +2)y^{\prime} &= – 16y + 12(x + 2)\\y^{\prime} + \dfrac{16}{x+ 2}y &= 12\\y^{\prime} + \underbrace{{\color{DarkOrange}\dfrac{16}{x+ 2}}}_{\displaystyle{\color{DarkOrange}P(x)}}y &=\underbrace{{\color{Teal}12}}_{\displaystyle{\color{Teal}Q(x)}}\end{aligned}

By rewriting the equations in standard form, it will be easier for us to solve first order linear differential equations.

Example 2

Solve the first order linear differential equation, $xy^{\prime} = (1 + x)e^x – y$.

 

Solution

First, rewrite the first order linear differential equation in standard form. The process will be similar to the previous examples. Identify $P(x)$ for $mu(x)$’s expression.

\begin{aligned}xy^{\prime} &= (1 + x)e^x – y\\xy^{\prime} + y &= (1 + x)e^x\\y^{\prime} + \dfrac{1}{x}y &= \dfrac{(1 + x)e^x}{x}\\y^{\prime} + \underbrace{{\color{DarkOrange} \dfrac{1}{x}}}_{\displaystyle{\color{DarkOrange}P(x)}}y &=\underbrace{{\color{Teal}\dfrac{(1 + x)e^x}{x}}}_{\displaystyle{\color{Teal}Q(x)}} \end{aligned}

Use $P(x) = \dfrac{1}{x}$ into the formula for the integrating factor then simplify the expression by evaluating the integral.

\begin{aligned}\mu(x) &= e^{\int P(x) \phantom{x}dx}\\&= e^{\int 1/x \phantom{x}dx}\\&= e^{\ln x}\\&= x\end{aligned}

Now that we have $\mu(x) = x$, multiply both sides of the equation by it then rewrite the resulting equation so that both sides are easy to integrate.

\begin{aligned}{\color{blue} x}y^{\prime} + {\color{blue} x} \cdot\dfrac{1}{x}y &={\color{blue} x} \cdot\dfrac{(1 + x)e^x}{x}\\xy^{\prime} + y &= (1 + x)e^x\\\dfrac{d}{dx}(xy) &= (1 + x)e^x \end{aligned}

Integrate both sides of the equation then isolate $y$ on the left-hand side of the equation.

\begin{aligned}\int\dfrac{d}{dx}(xy)\phantom{x}dx &=\int (1 + x)e^x \phantom{x}dx\\xy &= e^x(1 + x) – \int e^x \phantom{x}dx\\xy &= e^x(1 + x) – e^x + C \\y &= \dfrac{e^x(1 + x)}{x} – \dfrac{e^x}{x} + \dfrac{C}{x} \end{aligned}

This means that the general solution for our equation is equal to $ y = \dfrac{e^x(1 + x)}{x} – \dfrac{e^x}{x} + \dfrac{C}{x}$.

 

 

Example 3

Solve the first order linear differential equation, $y^{\prime} + \dfrac{3y}{x} = \dfrac{6}{x}$, given that it has an initial condition of $y(1) = 8$.

Solution

We apply a similar process to solve our initial value problem. Since the equation is already in standard form, we can identify the expression for $P(x)$ right away.

 \begin{aligned}y^{\prime} + \dfrac{3}{x}y &= \dfrac{6}{x}\\y^{\prime} + \underbrace{{\color{DarkOrange} \dfrac{3}{x}}}_{\displaystyle{\color{DarkOrange}P(x)}}y &=\underbrace{{\color{Teal}\dfrac{6}{x}}}_{\displaystyle{\color{Teal}Q(x)}} \end{aligned}

This means that our integrating factor is equal to $\mu(x) = e^{\int 3/x \phantom{x}dx}$.

\begin{aligned}\mu(x) &= e^{\int 3/x \phantom{x}dx}\\&= e^{3 \int 1/x \phantom{x}dx}\\&= e^{3 \ln x}\\&= x^3 \end{aligned}

Multiply both sides of the equation by the integrating factor, $\mu(x) = x^3$, then integrate both sides of the equation to solve for $y$.

\begin{aligned}{\color{blue}x^3}y^{\prime} + {\color{blue}x^3}\cdot \dfrac{3}{x}y &= {\color{blue}x^3} \cdot\dfrac{6}{x}\\x^3y^{\prime} + 3x^2y &= 6x^2\\\dfrac{d}{dx} (x^3y) &= 6x^2\\\int \dfrac{d}{dx} (x^3y) \phantom{x}dx&= \int 6x^2 \phantom{x}dx\\x^3y &= 2x^3 + C\\y&= 2 + \dfrac{C}{x^3}\end{aligned}

Now that we have the general solution for the differential equation, let’s use the initial condition, \$y(1) = 8\$, to solve for \$C\$.

\begin{aligned}y(1) &= 8\\8 &= 2 + \dfrac{C}{1^3}\\6 &= C\\C &= 6\end{aligned}

Now that we have the value for the constant, $C$, we can now write the particular solution of the equation. This means that the initial value problem has a particular solution of $y = 2 + \dfrac{6}{x^3}$.

Practice Questions

1. Rewrite the following first order linear differential equations into the standard form. Once done, find the expressions for $P(x)$ and $Q(x)$.
a. $y^{\prime} = 8y + 6x$
b. $\dfrac{4x y^{\prime} }{3y – 4} = 2$
c. $\dfrac{(x – 4) y^{\prime}}{5x + 3y – 2} = 1$
2. Solve the first order linear differential equation, $\dfrac{y^{\prime}}{x} = e^{-x^2} – 2y$.
3. Solve the first order linear differential equation, $xy^{\prime} = x^3e^x -2y$, given that it has an initial condition of $y(1) = 0$.

Answer Key

1.
a.
$\begin{aligned}y^{\prime} + \underbrace{{\color{DarkOrange}-8}}_{\displaystyle{\color{DarkOrange}P(x)}}y &=\underbrace{{\color{Teal}6x}}_{\displaystyle{\color{Teal}Q(x)}}\end{aligned}$
b.
$\begin{aligned}y^{\prime} + \underbrace{{\color{DarkOrange}-\dfrac{3}{2}x}}_{\displaystyle{\color{DarkOrange}P(x)}}y &=\underbrace{{\color{Teal}-2x}}_{\displaystyle{\color{Teal}Q(x)}}\end{aligned}$
c.
$\begin{aligned}y^{\prime} + \underbrace{{\color{DarkOrange}-\dfrac{3}{x – 4}}}_{\displaystyle{\color{DarkOrange}P(x)}}y &=\underbrace{{\color{Teal}\dfrac{5x – 2}{x -4}}}_{\displaystyle{\color{Teal}Q(x)}}\end{aligned}$
2. $y = \dfrac{x^2 + C}{e^{x^2}}$
3. $y = e^x \left(x^2 – 4x + 12 – \dfrac{24}{x} + \dfrac{24}{x^2}\right) – \dfrac{9e}{x^2}$