Why does this integral evaluate incorrectly when applying IBP differently? The question says to show (via IBP):
$$\int_{0}^\infty e^{-xy}\sin y \mathrm{d}y = \frac{1}{1+x^2} \quad \text{for} \quad x>0.$$  
The solutions did it by first differentiating the exponential and integrating the trigonometric terms... but I did it the other way yet it doesn't give me the answer!?  
Here is what I did:
Let $I$ be the integral
$u = \sin y$ and $dv = e^{-xy}\mathrm{d}y$ then
$\mathrm{d}u = \cos y \mathrm{y}$ and $\frac{e^{-xy}}{-x}$  
$$I = \left[\sin y\frac{e^{-xy}}{-x}\right]_{0}^\infty - \int_{0}^\infty \frac{e^{-xy}\cos y}{-x} dy\\ \\=  \frac{1}{x}\int_{0}^\infty e^{-xy}\cos y \mathrm{d}y$$  
Letting
$u = \cos y$ and $dv = e^{-xy}dy$
$du = -\sin y$ and $v = \frac{e^{-xy}}{-x}$  
$$I = \frac{1}{x}\left(\left[\cos y \frac{e^{-xy}}{-x}\right]_{0}^\infty - I\right)\\  
\\  
I =   \frac{1}{x}\left(\frac{1}{x} - I\right)\\ \implies I = \frac{1}{x^2} - \frac{1}{x}I \\ \implies \left(1+\frac{1}{x}\right)I =  \frac{1}{x^2}\\ \implies I = \frac{1}{x(x+1)}.$$
 A: You just missing $\frac1x$ $$I = \left[\sin y\frac{e^{-xy}}{-x}\right]_{0}^\infty - \int_{0}^\infty \frac{e^{-xy}\cos y}{-x} dy\\ \\=  \frac{1}{x}\int_{0}^\infty e^{-xy}\cos y \mathrm{d}y\\=\frac1x(\left[\cos y\frac{e^{-xy}}{-x}\right]_{0}^\infty- \int_{0}^\infty \frac{e^{-xy}(-\sin y)}{-x} dy)$$so $$I=\frac1x(\frac1x-\frac1x \int_{0}^\infty \frac{e^{-xy}(+\sin y)}{1} dy) \to I=\frac1x(\frac1x-\frac1xI)\to\\
I=\frac{1}{x^2}(1-I)\\I(1+\frac{1}{x^2})=\frac{1}{x^2}\\I=\frac{1}{1+x^2}$$
Second solution :
$$e^{iy}-e^{-iy}=cos y+i\sin y -(cos y-i\sin y)=2i\sin y \to \\\sin y =\dfrac{e^{iy}-e^{-iy}}{2i}$$
$$\int_{0}^\infty e^{-xy}\sin y \mathrm{d}y =\int_{0}^\infty e^{-xy}\dfrac{e^{iy}-e^{-iy}}{2i} \mathrm{d}y =\\
\dfrac{1}{2i}\int_{0}^\infty (e^{y(i-x)}-e^{y(-i-x)})\mathrm{d}y=\ \dfrac{1}{2i} (\dfrac{e^{y(i-x)}}{i-x}-\dfrac{e^{y(-i-x)}}{-i-x})|^{\infty}_0=\\\frac{1}{2i}(0-\frac{1}{i-x}+0-\frac{1}{i+x})=\\
\frac{1}{2i}(-\frac{i+x+i-x}{i^2-x^2}) =\\\frac{1}{2i}(-\frac{2i}{-1-x^2})=\\\frac{1}{1+x^2}$$
