Friday, March 11, 2016

Differential equation: A special case ($f'(x) - f(x) =...$)

Question:
Solve a differential equation.
\[
f'(x) - f(x) = -2\sin x
\]
The initial condition is $f(0) = 1$.

Answer:
When you find the form, $f'(x) - f(x) =...$, we can utilize the following relation:
\[
[f(x)e^{-x}]' = e^{-x}[f'(x) - f(x)]
\]
If we apply this formula to the above differential equation, we get
\[
[f(x)e^{-x}]' = e^{-x}[-2\sin x]
\]
For the right hand side, we used $f'(x) - f(x) = -2\sin x$. Then, integrate both sides of above equation.
\begin{equation}
f(x)e^{-x} = -2\int e^{-x}\sin x dx
\end{equation}
For the right hand side, we just consider integration by parts of the following factor:
\begin{eqnarray*}
& & \int e^{-x}\sin x dx = -e^{-x}\sin x - \int (-1)e^{-x}\cos x dx  \\
\rightarrow & & \int e^{-x}\sin x dx = -e^{-x}\sin x - e^{-x}\cos x - \int (-1)e^{-x}(-1)\sin x dx  \\
\rightarrow & & \int e^{-x}\sin x dx + \int e^{-x}\sin x dx = -e^{-x}\sin x - e^{-x}\cos x   \\
\rightarrow & & 2\int e^{-x}\sin x dx = -e^{-x}(\sin x + \cos x)   \\
\rightarrow & & \int e^{-x}\sin x dx = -\frac{1}{2}e^{-x}(\sin x + \cos x) + C
\end{eqnarray*}
Plug this into (1).
\begin{eqnarray}
f(x)e^{-x} &=& e^{-x}(\sin x + \cos x) + C  \\
\end{eqnarray}
Use the initial condition, $f(0) = 1$.
\[
f(0) = \sin 0 + \cos 0 + C = 1 + C = 1
\]
Thus, $C = 0$. The final result is
\[
f(x) = \sin x + \cos x
\]

Powered by Hirophysics.com

No comments:

Post a Comment