Prove that $\int_0^\infty \frac{\sin nx}{x}dx=\frac{\pi}{2}$ There was a question on multiple integrals which our professor gave us on our assignment.

QUESTION: Changing order of integration, show that $$\int_0^\infty \int_0^\infty  e^{-xy}\sin nx \,dx \,dy=\int_0^\infty \frac{\sin nx}{x}dx$$
  and hence prove that $$\int_0^\infty \frac{\sin nx}{x}dx=\frac{\pi}{2}$$


MY ATTEMPT: I was successful in proving the first part.
Firstly, I can state that the function $e^{-xy}\sin nx$ is continuous over the region $\mathbf{R}=\{(x,y): 0<x<\infty,0<y<\infty\}$
$$\int_0^\infty \int_0^\infty  e^{-xy}\sin nx \,dx \,dy$$
$$=\int_0^\infty \sin nx \left\{\int_0^\infty  e^{-xy}\,dy\right\} \,dx$$
$$=\int_0^\infty \sin nx \left[\frac{e^{-xy}}{-x}\right]_0^\infty \,dx$$
$$ =\int_0^\infty \frac{\sin nx}{x}dx$$
However, the second part of the question yielded a different answer.
$$\int_0^\infty \int_0^\infty  e^{-xy}\sin nx \,dx \,dy$$
$$=\int_0^\infty \left\{\int_0^\infty  e^{-xy} \sin nx \,dx\right\} \,dy$$
$$=\int_0^\infty \frac{ndy}{\sqrt{n^2+y^2}}$$
which gives an indeterminate result, not the desired one.
Where did I go wrong? Can anyone help?

You should have obtained $$\int_{x=0}^\infty e^{-yx} \sin nx \, dx = \frac{n}{n^2 + y^2}.$$  There are a number of ways to show this, such as integration by parts.  If you would like a full computation, it can be provided upon request.

Let $$I = \int e^{-xy} \sin nx \, dx.$$  Then with the choice $$u = \sin nx, \quad du = n \cos nx \, dx, \\ dv = e^{-xy} \, dx, \quad v = -\frac{1}{y} e^{-xy},$$ we obtain $$I = -\frac{1}{y} e^{-xy} \sin nx + \frac{n}{y} \int e^{-xy} \cos nx \, dx.$$  Repeating the process a second time with the choice $$u = \cos nx \, \quad du = -n \sin nx \, dx, \\ dv = e^{-xy} \, dx, \quad v = -\frac{1}{y} e^{-xy},$$ we find $$I = -\frac{1}{y}e^{-xy} \sin nx - \frac{n}{y^2} e^{-xy} \cos nx - \frac{n^2}{y^2} \int e^{-xy} \sin nx \, dx.$$  Consequently $$\left(1 + \frac{n^2}{y^2}\right) I = -\frac{e^{-xy}}{y^2} \left(y \sin nx + n \cos nx\right),$$ hence $$I = -\frac{e^{-xy}}{n^2 + y^2} (y \sin nx + n \cos nx) + C.$$  Evaluating the definite integral, for $y, n > 0$, we observe $$\lim_{x \to \infty} I(x) = 0, \quad I(0) = -\frac{n}{n^2 + y^2},$$ and the result follows.
