Multivariate Calculus
&
Ordinary Differential Equations

Lecture 8



1 Ordinary Differential Equations

1.6 Solving Linear First Order Equations


If you cannot solve a differential equation by separation, your next plan of attack should be to test if it is linear and use the integration factor method described below.





1 Ordinary Differential Equations

1.6.1 Definition

A first-order ODE is linear if it can be put in the form

$\ds \dif{y}{t}+p(t)y=q(t) $

for some functions $p(t)$ and $q(t)$.





1 Ordinary Differential Equations

1.6.1 Definition

$\ds \dif{y}{t}+p(t)y=q(t) $

Example: Which of the following are linear?

  • $y'=x$
  • $y'=\log x$
  • $y'=y^2$
  • $y'=y$
  • $y'y = 1$
  • $y' = y+3\sin x$
  • $y' = t^5 - t^2y$
  • $y' = \sin y + e^x$
  • $(y')^2 = y$


1 Ordinary Differential Equations

1.6.1 Definition

Recall the product rule for differentiation (written here in reverse order): \[ f\,\dif{g}{t} + \dif{f}{t}\,g= \dif{}{t}(f\, g ). \] This formula is key to solving first-order linear ODEs.

Example: Solve $\;\displaystyle \dif{y}{t} + \Bigl(\dfrac{2t}{t^2+1}\Bigr)y = t^2+1.$



1 Ordinary Differential Equations

1.6.1 Definition

Example: Solve $\;\displaystyle \dif{y}{t} + \Bigl(\dfrac{2t}{t^2+1}\Bigr)y = t^2+1.$

Multiplying both sides by $t^2+1$ gives

$\ds \left(t^2+1\right)\frac{dy}{dt} + (2t)y = \left(t^2+1\right)^2$

Since $\ds \frac{d}{dt}\left(t^2+1\right)=2t,$ using the product rule,

$\ds \frac{d}{dt}\left(\left(t^2+1\right)y\right)$ $\ds =\left(t^2+1\right)y' + (2t) y$ $\ds =\text{LHS}.$



1 Ordinary Differential Equations

1.6.1 Definition

Example: Solve $\;\displaystyle \dif{y}{t} + \Bigl(\dfrac{2t}{t^2+1}\Bigr)y = t^2+1.$

So the ODE

$\ds \left(t^2+1\right)\frac{dy}{dt} + (2t)y = \left(t^2+1\right)^2$

can be written as

$\ds \frac{d}{dt}\left(\left(t^2+1\right)y\right) = \left(t^2+1\right)^2$

$\Ra \,\ds \frac{d}{dt}\left(\left(t^2+1\right)y\right) =t^4+2t^2+1$




1 Ordinary Differential Equations

1.6.1 Definition

Example: Solve $\;\displaystyle \dif{y}{t} + \Bigl(\dfrac{2t}{t^2+1}\Bigr)y = t^2+1.$

$\quad \quad\Ra \,\ds \frac{d}{dt}\left(\left(t^2+1\right)y\right) =t^4+2t^2+1$

$\quad \quad\Ra \ds \left(t^2+1\right)y = \int\left(t^4+ 2t^2+1\right)dt+C$

$\quad \quad\Ra \ds \left(t^2+1\right) y = \frac{t^5}{5}+\frac{2}{3}t^3+ t+C$

$\quad \quad\Ra \ds y =\frac{1}{\left(t^2+1\right)} \left( \frac{t^5}{5}+\frac{2}{3}t^3+ t+C\right). % \frac{t^5}{5\left(t^2+1\right)}+\dfrac{2t^3}{3\left(t^2+1\right)}+ \frac{t}{\left(t^2+1\right)}+\frac{C}{\left(t^2+1\right)}.\;$ 😃



1 Ordinary Differential Equations

1.6.1 Definition

The lucky thing (it wasn't luck really) about the previous example was that after multiplication by $t^2+1,$ the equation exactly matched the product rule. This raises the following natural question.

Question: Can we always multiply a first-order linear ODE by some function $I(t),$ so that its left-hand side matches the left-hand side of the product rule?

This question can be answered in the affirmative and any function $I(t)$ that does the trick is known as an integrating factor.


1 Ordinary Differential Equations

1.6.1 Definition

Given the ODE

$\ds \dif{y}{t}+p(t)y=q(t) $

we multiply by the yet-to-be-found integrating factor $I(t)$:

$\ds I(t)\dif{y}{t} + I(t)p(t)y = I(t)q(t). \qquad (*) $

We think of $I$ as $g$ and $y$ as $f.$ Then the first term on the left is $f' g$ and consequently we want the second term on the left to be $f g'=y I'.$ Given that this second term is in fact $\,I p y,\,$ we infer that $I$ must satisfy the ODE

$\ds I'(t)=I(t) p(t).$


1 Ordinary Differential Equations

1.6.1 Definition

We think of $I$ as $g$ and $y$ as $f.$ Then the first term on the left is $f' g$ and consequently we want the second term on the left to be $f g'=y I'.$ Given that this second term is in fact $\,I p y,\,$ we infer that $I$ must satisfy the ODE

$\ds I'(t)=I(t) p(t).$

This is good news since this is a separable ODE which we already know how to solve:

$\ds I(t)=\exp\left(\int p(t)\, \dup t\right). $





1 Ordinary Differential Equations

1.6.1 Definition

$\ds I(t)=\exp\left(\int p(t)\, \dup t\right). $

Important remark: Any integrating factor will do. Hence when you try to solve $I'=I p,$ i.e., when you try to compute the above integral (assuming you can explicitly do so), you do not need to worry about keeping track of constants. For example, if $p(t)=2t,$

$\ds I(t)=\exp\Bigl(2\int t\dup t\Bigr)$ $\ds = e^{t^2+C}$ $\ds =e^C e^{t^2}$ $\ds =B e^{t^2},$

where $B=\exp(C)\neq 0.$




1 Ordinary Differential Equations

1.6.1 Definition

When you substitute $I(t) = B e^{t^2}$ in

$\ds I(t)\dif{y}{t} + I(t)p(t)y = I(t)q(t)$

the constant $B$ would simply be an overall factor which may thus be divided out. It is therefore perfectly okay to write on your assignment:

Because constants of integration do not matter,

$\ds I(t)=\exp\Bigl(2\int t\dup t\Bigr)$ $\ds =e^{t^2}.$



1 Ordinary Differential Equations

1.6.1 Definition

To confuse your tutor, you might even write:

Because constants of integration do not matter,

$\ds I(t)=\exp\Bigl(2\int t\dup t\Bigr)=e^{t^2+65\pi^{123}}.$





1 Ordinary Differential Equations

Summary

To solve a first-order linear ODE:

  1. Write the equation in the form $\ds\dif{y}{t}+py=q$.
  2. Find an integrating factor $\ds I = \exp\left(\int p \dup t\right).$
  3. Multiply the ODE by $I$ and apply the product rule to get $\ds \dif{}{t}(Iy) = Iq.$
  4. Integrate both sides with respect to $t.$ (This time, don't forget about constants of integration!).



1 Ordinary Differential Equations

1.6.1 Definition



Example: Solve the ODE $\ds\;\dif{y}{t}=y+t.$







1 Ordinary Differential Equations

Example: Solve the ODE $\ds\;\dif{y}{t}=y+t.$

1. ODE is 1st order linear: $y'-y= t,$ $\,p(t) = -1.$

2. $\ds I(t) = \exp\left(\int p(t) \ dt\right)$ $\ds= e^{-t}.$

3. $\ds e^{-t}y' -e^{-t}y = e^{-t}t.$

3. $\ds \text{LHS} = \frac{d}{dt} \left(e^{-t}y\right) $ $\ds = e^{-t}t.$

4. $\ds e^{-t} y = \int e^{-t} t ~dt +C\,$ $\Ra \,\ds e^{-t} y = -t e^{-t} - e^{-t} +C.$

So the general solution is $\,\ds y = -t -1 +Ce^t.$




1 Ordinary Differential Equations

1.6.1 Definition

Example: Solve the IVP $\;\ds x^2\dif{y}{x}+xy=1,\;y(1)=2.$

📝 Left as an exercise! 😃

Example: Solve the ODE $\, \displaystyle \dif{y}{x} -x^2 y = x^2.$

📝 Left as an exercise! 😃



Credits