How to prove $\int_0^{\infty}\frac{x^2+3x+3}{(x+1)^3} e^{-x}\sin x\, dx = \frac{1}{2}.$

I've just seen this integral crop up on another site and I can't see an obvious way to prove it.

Any suggestions?

$$\int_0^{\infty}\frac{x^2+3x+3}{(x+1)^3} e^{-x}\sin x\, dx = \frac{1}{2}.$$


We have: $$ I = \int_{0}^{+\infty}\frac{\sin x}{x}e^{-x}\,dx -\int_{0}^{+\infty}\frac{\sin x}{x(x+1)^3}e^{-x}\,dx=\color{blue}{I_1}-\color{red}{I_2}.$$ Since $$\frac{\sin x}{x}=\sum_{k=0}^{+\infty}(-1)^k\frac{x^{2k}}{(2k+1)!}$$ and $$\int_{0}^{+\infty}x^{2k}e^{-x}\,dx = (2k)! $$ we have: $$\color{blue}{I_1}=\int_{0}^{+\infty}\frac{\sin x}{x}e^{-x}\,dx = \sum_{k=0}^{+\infty}\frac{(-1)^k}{2k+1}=\arctan(1)=\color{blue}{\frac{\pi}{4}}.$$ Using a standard trick: $$\int_{0}^{+\infty}\frac{\sin x}{x(x+1)^3}e^{-x}\,dx=\frac{1}{2}\int_{0}^{+\infty}\int_{0}^{+\infty}\frac{\sin x}{x}e^{-x}t^2 e^{-t(x+1)}\,dt\,dx$$ and by the previous lemma we get: $$\color{red}{I_2}=\int_{0}^{+\infty}\frac{\sin x}{x(x+1)^3}e^{-x}\,dx=\frac{1}{2}\int_{0}^{+\infty}t^2 e^{-t}\arctan\frac{1}{1+t}\,dt.$$ Now we use integration by parts. We have: $$\color{red}{I_2} = \left.\frac{1}{2}e^{-t}(-t^2-2t-2)\arctan\frac{1}{t+1}\right|_{0}^{+\infty}-\frac{1}{2}\int_{0}^{+\infty}e^{-t}\,dt = \color{red}{\frac{\pi}{4}-\frac{1}{2}}$$ and we are done.


Somewhat more generally, let $$ F(s) = \int_0^\infty \dfrac{x^2+a x+ b}{(x+1)^3} e^{-sx}\; dx$$ which converges for $\text{Re}(s) > 0$. It is the Laplace transform of $$ f(x) = \dfrac{x^2 + a x + b}{(x+1)^3}$$ The general solution is $$ F(s) = \dfrac{e^s}{2} \left((b-a+1) s^2 + (4-2a) s +2\right) Ei(1,s) + \left(a-1-b\right) \dfrac{s}{2}+\dfrac{a+b-3}{2} $$ where $$Ei(1,s) = \int_1^\infty \dfrac{e^{-st}}{t}\; dt$$
is the exponential integral function. For an elementary solution, what you need is $(b-a+1) s^2 + (4 - 2 a) s + 2 = 0$ which is what you have in the case at hand with $a=b=3$, $s = 1 \pm i$.

EDIT: That "general solution" comes about this way. First make the change of variables $x+1=t$, and expand $f(x)$ in powers of $t$. Now as I mentioned

$$ \int_1^\infty \dfrac{e^{-st}}{t} \; dt = Ei(1,s)$$ Use integration by parts to get $$ \eqalign{ \int_1^\infty \dfrac{e^{-st}}{t^3}\; dt &= \left. -{\frac {{{ e}^{-st}}}{2{t}^{2}}}\right|_{t=1}^\infty - \dfrac{s}2 \int_1^\infty {\frac {{{ e} ^{-st}}}{{t}^{2}}}\,{ d}t\cr \int_1^\infty \dfrac{e^{-st}}{t^2}\; dt &= \left. -{\frac {{{ e}^{-st}}}{{t}}}\right|_{t=1}^\infty - s \int_1^\infty {\frac {{{ e} ^{-st}}}{{t}}}\,{ d}t\cr}$$


