We introduce a parameter t and consider the integral I(t)=∫0∞e−txxsin(x)dx. Note that I(0)=∫0∞xsin(x)dx which is the integral we want to find, and I(∞)=0. We differentiate I(t) with respect to t: dtdI=dtd∫0∞e−txxsin(x)dx=∫0∞∂t∂(e−txxsin(x))dx=∫0∞−e−txsin(x)dx=−∫0∞e−txsin(x)dx We can evaluate this integral using integration by parts twice.
Let u=e−tx and dv=sin(x)dx, so du=−te−txdx and v=−cos(x). Then ∫0∞e−txsin(x)dx=[−e−txcos(x)]0∞−∫0∞te−txcos(x)dx=[0−(−1)]−t∫0∞e−txcos(x)dx=1−t∫0∞e−txcos(x)dx. Now, let u=e−tx and dv=cos(x)dx, so du=−te−txdx and v=sin(x). Then ∫0∞e−txcos(x)dx=[e−txsin(x)]0∞−∫0∞−te−txsin(x)dx=0+t∫0∞e−txsin(x)dx. Substituting this back into the first integration by parts:
∫0∞e−txsin(x)dx=1−t(t∫0∞e−txsin(x)dx)=1−t2∫0∞e−txsin(x)dx. So (1+t2)∫0∞e−txsin(x)dx=1, and ∫0∞e−txsin(x)dx=1+t21. Then dtdI=−1+t21. Integrating with respect to t, we have I(t)=−arctan(t)+C. As t→∞, I(t)→0, so 0=−arctan(∞)+C=−2π+C, which gives C=2π. Thus I(t)=−arctan(t)+2π. We want I(0)=∫0∞xsin(x)dx, so we evaluate I(0)=−arctan(0)+2π=0+2π=2π.