Calculus – First-order differential equations – Linear differential equations
Definition: A first-order differential equation is called linear if it can be written in the form:
\[\frac{dy}{dx}+P(x)y=Q(x),\]where \(P\) and \(Q\) are continuous functions on any interval.
We consider two methods to solve these kind of differential equations: using an integrating factor and the method of variation of the parameter.
Using an integrating factor:
If we multiply the differential equation (in standard form) by a factor \(I(x)\neq0\), then the solutions remain the same. We try to find such a factor \(I(x)\) such that
\[I(x)y'(x)+I(x)P(x)y(x)=I(x)Q(x)\]implies that
\[\frac{d}{dx}\left(I(x)y(x)\right)=I(x)Q(x).\]Then we must have that: \(I'(x)=I(x)P(x)\). Such a factor \(I(x)\) is called an integrating factor because then we can integrate:
\[I(x)y(x)=\int I(x)Q(x)\,dx.\]And because \(I(x)\neq0\) this leads to the solution: \(y(x)=\displaystyle\frac{1}{I(x)}\int I(x)Q(x)\,dx\).
In order to find such an integrating factor \(I(x)\neq0\) we have to solve the differential equation
\[I'(x)=I(x)P(x).\]However, this is a separable differential equation. Note that \(I(x)=\exp\left(\displaystyle\int P(x)\,dx\right)\) is a solution, where \(\displaystyle\int P(x)\,dx\) denotes any antiderivative of \(P(x)\).
This leads to the following "recipe":
- Write the differential equation in the standard form \(\displaystyle\frac{dy}{dx}+P(x)y=Q(x)\).
- Find an (arbitrary) integrating factor \(I(x)\neq0\) such that \(I'(x)=I(x)P(x)\).
- Multiply the differential equation in standard form by \(I(x)\):\[\underbrace{I(x)y'(x)+I(x)P(x)y(x)}_{\displaystyle\left(I(x)y(x)\right)'}=I(x)Q(x).\]
- Integrate both sides of this equation: \(I(x)y(x)=\displaystyle\int I(x)Q(x)\,dx\).
- Divide by \(I(x)\neq0\): \(y(x)=\displaystyle\frac{1}{I(x)}\int I(x)Q(x)\,dx\).
Examples:
1) \(y'+2y=3\) has \(I(x)=e^{2x}\neq0\) as an integrating factor (since: \(I'(x)=2I(x)\)). Hence: \((e^{2x}y(x))'=3e^{2x}\). This implies that \(e^{2x}y(x)=\displaystyle\int 3e^{2x}\,dx=\tfrac{3}{2}e^{2x}+C\) with \(C\) an arbitrary (integration) constant. Hence: \(y(x)=\frac{3}{2}+Ce^{-2x}\) with \(C\in\mathbb{R}\).
2) \(y'-2xy=4x\) has \(I(x)=e^{-x^2}\neq0\) as an integrating factor (since: \(I'(x)=-2xI(x)\)). Hence: \((e^{-x^2}y(x))'=4xe^{-x^2}\). This implies that \(e^{-x^2}y(x)=\displaystyle\int 4xe^{-x^2}\,dx=-2e^{-x^2}+C\) with \(C\) an arbitrary (integration) constant. Dus: \(y(x)=-2+Ce^{x^2}\) with \(C\in\mathbb{R}\).
3) The differential equation \(xy'+y=1\) with \(x>0\) is not in standard form. So first write it as \(y'+\displaystyle\frac{1}{x}y=\frac{1}{x}\) and then note that \(I(x)=e^{\ln(x)}=x>0\) is an integrating factor (since: \(I'(x)=\displaystyle\frac{1}{x}I(x)\)). Then we have: \((xy(x))'=1\) and therefore \(xy(x)=x+C\) with \(C\) an arbitrary (integration) constant. Hence: \(y(x)=\displaystyle\frac{x+C}{x}=1+\frac{C}{x}\) with \(C\in\mathbb{R}\).
We might also use variation of the parameter:
First consider the corresponding homogeneous differential equation (also in standard form with \(Q(x)\) replaced by \(0\)):
\[\frac{dy}{dx}+P(x)y=0.\]This differential equation is separable, since for \(y\neq0\) it can be written in the form
\[\frac{dy}{y}=-P(x)\,dx\quad\Longrightarrow\quad\ln|y(x)|=-\int P(x)\,dx.\]This leads to a general solution of the form \(y(x)=C\exp\left(-\displaystyle\int P(x)\,dx\right)\) with \(C\) an arbitrary (integration) constant.
Now we replace this constant by a function of \(x\), say \(u(x)\), then substitution into the nonhomogeneous differential equation implies:
\begin{align*} &u'(x)\exp\left(-\int P(x)\,dx\right)-P(x)u(x)\exp\left(-\int P(x)\,dx\right)+P(x)u(x)\exp\left(-\int P(x)\,dx\right)=Q(x)\\[2.5mm] &{}\hspace{25mm}\Longleftrightarrow\quad u'(x)=Q(x)\exp\left(\int P(x)\,dx\right). \end{align*}Integration then leads to \(u(x)\) including an arbitrary (integration) constant. Substitution into \(y(x)=u(x)\left(-\displaystyle\int P(x)\,dx\right)\) then gives the general solution.
Examples:
1) For \(y'+2y=3\) we first consider \(y'+2y=0\) with general solution \(y(x)=Ce^{-2x}\). Now substitute \(y(x)=u(x)e^{-2x}\):
\[u'(x)e^{-2x}-2u(x)e^{-2x}+2u(x)e^{-2x}=3\quad\Longrightarrow\quad u'(x)=3e^{2x}\quad\Longrightarrow\quad u(x)=\tfrac{3}{2}e^{2x}+C.\] So the general solution is: \(y(x)=u(x)e^{-2x}=\frac{3}{2}+Ce^{-2x}\) with \(C\in\mathbb{R}\).2) For \(y'-2xy=4x\) we first consider \(y'-2xy=0\) with general solution \(y(x)=Ce^{x^2}\). Now substitute \(y(x)=u(x)e^{x^2}\): \[u'(x)e^{x^2}+2xu(x)e^{x^2}-2xu(x)e^{x^2}=4x\quad\Longrightarrow\quad u'(x)=4xe^{-x^2}\quad\Longrightarrow\quad u(x)=-2e^{-x^2}.\] So the general solution is: \(y(x)=u(x)e^{x^2}=-2+Ce^{x^2}\) with \(C\in\mathbb{R}\).
3) First write the differential equation \(xy'+y=1\) with \(x>0\) in the standard form: \(y'+\displaystyle\frac{1}{x}y=\frac{1}{x}\). Then consider \(y'+\displaystyle\frac{1}{x}y=0\) with general solution \(y(x)=\displaystyle\frac{C}{x}\). Now substitute \(y(x)=\displaystyle\frac{u(x)}{x}\):
\[\frac{u'(x)}{x}-\frac{u(x)}{x^2}+\frac{u(x)}{x^2}=\frac{1}{x}\quad\Longrightarrow\quad u'(x)=1\quad\Longrightarrow\quad u(x)=x+C.\] So the general solution is: \(y(x)=\displaystyle\frac{u(x)}{x}=\frac{x+C}{x}=1+\frac{C}{x}\) with \(C\in\mathbb{R}\).Last modified on March 8, 2021