Holt.Blue
Back To Class Notes Menu
First-Order Linear Differential Equations

Today we begin to solve differential equations which may not separable.

In particular, we will solve first-order linear equations.

































First-Order Linear Differential Equations

A first-order differential equation is linear if it can be written in the form $$a(x)y' + b(x)y = c(x),$$ where $a(x),$ $b(x),$ and $c(x)$ are arbitrary functions of $x.$































First-Order Linear Differential Equations: Standard Form

In order to solve $a(x)y' + b(x)y = c(x),$ we will first divide both sides by $a(x)$ into the form where $\displaystyle y' + \frac{b(x)}{a(x)}y = \frac{c(x)}{a(x)},$ which we will simply write as $$y'+p(x)y=q(x).$$ This form is called standard form.































Solving $y' + p(x)y = q(x)$: Integrating Factors

To solve the above equation we will multiply both sides by a function $\mu(x)$ which will do something special...

$\mu(x)$ is called an integrating factor.

First we multiply through by a function $\mu(x)$ $$ \mu(x)y' + \mu(x)p(x)y = \mu(x)q(x) $$ in order to get $$ (\mu(x)y)'=\mu(x)q(x). $$ Then, for the above two equations to be equivalent, it would have to be that $$ \mu(x)y' + \mu(x)p(x)y=\mu(x)q(x)=(\mu(x)y)' $$ By the Product Rule, it follows that $$ \mu(x)y' + \mu(x)p(x)y=\mu'(x)y+\mu(x)y' $$ Cancelling the outer terms, $$ \mu(x)p(x)y=\mu'(x)y $$ Dividing out $y,$ $$ \mu(x)p(x)=\mu'(x) $$ Rewriting the above in differential form, $$ \frac{d\mu}{dx}=p(x)\mu $$ we see that we may separate variables and solve $$ \begin{array}{lll} &\displaystyle \frac{d\mu}{\mu}&=p(x)\,dx\\ \implies &\displaystyle \int \frac{d\mu}{\mu}&=\displaystyle \int p(x)\,dx +C\\ \implies &\displaystyle \ln|\mu|&=\displaystyle \int p(x)\,dx+C\\ \implies &\displaystyle |\mu|&=\displaystyle e^{\int p(x)\,dx+C}\\ \implies &\displaystyle |\mu|&=\displaystyle e^{\int p(x)\,dx} e^{C}\\ \implies &\displaystyle \mu&=\displaystyle \pm e^{C} e^{\int p(x)\,dx} \\ \implies &\displaystyle \mu&=\displaystyle Ce^{\int p(x)\,dx} \\ \end{array} $$ Since any $C$ will work, simply choose $C=1$ so that $$ \mu=e^{\int p(x)\,dx} $$


































Solving $y' + p(x)y = q(x)$: Integrating Factors

Thus, our integrating factor that turns the left-hand side into the derivative of a product is $$\mu(x)=e^{\int p(x) \, dx}$$

































Example

Solve the first-order linear equation. Assume $x \gt 0.$

$xy'=3y+x^2$

Rewriting the equation in standard form, $$ y'-\frac{3}{x}y=x, $$ our integrating factor is $$e^{\int -\frac{3}{x} \,dx}=e^{-3\ln x}=e^{\ln x^{-3}}=x^{-3}=\frac{1}{x^3}.$$

Continuing on, we multiply through by the integrating factor. $$ \frac{1}{x^3}y'-\frac{3}{x^4}y=\frac{1}{x^2} $$ Then, by the Product Rule, $$ \left(\frac{1}{x^3}y\right)'=\frac{1}{x^2} $$ We then have $$ \begin{array}{ll} & \displaystyle \frac{1}{x^3}y=\int \frac{1}{x^2} \,dx\\ \implies & \displaystyle \frac{1}{x^3}y=-\frac{1}{x}+C\\ \implies & \displaystyle y=-x^2+Cx^3\\ \end{array} $$ Checking our work with the original equation, $$ \begin{array}{l|l} \mbox{Left Hand Side} & \mbox{Right Hand Side}\\ xy' & 3y+x^2\\ =x(-x^2+Cx^3)' & =3(-x^2+Cx^3)+x^2\\ =x(-2x+3Cx^2) & =-3x^2+3Cx^3+x^2\\ =-2x^2+3Cx^3 \checkmark & =-2x^2+3Cx^3 \checkmark\\ \end{array} $$




































