[SOLVED] How to find differential operators/annihilators?

I don't understand how to find differential operators that annihilate functions... my professor just does them in lecture like they are nothing, but none of my friends (nor I) know how these work.

Some examples...

$\displaystyle y=x^2 exp(2x) \rightarrow(D-2)^3$

$\displaystyle y=x^3 exp(-x) \rightarrow(D+1)^4$

$\displaystyle y=exp(-x) cos(3x)\rightarrow(D+1)^2+3^2$

$\displaystyle y=x exp(-x) cos(3x)\rightarrow[(D+1)^2+3^2 ]^2$

$\displaystyle y=x^3 exp(-x) cos(3x)\rightarrow[(D+1)^2+3^2 ]^4$

But how would I, for example, annihilate:

$\displaystyle x+cos(x)$

Thanks in advance!