Thursday, October 8, 2015

Simple Differential Equation

Problem:

Find constants A and B such that $ y=A\sin x + B \cos x $ satisfies the differential equation $ y"+y'-2y=\sin x $

Solution:

Let differentiate the expressions, twice:

$ y' = A\cos x - B\sin x $
$ y'' = -A \sin x - B \cos x $.

So just substitute the expressions in the differential equation

$ \begin{eqnarray*} y" + y' - 2y &=& \sin x \\ (-A \sin x - B \cos x) + (A\cos x - B\sin x) -2(A\cos x - B\sin x) &=& \sin x \\ \end{eqnarray*} $

Next, we arrange the expression and just matching coefficients

$ \begin{eqnarray*} (-A \sin x - B \cos x) + (A\cos x - B\sin x) -2(A\cos x - B\sin x) &=& \sin x \\ -A \sin x - B \cos x + A\cos x - B\sin x - 2A\cos x + 2B\sin x - \sin x &=& 0 \\ -A \sin x - B\sin x + 2B\sin x - \sin x - B \cos x + A\cos x - 2A\cos x &=& 0 \\ (-A - B + 2B - 1)\sin x + (-B + A - 2A)\cos x &=& 0 \\ (-A + B - 1)\sin x + (-B - A)\cos x &=& 0 \\ \end{eqnarray*} $

Now it is obvious that $ A = -\frac{1}{2} $ and $ B = \frac{1}{2} $.

No comments:

Post a Comment