Process

1.Put the equation into standard form and identify $p(x)$ and $q(x).$

2.Calculate the integrating factor $\mu(x)=e^{\int p(x) \, dx}$.

3.Multiply both sides of the differential equation by $\mu(x).$

4.Write the left-hand side as a derivative of a product of $\mu(x)$ and $y$ ("reverse" product rule).

5.Integrate both sides of the equation obtained in step 4, and divide both sides by $\mu(x).$

6.If there is an initial condition, determine the value of $C.$



































Example

Solve the initial value problem.

$(1+x^2)y'=y-1,$ $y(0) = 0$

We first find the general solution. Getting the equation into standard form, $$ \begin{array}{lrll} &\displaystyle (1+x^2)y' &=\displaystyle y-1&\mbox{}\\ \implies &\displaystyle y' &=\displaystyle \frac{1}{x^2+1}y-\frac{1}{x^2+1} &\mbox{}\\ \implies &\displaystyle y' -\frac{1}{x^2+1}y&=\displaystyle -\frac{1}{x^2+1} &\mbox{}\\ \end{array} $$ Our integrating factor is then $$ e^{\int -\frac{1}{x^2+1}\,dx}=e^{-\tan^{-1} x} $$ Thus, $$ \begin{array}{lrll} &\displaystyle e^{-\tan^{-1} x} y' -e^{-\tan^{-1} x}\frac{1}{x^2+1} y&=\displaystyle -e^{-\tan^{-1} x}\frac{1}{x^2+1} &\mbox{}\\ \implies &\displaystyle \left(e^{-\tan^{-1} x} y\right)'&=\displaystyle -e^{-\tan^{-1} x}\frac{1}{x^2+1} &\mbox{ using the Product Rule}\\ \implies &\displaystyle e^{-\tan^{-1} x} y&=\displaystyle \int -e^{-\tan^{-1} x}\frac{1}{x^2+1} \,dx&\mbox{}\\ \implies &\displaystyle e^{-\tan^{-1} x} y&=\displaystyle e^{-\tan^{-1} x}+C&\mbox{using the substitution $u=-\tan^{-1} x$}\\ \implies &\displaystyle y&=\displaystyle 1+Ce^{\tan^{-1}x}&\mbox{multiplying both sides by $e^{\tan^{-1} x}$}\\ \end{array} $$ Checking our general solution with the original equation, $$ \begin{array}{l|l} \mbox{Left Hand Side} & \mbox{Right Hand Side}\\ (1+x^2)y' & y-1\\ =\displaystyle (1+x^2)(1+Ce^{\tan^{-1}x})'& =\displaystyle 1+Ce^{\tan^{-1}x}-1\\ =\displaystyle (1+x^2)(Ce^{\tan^{-1}x}\frac{1}{x^2+1}& =\displaystyle 1+Ce^{\tan^{-1}x}-1\\ =\displaystyle Ce^{\tan^{-1}x} \checkmark & =\displaystyle Ce^{\tan^{-1}x}\checkmark\\ \end{array} $$ We now satisfy the initial condition, $y(0)=0.$ $$ \begin{array}{llll} &\displaystyle y(0)&=0\displaystyle &\mbox{}\\ \implies &\displaystyle 1+Ce^{\tan^{-1}0} &=\displaystyle 0&\mbox{}\\ \implies &\displaystyle 1+C &=\displaystyle 0&\mbox{}\\ \implies &\displaystyle C &=\displaystyle -1&\mbox{}\\ \end{array} $$ Thus, $y=1-e^{\tan^{-1}x}$ is a particular solution which satisfies the initial condition.




































Example: Terminal Velocity