$\newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle} \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack} \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,} \newcommand{\dd}{{\rm d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\dsc}[1]{\displaystyle{\color{red}{#1}}} \newcommand{\expo}[1]{\,{\rm e}^{#1}\,} \newcommand{\fermi}{\,{\rm f}} \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,} \newcommand{\half}{{1 \over 2}} \newcommand{\ic}{{\rm i}} \newcommand{\iff}{\Longleftrightarrow} \newcommand{\imp}{\Longrightarrow} \newcommand{\Li}[1]{\,{\rm Li}_{#1}} \newcommand{\pars}[1]{\left(\, #1 \,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\pp}{{\cal P}} \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,} \newcommand{\sech}{\,{\rm sech}} \newcommand{\sgn}{\,{\rm sgn}} \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}} \newcommand{\ul}[1]{\underline{#1}} \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}$ $\ds{\int_{0}^{\infty}{x^{2} + 3x + 3 \over \pars{x + 1}^{3}}\, \expo{-x}\sin\pars{x}\,\dd x = \half:\ {\large ?}}$


With $\ds{a \equiv 1 - \ic}$: \begin{align} &\color{#66f}{\large% \int_{0}^{\infty}{x^{2} + 3x + 3 \over \pars{x + 1}^{3}}\,\expo{-x}\sin\pars{x} \,\dd x} \\[5mm] = &\ \Im\int_{0}^{\infty}{1 + \pars{x + 1} + \pars{x + 1}^{2} \over \pars{x + 1}^{3}}\, \expo{-ax}\,\dd x \\[5mm] = &\ \sum_{n\ =\ 0}^{2}\Im\int_{0}^{\infty} {\expo{-ax} \over \pars{x + 1}^{n + 1}}\,\dd x \\ = &\ \sum_{n\ =\ 0}^{2}\Im\int_{0}^{\infty} \expo{-ax}\,\ \overbrace{% {1 \over n!}\int_{0}^{\infty}t^{n}\expo{-\pars{x + 1}t}\,\dd t} ^{\dsc{1 \over \pars{x +1}^{n + 1}}}\ \,\dd x \\[5mm] = &\ \sum_{n\ =\ 0}^{2}{1 \over n!}\,\Im\int_{0}^{\infty}t^{n}\expo{-t} \int_{0}^{\infty}\expo{-\pars{a + t}x}\,\dd x\,\dd t \\[5mm] = &\ \sum_{n\ =\ 0}^{2}{1 \over n!}\, \Im\int_{0}^{\infty}{t^{n}\expo{-t} \over a + t}\,\dd t \\[5mm] = &\ \sum_{n\ =\ 0}^{2}{1 \over n!}\, \int_{0}^{\infty}{t^{n}\expo{-t} \over \pars{t + 1}^{2} + 1}\,\dd t \\[5mm] = &\ \half\int_{0}^{\infty}{% 2\sum_{n\ =\ 0}^{2}\,\,t^{n}/n! \over \pars{t + 1}^{2} + 1}\,\expo{-t}\,\dd t \\[5mm] = &\ \half\int_{0}^{\infty} {2 + 2t+ t^{2}\over t^{2} + 2t + 2}\, \expo{-t}\,\dd t = \half\int_{0}^{\infty}\expo{-t}\,\dd t= \color{#66f}{\Large\half} \end{align}

Hint: Let $~I(a)=\displaystyle\int_0^\infty\frac{P(x)}{x+a}~e^{kx}~dx.~$ After applying polynomial long division to $~\dfrac{P(x)}{x+a}$ ,

evaluate $I''(1)$. Euler's formula will also come into play. P.S.: Do not be afraid of the exponential integrals and/or incomplete $\Gamma$ functions which will inevitably appear in the expression of $I(a)$: they will just as easily disappear when differentiating.