# How do you solve $(D^2+1)y=4\cos{x}$?

I'm stuck on this question:

$$(D^2+1)y=4\cos{x}$$

where $D^2$ denotes the differential operator $\frac{d^2}{dx^2}$

As far as I know for trig functions, I'm supposed to assume $y=A\sin{x}+B\cos{x}$ and substitute to get $A$ and $B$. But however, for such,

$$(D^2+1)y=0$$

for all values of $A$ and $B$. I don't know what other types of $y$ I should assume. I'm basically clueless here, so any hints would be great.

• Try $x(A\cos x+B\sin x)$. Mar 5, 2018 at 16:52
• Try $x\sin(x)$ and $x\cos(x)$ and see what happens. Mar 5, 2018 at 16:52
• It worked. Thanks @LordSharktheUnknown Mar 5, 2018 at 16:57
• You need to review the section on Undetermined Coefficients, more carefully this time! It says right there in the book that since $\cos(t)$ and $\sin(t)$ are solutions to the homogeneous equation you need to use $y_p=At\cos(t)+Bt\sin(t)$ instead. Mar 5, 2018 at 17:08

$$(D^2+1)y=4\cos{x}$$ For $\cos(x)$ function use $(D^2+1)$ $$(D^2+1)^2y=0$$ $$(D^4+2D^2+1)y=0$$ The general solution is $$y=\color{blue}{y_h}+\color{green}{y_p}$$ $$y=\color{blue}{c_1\cos(x)+c_2\sin(x)}+\color{green}{c_3x\sin(x)+c_4x\cos(x)}$$ Particular solution is therefore $y_p=c_3x\sin(x)+c_4x\cos(x)$
You need to find now the value of the constants $c_3,c_4$
Since the roots of auxiliary equation $m^2+1=0$ be $i,-i$, so complementary function $y_c=c_1\cos x+c_2\sin x$.
For finding particular solution $y_p$: You have to obtain real part of $$\frac{1}{D^2+1}4e^{ix}=4e^{ix}\frac{1}{(D+i)^2+1}1.$$ The general solution is $y_c+y_p$.