The weight of a penny is $2.5$ grams, and the upper observation deck of the Empire State Building is $369$ meters above the street. Since the penny is a small and relatively smooth object, air resistance acting on the penny is actually quite small. We assume the air resistance is numerically equal to $0.0025v.$ Furthermore, the penny is dropped with no initial velocity imparted to it.

a. Set up an initial-value problem that represents the falling penny using the model for a free-falling object with air resistance. $\displaystyle m\frac{dv}{dt}=-kv-mg.$

The problem gives $k=0.0025,$ and the mass of the penny in kilograms is $m=0.0025$ grams. Taking $g=9.8 \mbox{ m/s}^2,$ we have $$ 0.0025\frac{dv}{dt}=-0.0025v-0.0025\cdot 9.8 $$ which becomes $$ \frac{dv}{dt}=-v-9.8 $$ Also, since the penny is dropped with no initial velocity, $v(0)=0.$ Thus, our initial value problem is $$ \frac{dv}{dt}=-v-9.8\\ v(0)=0 $$


b. Solve the problem for $v(t).$

Getting the the equation into standard form, $$ v'+v=-9.8 $$ The integrating factor is $e^{\int 1 \,dt}=e^t.$ Then, $$ \begin{array}{ll} & e^t v'+e^t v=-9.8e^t\\ \implies & (e^t v)'=-9.8e^t\\ \implies & \displaystyle e^t v=-9.8\int e^t \,dt\\ \implies & e^t v=-9.8e^t+C\\ \implies & v=-9.8+Ce^{-t}\\ \end{array} $$ Satisfying the initial condition, $$ \begin{array}{ll} & v(0)=0\\ \implies & -9.8+Ce^{-0}=0\\ \implies & -9.8+C=0\\ \implies & C=9.8\\ \end{array} $$ Our solution is then $$ v(t)=-9.8+9.8e^{-t} $$


c. What is the terminal velocity of the penny? (Hint: calculate the limit of the velocity as $t\rightarrow \infty.$)

The terminal velocity is the limit of $v(t)$ as $t\rightarrow \infty.$ $$ \begin{array}{lll} \displaystyle \lim_{t\rightarrow \infty} v(t) &=\displaystyle \lim_{t\rightarrow \infty} -9.8+9.8e^{-t}&\mbox{}\\ &=-9.8&\mbox{}\\ \end{array} $$ Thus, the terminal velocity of the penny is $-9.8$ meters per second, which is about $-21.9$ miles per hour.
































STOP TAKING NOTES NOW!!!


































Bonus Example

Solve the equation $y'-2xy=1$ using power series.

To solve this equation, we will express out unknown solution as an infinite series $\displaystyle \sum_{n=0}^{\infty}c_n x^n.$ Then, $$ \begin{array}{lll} &\displaystyle y'-2xy=1 &\mbox{}\\ \implies &\displaystyle \left(\sum_{n=0}^{\infty}c_n x^n\right)'-2x\sum_{n=0}^{\infty}c_n x^n=1&\mbox{}\\ \implies &\displaystyle \sum_{n=1}^{\infty}c_n n x^{n-1}-2x\sum_{n=0}^{\infty}c_n x^n=1&\mbox{differentiating term by term}\\ \implies &\displaystyle c_1+\sum_{n=2}^{\infty}c_n n x^{n-1}-\sum_{n=0}^{\infty}2 c_n x^{n+1}=1&\mbox{peeling off the first term of the first series}\\ \implies &\displaystyle c_1+\sum_{n=1}^{\infty}c_{n+1} (n+1) x^{n}-\sum_{n=1}^{\infty}2 c_{n-1} x^{n}=1&\mbox{re-indexing both sums}\\ \implies &\displaystyle c_1+\sum_{n=1}^{\infty}\left[c_{n+1} (n+1) x^{n}-2 c_{n-1}\right] x^{n}=1&\mbox{using properties of series}\\ \implies &\displaystyle (c_1-1)+\sum_{n=1}^{\infty}\left((n+1)c_{n+1} -2 c_{n-1}\right) x^{n}=0&\mbox{}\\ \end{array} $$ The only way the above series can be zero for all $x$ is if $c_1-1=0$ and $(n+1)c_{n+1} (n+1)-2 c_{n-1}=0$ for all $n \geq 1.$

