Workshop 10
Consider the ODE $\dfrac{dy}{dx}+ a y = f(x),$ where $a$ is a constant.
Homogeneous equation: $\;\dfrac{dy}{dx}+ a y =0$ $\;\Ra \;\dfrac{dy}{dx}=-a y$
$\;\Ra \;\dfrac{1}{y}\dfrac{dy}{dx}=-a $ $\;\Ra\ds \int \dfrac{1}{y}dy=-a\int dx $
$\;\Ra \; \ln|y| = -ax +C$ $\;\Ra \; y = Be^{-ax}$
Therefore the solution to the homogeneous equation $\dfrac{dy}{dx}+ a y =0$ is
$y_H = Be^{-ax}$
To solve $\dfrac{dy}{dx}+ a y = f(x),$ where $a$ is a constant:
Example: Solve the ODE $\ds\;\dif{y}{x}+2y=4x.$
Example: Solve the ODE $\ds\;\dif{y}{x}+2y=4x.$
1. Solve the homogeneous equation $\ds y'+2y=0$ $\;\Ra\; \dfrac{1}{y}\ds y'=-2$
$\ds \quad \Ra \int \frac{1}{y}dy = -2\int dx$ $\Ra\; \ds \ln|y|=-2x+C$ $\;\Ra \;\ds y_H=Ce^{-2x}.$
2. Note that $f(x)=4x$ is a linear function, so our guess for the particular solution should be a linear function: $\ds y_P=Ax+B.$
3. Get $\;y_P'$ $=A\;$ and substitute in the ODE : $\ds\; \overbrace{A}^{y'}+2\overbrace{(Ax+B)}^{y}=4x.$
Match coefficients: $\ds 2A=4,\;A+2B=0.$ Then $\,\ds A=2,\;B=-1.$
4. The general solution is $\ds y=y_H+y_P$ $=\underbrace{Ce^{-2x}}_{y_H}+ \underbrace{2x-1}_{y_P}$
To solve a first-order linear ODE:
Example: Solve the ODE $\ds\;\dif{y}{x}=y+x.$
Does the ODE has the form $\ds\dif{y}{x}+p(x)\,y(x)=q(x)?$
Example: Solve the ODE $\ds\;\dif{y}{x}=y+x.$
1. ODE is 1st order linear: $y'-y= x,\,$ with $p(x) = -1$ and $q(x)=x.$
2. $\ds I(x) = \exp\left(\int p(x) \ dx\right)$ $ \ds= \exp\left(\int (-1) \ dx\right)$ $\ds= e^{-x}.$
3. $\ds e^{-x}y' -e^{-x}y = e^{-x}x$ $\;\; \Ra \ds \text{LHS} = \frac{d}{dx} \left(e^{-x}y\right) $ $\ds = e^{-x}x.$
4. $\ds e^{-x} y = \int e^{-x} x ~dx +C\,$ $\;\Ra \;\ds e^{-x} y = -x e^{-x} - e^{-x} +C.$
$\quad $So the general solution is $\,\ds y = -x -1 +Ce^x.$
| Method of Undetermined Coefficients | Integrating Factor Method |
|---|---|
|
Used for equations of the form
$\ds \frac{dy}{dx} + a \,y = f(x),$
where \(a\) is constant.
|
Applicable to any first-order linear equation.
|
| Examples of $f(x)$ | Choice for $y_p$ |
|---|---|
| $C$ | $C$ |
| $x$ | $Cx+D$ |
| $x^2$ | $Cx^2+Dx+E$ |
| $e^{kx}$ | $Ce^{kx}$ |
| $\sin (kx)$ | $C\sin (kx) + D\cos (kx)$ |
| $\cos (kx)$ | $C\sin (kx) + D\cos (kx)$ |
| $xe^{kx}$ | $\left(Cx+D\right)e^{kx}$ |
$C,$ $D,$ $E$ and $k$ are constants.