$\int (x^2 + 1)e^{-inx}$
Can I just do it by parts or is there a special theorem from Complex Analysis?
$\int (x^2 + 1)e^{-inx}$
Can I just do it by parts or is there a special theorem from Complex Analysis?
You can look for a polynomial $g(x)=ax^2+bx+c$ such that $$ (g(x)e^{inx})'=g'(x)e^{inx}+ing(x)e^{inx}=(x^2+1)e^{inx} $$ so $$ x^2+1=2ax+b+inax^2+inbx+inc $$ and therefore $$ \begin{cases} ina=1 \\ 2a+inb=0\\ b+inc=1 \end{cases} $$ Thus $$ a=\frac{1}{in},\qquad b=\frac{2}{n^2},\qquad c=\frac{n^2-2}{in^3} $$
It's actually really easy with integration by parts:
$$\begin{align}I&=\frac in\left[(x^2+1)e^{-inx}-2\int xe^{-inx}\ dx\right]\\&=\frac in\left[(x^2+1)e^{-inx}-\frac{2i}n\left[xe^{-inx}-\int e^{-inx}\ dx\right]\right]\\&=\frac in\left[(x^2+1)e^{-inx}-\frac{2i}n\left[xe^{-inx}-\frac ine^{-inx}\right]\right]+c\end{align}$$
The second method involves differentiation under the integral sign. Note that
$$\int e^{xt}\ dx=\frac{e^{xt}}t\tag0$$
Take the derivative with respect to $t$ a few times:
$$\int xe^{xt}\ dx=\frac{(xt-1)e^{xt}}{t^2}\tag1$$
$$\int x^2e^{xt}\ dx=\frac{(x^2t^2-2xt+2)e^{xt}}{t^3}\tag2$$
It's then easy to see that your integral reduces as follows:
$$\begin{align}I&=\int e^{-inx}\ dx+\int x^2e^{-inx}\ dx\\&=\frac{e^{-inx}}{-in}+\frac{(-x^2n^2+2inx+2)e^{-inx}}{in^3}+c\end{align}$$