From these equations, we may determine the coefficients $c_1, c_2, c_3, \ldots$

From the first equation, we know that $c_1=1.$

For the second equation which is a recurrence relation, we rewrite it as $nc_{n} -2 c_{n-2}=0$ for all $n\geq 2,$ which more conveniently becomes $$ c_{n} =\frac{2}{n}c_{n-2} \mbox{ for all } n\geq 2 $$ Then, $$ \begin{array}{lll} \displaystyle c_0 & &\mbox{an unknown constant}\\ c_1 &=\displaystyle 1&\mbox{}\\ c_2 &=\displaystyle \frac{2}{2}c_{0}=c_0&\mbox{}\\ c_3 &=\displaystyle \frac{2}{3}c_{1}=\frac{2}{3}&\mbox{}\\ c_4 &=\displaystyle \frac{2}{4} c_{2}=\frac{1}{2}c_2=\frac{1}{2}c_0&\mbox{}\\ c_5 &=\displaystyle \frac{2}{5} c_{3}=\frac{2}{5}\cdot \frac{2}{3}&\mbox{}\\ c_6 &=\displaystyle \frac{2}{6} c_{4}=\frac{1}{3}\cdot \frac{1}{2}c_0&\mbox{}\\ c_7 &=\displaystyle \frac{2}{7} c_{5}=\frac{2}{7}\cdot \frac{2}{5}\cdot \frac{2}{3}&\mbox{}\\ c_8 &=\displaystyle \frac{2}{8} c_{6}=\frac{1}{4}\cdot \frac{1}{3}\cdot \frac{1}{2}c_0&\mbox{}\\ c_9 &=\displaystyle \frac{2}{9} c_{7}=\frac{2}{9}\cdot \frac{2}{7}\cdot \frac{2}{5}\cdot \frac{2}{3}&\mbox{}\\ c_{10} &=\displaystyle \frac{2}{10} c_{8}=\frac{1}{5}\cdot \frac{1}{4}\cdot \frac{1}{3}\cdot \frac{1}{2}c_0&\mbox{}\\ &\vdots& \end{array} $$ From the above we can see the pattern: $$ c_{2n+1}= \frac{2}{(2n+1)}\cdots \frac{2}{9}\cdot \frac{2}{7}\cdot \frac{2}{5}\cdot \frac{2}{3}=\frac{2^{n}}{3\cdot 5 \cdot 7 \cdots (2n+1)} $$ and $$ c_{2n}=\frac{1}{n}\cdots \frac{1}{5}\cdot \frac{1}{4}\cdot \frac{1}{3}\cdot \frac{1}{2}c_0=\frac{1}{n!}c_0 $$ Our solution is then $$ \begin{array}{ll} y&=\displaystyle \sum_{n=0}^{\infty}c_n x^n\\ &=\displaystyle \sum_{n=0}^{\infty}c_{2n}x^{2n}+\sum_{n=0}^{\infty}c_{2n+1}x^{2n+1}\\ &=\displaystyle \sum_{n=0}^{\infty} \frac{1}{n!}c_0 x^{2n}+\sum_{n=0}^{\infty}\frac{2^{n}}{3\cdot 5 \cdot 7 \cdots (2n+1)}x^{2n+1}\\ &=\displaystyle c_0\sum_{n=0}^{\infty} \frac{1}{n!} x^{2n}+\sum_{n=0}^{\infty}\frac{2^{n}}{3\cdot 5 \cdot 7 \cdots (2n+1)}x^{2n+1}\\ \end{array} $$ We note that $c_0$ is the constant of our general solution. We also recognize the series $\displaystyle \sum_{n=0}^{\infty} \frac{1}{n!} x^{2n}$ as none other than $e^{x^2}.$ Thus, $$ y=c_0e^{x^2}+\sum_{n=0}^{\infty}\frac{2^{n}}{3\cdot 5 \cdot 7 \cdots (2n+1)}x^{2n+1} $$