Skip to main content
Mathematics LibreTexts

3.3: Linear Equations

  • Page ID
    90403
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \( \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}}\)

    \( \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}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    \( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

    \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

    \( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vectorC}[1]{\textbf{#1}} \)

    \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

    \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

    \( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)

    View tutorial on YouTube

    The linear first-order differential equation (linear in \(y\) and its derivative) can be written in the form \[\label{eq:1}\frac{dy}{dx}+p(x)y=g(x),\] with the initial condition \(y(x_0) = y_0\). Linear first-order equations can be integrated using an integrating factor \(\mu(x)\). We multiply \(\eqref{eq:1}\) by \(\mu(x)\), \[\label{eq:2}\mu (x)\left[\frac{dy}{dx}+p(x)y\right]=\mu (x)g(x),\] and try to determine \(\mu (x)\) so that \[\label{eq:3}\mu (x)\left[\frac{dy}{dx}+p(x)y\right]=\frac{d}{dx}[\mu (x)y].\]

    clipboard_ea5a04d09886227870a4df02d5d6ae86e.png
    Figure \(\PageIndex{1}\): Solution of the following ODE: \((3+2y)y'=2\cos 2x\), \(y(0)=-1\).

    Equation \(\eqref{eq:2}\) then becomes \[\label{eq:4}\frac{d}{dx}[\mu (x)y]=\mu (x)g(x).\]

    Equation \(\eqref{eq:4}\) is easily integrated using \(\mu (x_0)=\mu_0\) and \(y(x_0)=y_0\):

    \[\mu (x)y-\mu_0 y_0=\int_{x_0}^x\mu (x)g(x)dx,\nonumber\] or \[\label{eq:5}y=\frac{1}{\mu (x)}\left(\mu_0y_0+\int_{x_0}^x\mu(x)g(x)dx\right).\]

    It remains to determine \(\mu(x)\) from \(\eqref{eq:3}\). Differentiating and expanding \(\eqref{eq:3}\) yields \[\mu\frac{dy}{dx}+p\mu y=\frac{d\mu}{dx}y+\mu\frac{dy}{dx};\nonumber\] and upon simplifying, \[\label{eq:6}\frac{d\mu}{dx}=p\mu.\]

    Equation \(\eqref{eq:6}\) is separable and can be integrated:

    \[\begin{aligned}\int_{\mu_0}^{\mu}\frac{d\mu}{\mu}&=\int_{x_0}^xp(x)dx, \\ \ln\frac{\mu}{\mu_0}&=\int_{x_0}^xp(x)dx, \\ \mu(x)&=\mu_0\exp\left(\int_{x_0}^xp(x)dx\right).\end{aligned}\]

    Notice that since \(\mu_0\) cancels out of \(\eqref{eq:5}\), it is customary to assign \(\mu_0 = 1\). The solution to \(\eqref{eq:1}\) satisfying the initial condition \(y(x_0) = y_0\) is then commonly written as \[y=\frac{1}{\mu(x)}\left(y_0+\int_{x_0}^x\mu(x)g(x)dx\right),\nonumber\] with \[\mu(x)=\exp\left(\int_{x_0}^xp(x)dx\right)\nonumber\] the integrating factor. This important result finds frequent use in applied mathematics.

    Example \(\PageIndex{1}\)

    Solve \(\frac{dy}{dx}+2y=e^{-x}\), with \(y(0)=3/4\).

    Solution

    Note that this equation is not separable. With \(p(x) = 2\) and \(g(x) = e^{−x}\), we have \[\begin{aligned}\mu(x)&=\exp\left(\int_0^x 2dx\right) \\ &=e^{2x},\end{aligned}\] and \[\begin{aligned}y&=e^{-2x}\left(\frac{3}{4}+\int_0^x e^{2x}e^{-x}dx\right) \\ &=e^{-2x}\left(\frac{3}{4}+\int_0^x e^xdx\right) \\ &=e^{-2x}\left(\frac{3}{4}+(e^x-1)\right) \\ &=e^{-2x}\left(e^x-\frac{1}{4}\right) \\ &=e^{-x}\left(1-\frac{1}{4}e^{-x}\right).\end{aligned}\]

    Example \(\PageIndex{2}\)

    Solve \(\frac{dy}{dx}-2xy=x\), with \(y(0)=0\).

    Solution

    This equation is separable, and we solve it in two ways. First, using an integrating factor with \(p(x) = −2x\) and \(g(x) = x\):

    \[\begin{aligned}\mu(x)&=\exp\left(-2\int_0^x xdx\right) \\ &=e^{-x^2},\end{aligned}\] and \[y=e^{x^2}\int_0^x xe^{-x^2}dx.\nonumber\]

    The integral can be done by substitution with \(u = x^2\), \(du = 2xdx\):

    \[\begin{aligned}\int_0^x xe^{-x^2}dx&=\frac{1}{2}\int_0^{x^2}e^{-u}du \\ &=-\frac{1}{2}e^{-u}]_0^{x^2}\\ &=\frac{1}{2}\left(1-e^{-x^2}\right).\end{aligned}\]

    Therefore, \[\begin{aligned}y&=\frac{1}{2}e^{x^2}\left(1-e^{-x^2}\right) \\ &=\frac{1}{2}\left(e^{x^2}-1\right).\end{aligned}\]

    Second, we integrate by separating variables:

    \[\begin{aligned}\frac{dy}{dx}-2xy&=x, \\ \frac{dy}{dx}&=x(1+2y), \\ \int_0^y\frac{dy}{1+2y}&=\int_0^x xdx, \\ \frac{1}{2}\ln (1+2y)&=\frac{1}{2}x^2, \\ 1+2y&=e^{x^2}, \\ y&=\frac{1}{2}\left(e^{x^2}-1\right).\end{aligned}\]

    The results from the two different solution methods are the same, and the choice of method is a personal preference.


    This page titled 3.3: Linear Equations is shared under a CC BY 3.0 license and was authored, remixed, and/or curated by Jeffrey R. Chasnov via source content that was edited to the style and standards of the LibreTexts platform.