# Thread: Finding Non-Homgenous Differential Equations

1. ## Finding Non-Homgenous Differential Equations

Hi

I am having problem trying to find $y_p$ of the equation:

$y=2\frac{d^2y}{dx^2}+4\frac{dy}{dx}+7y=e^{-x}cos(x)$

i tried $y_p = Asin(x)+Bcos(x)$ but this doesn't work, because i am still left with a constant of $e^{x}$.

P.S

2. First of all, don't use equals signs where things aren't equal. $y$ does NOT equal the rest of that stuff...

I would try $y_p = e^{-x}(A\cos{x} + B\sin{x})$.

Then $\frac{dy_p}{dx} = -e^{-x}(A\cos{x} + B\sin{x}) + e^{-x}(-A\sin{x} + B\cos{x})$

$= e^{-x}[-(A + B)\sin{x} + (B - A)\cos{x}]$

and $\frac{d^2y_p}{dx^2} = -e^{-x}[-(A + B)\sin{x} + (B-A)\cos{x}] + e^{-x}[-(A + B)\cos{x} + (A-B)\sin{x}]$

$= e^{-x}(2A\sin{x} - 2B\cos{x})$.

$2\frac{d^2y}{dx^2} + 4\frac{dy}{dx} + 7y = e^{-x}\cos{x}$

$2e^{-x}(2A\sin{x} - 2B\cos{x}) + 4e^{-x}[-(A + B)\sin{x} + (B - A)\cos{x}] + 7e^{-x}(A\cos{x} + B\sin{x}) = e^{-x}\cos{x}$

$e^{-x}(4A\sin{x} - 4B\cos{x}) + e^{-x}[-(4A + 4B)\sin{x} + (4B - 4A)\cos{x}] + e^{-x}(7A\cos{x} + 7B\sin{x}) = e^{-x}\cos{x}$

$e^{-x}[4A\sin{x} - 4B\cos{x} - (4A + 4B)\sin{x} + (4B - 4A)\cos{x} + 7A\cos{x} + 7B\sin{x}] = e^{-x}\cos{x}$

$e^{-x}[3B\sin{x} + 3A\cos{x}] = e^{-x}\cos{x}$

$3B\sin{x} + 3A\cos{x} = 0\sin{x} + 1\cos{x}$.

Therefore $3B = 0$ and $3A = 1$

$B = 0$ and $A = \frac{1}{3}$.

This means $y_p = \frac{1}{3}e^{-x}\cos{x}$.

3. well after looking at the equation i tried another way where you separate e^{-x} and cos(x) and do them separately, however i don't get the same answer as what you have done.
This is my working solution

$y_{p1}= Ce^{-x}$

$y_{p1}' = -Ce^{-x}$

$y_{p1}'' = Ce^{-x}$

$2(Ce^{-x}-Ce^{-x}-Ce^{-x})+ 4(-Cxe^{-x}+-Ce^{-x})+7(-Cxe^{-x})=-e^{-x}cos(x)$

$2Cxe^{-x}-2Ce^{-x}-2Ce^{-x}+ -4Cxe^{-x}+4Ce^{-x}+7Cxe^{-x})=-e^{-x}cos(x)
$

$9Cxe^{-x}-4Ce^{-x}=e^{-x}$

$5C=1$

$C=\frac{1}{5}$

$y_{p2} = Asin(x)+Bcos(x)$

$y_{p2}' = Acos(x)-Bsin(x)$

$y_{p2}''= -Asin(x)-Bcos(x)$

$2(-Asin(x)-Bcos(x))+4(Acos(x)-Bsin(x))+7(Asin(x)+Bcos(x))=cos(x)$

$-2Asin(x)-2Bcos(x))+4Acos(x)-4Bsin(x))+7Asin(x)+7Bcos(x))=cos(x)$

$sin(x)(5A-4B)+cos(x)(5B+4A)=cos(x)$

$5A-4B=0$

$5B-4A=1$

$A=\frac{4B}{5}$

$5B-4(\frac{4B}{5})=1$

$\frac{25B}{5}+\frac{16B}{5}=1$

$B=\frac{5}{41}$

$A=4\frac{\frac{5}{41}}{5}$
$A=\frac{4}{41}$

$y= e^{-x}(Acos(\sqrt{\frac{5}{2}}x)+ Asin(\sqrt{\frac{5}{2}}x)+\frac{1}{5}e^{-x}* \frac{4}{41}sin+\frac{5}{41}cos(x)$
what is my problem??

4. Well you're obviously not going to get the same answer, because a sum of an exponential with a trigonometric function is not the same as a product of them.

I don't know why you're overcomplicating this. The easiest way is to use the same "family" of functions as you are given.

In this case, your "family" is the product of an exponential and the trigonometric functions.

The only time you would have to do differently is if this "family" appears in your homogenous solution. Then you have to multiply it by $x$.

5. ok i understand now, i think i was confusing myself.