Skip to main content
\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)
Mathematics LibreTexts

2.6: First Order Linear Differential Equations

In this section we will concentrate on first order linear differential equations. Recall that this means that only a first derivative appears in the differential equation and that the equation is linear. The general first order linear differential equation has the form 

\[    y' + p(x)y  =  g(x) \]

Before we come up with the general solution we will work out the specific example

\[    y' + \frac{2}{x y}  =  \ln \, x \]

The strategy for solving this is to realize that the left hand side looks a little like the product rule for differentiation. The product rule is

\[  (my)'  =  my' + m'y \]

This leads us to multiplying both sides of the equation by m which is called an integrating factor.

\[       m y' + m \frac{2}{x y}  = m \ln\, x \]

We now search for a \(m\) with 

\[      m'  =  m \frac{2}{x}  \]

or

\[    \frac{dm}{m}  =  \frac{2}{x} \; dx  \]

Integrating both sides, produces

\[    \ln\, m  =  2\ln\, x  =  \ln(x^2)  \]

or \( m  =  x^2 \) by exponentiating both sides.

Going back to the original differential equation and multiplying both sides by \( x^2 \), we get

\[    x^2y' + 2xy  =  x^2 \ln\, x  \]

Using the product rule in reverse gives

\[    (x^2y)'  =  x^2 \ln \, x  \]

Now integrate both sides. Note that the integral of the derivative is the original. Integrate by parts to get

\[ \int x^2 \, \ln \, x \, dx \]

  • \(u  =  \ln x\)  and \(dv  =  x^2 \,dx\)
  • \(du  = \dfrac{1}{x} dx \)  and  \( v  =  \dfrac{1}{3} x^3\)

\[ = \dfrac{x^3 \ln\, x}{3} - \int \dfrac{x^2}{3} \, dx = \dfrac{x^3 \ln \, x}{3} - \dfrac{x^3}{9} +C \]

 Hence

\[   x^2y  =  \frac{1}{3} x^3 \ln x  -  \frac{1}{9}  x^3  + C \]

Divide by \(x^2\)

\[ y  =  \dfrac{1}{3} x \ln \, x  -  \dfrac{1}{9}  x  + \dfrac{C}{x^2}   \]

Notice that when \(C\) is nonzero, the solutions are undefined at \(x = 0\). Also given an initial value with \(x\) positive, there will be no solution for negative \(x\). Now we will derive the general solution to first order linear differential equations. 

Example 1

Consider

\[   y' + p(t)y  =  g(t) \]

We multiply both sides by \(m\) to get

\[   my' + mp(x)y  =  mg(x) \]

We now search for an \(m\) with

\[    m'  =  mp(x) \]

or

\[    \dfrac{dm}{m}  =  p(x) \, dx  \]

Integrating both sides, produces

\[   \text{ln} \, m  = \int p(x)\, dx \]

exponentiating both sides

\[  m  = e^{\int p(x)\, dx} \]

Going back to the original differential equation and multiplying both sides by \(m\), we get

\[ my' + mp(x)y  =  mg(x) \]

\[ (my)'  =  mg(x)  \]

\[  my  = \int \mu \, g(x) \, dx \]

Solving for \(y\) gives

\[ y = e^{-\int p(x)\, dx}\int g(x) e^{\int p(x) \, dx } \, dx \]

Contributors