Calculus I
&
Engineering Mathematics 2

Workshop 10


First Order Inhomogeneous Equations With Constant Coefficients

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}$


First Order Inhomogeneous Equations With Constant Coefficients

To solve $\dfrac{dy}{dx}+ a y = f(x),$ where $a$ is a constant:

  1. Find the solution, $\,y_H$, to the homogeneous equation $\dfrac{dy}{dx}+ a y =0.$
  2. Guess $y_P$ which is the particular solution to the original equation. The guess for $y_P$ should be the same general form as that of $f(x).$
  3. Substitute $y_P$ and $y'_P$ back into the original differential equation to determine any unknown constants.
  4. Find the general solution $y = y_H + y_p.$

First Order Inhomogeneous Equations With Constant Coefficients



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}$




First Order Linear Differential Equations

To solve a first-order linear ODE:

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


First Order Linear Differential Equations


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.$




Summary
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.

  1. Solve the homogeneous equation \(\dfrac{dy}{dx} + a y = 0\) to get \(y_H\).
  2. Guess a particular solution \(y_P\) with the same form as \(f(x)\).
  3. Substitute \(y_P\) into the ODE to find unknown constants.
  4. Form the general solution \(y = y_H + y_P\).

Applicable to any first-order linear equation.

  1. Write the equation as \(\dfrac{dy}{dx} + p(x)y = q(x)\).
  2. Compute the integrating factor
    $\ds I(x)=\exp\!\left(\int p(x)\,dx\right).$
  3. Multiply through by \(I(x)\) and use the product rule:
    $\ds \frac{d}{dx}\big(Iy\big)=I q.$
  4. Integrate both sides and solve for \(y\).

To solve the equation $\ds \frac{dy}{dx}+a\,y = f(x),$ the guesses of $y_P$ are as follows:
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.


Credits