Closed form of $\int_0^\infty \sin(x)\sin\left(\frac{1}{x}\right)dx$?
I'm pretty sure I remember doing this one before...
Ah, there it is. AoPS link.
Quoting myself:
Well, you can't just leave it there. This one definitely deserves more than just an answer.
Now, trying to work out an actual solution - $1$ is not a special point for $\sin$. There's nothing special about picking $\frac1x$ there - so, to give ourselves more handles to work with, we stretch the problem. Define $$F(a) = \int_0^{\infty}\sin(x)\sin\left(\frac{a}{x}\right)\,dx$$ Now, we would like to differentiate $F$. Differentiating under the integral sign gets us $F'(a) \stackrel{?}{=} \int_0^{\infty}\frac1x\sin(x)\cos\left(\frac{a}{x}\right)\,dx$ and then $F''(a) \stackrel{?}{=} \int_0^{\infty}\frac{-1}{x^2}\sin(x)\sin\left(\frac{a}{x}\right)\,dx$, while substituting $t=\frac{a}x$ gets us $F(a) = \int_{\infty}^{0}\sin\left(\frac{a}{t}\right)\sin(t)\cdot\frac{-a}{t^2}\,dt \stackrel{?}{=} -aF''(a)$.
Why the question marks? Because I'm doing things with conditionally convergent integrals that I would need absolute convergence to justify.
It's still informative. That's not the Bessel differential equation, but it's related - looking at the power series, we would get a Bessel function of $2\sqrt{a}$. In light of that, let's redefine: $$G(a) = \int_0^{\infty}\sin(x)\sin\left(\frac{a^2}{x}\right)\,dx$$ Now, we need to massage this into a form that will let us justify the differentiation. First, split at $x=a$ and fold with that substitution: \begin{align*}G(a) &= \int_0^a \sin(x)\sin\left(\frac{a^2}{x}\right)\,dx + \int_a^{\infty} \sin(x)\sin\left(\frac{a^2}{x}\right)\,dx\\ &= \int_0^a \sin(x)\sin\left(\frac{a^2}{x}\right)\,dx + \int_a^0 \sin\left(\frac{a^2}{t}\right)\sin(t)\cdot\frac{-a^2}{t^2}\,dt\\ &= \int_0^a \sin(x)\sin\left(\frac{a^2}{x}\right)\,dx + \int_0^a \frac{a^2}{x^2}\sin(x)\sin\left(\frac{a^2}{x}\right)\,dx\\ G(a) &= \int_0^a \left(1+\frac{a^2}{x^2}\right)\sin(x)\sin\left(\frac{a^2}{x}\right)\,dx\end{align*} This form is improper at zero due to the rapid growth (balanced by oscillation), so we integrate by parts: \begin{align*}G(a) &= \int_0^a \left(1+\frac{a^2}{x^2}\right)\sin(x)\sin\left(\frac{a^2}{x}\right)\,dx\\ &\,_{dv = \tfrac{a^2}{x^2}\sin\tfrac{a^2}{x}\,dx,\quad v = \cos\tfrac{a^2}{x}}^{u = (\tfrac{x^2}{a^2}+1)\sin x,\quad du = (\tfrac{x^2}{a^2}+1)\cos x + \tfrac{2x}{a^2}\sin x\,dx}\\ G(a) &= \left[\left(\frac{x^2}{a^2}+1\right)\sin x\cos\frac{a^2}{x}\right]_{x=0}^{x=a} - \int_0^a \cos\frac{a^2}{x}\left(\left(\frac{x^2}{a^2}+1\right)\cos x + \frac{2x}{a^2}\sin x\right)\,dx\\ &= \sin(2a) - \int_0^a \cos\frac{a^2}{x}\left(\left(\frac{x^2}{a^2}+1\right)\cos x + \frac{2x}{a^2}\sin x\right)\,dx\end{align*} This form is now absolutely convergent; it's the integral of a bounded function on a bounded interval, continuous except at one endpoint. If we differentiate it - well, then we get terms in which we multiply by $\frac{2a}{x}$, and it's improper again. Only the $\cos\frac{a^2}{x}\cos x$ term causes trouble, so let's separate that out: $$G(a) = \sin(2a) - \int_0^a \cos\frac{a^2}{x}\left(\frac{x^2}{a^2}\cos x + \frac{2x}{a^2}\sin x\right)\,dx - \int_0^a \cos\frac{a^2}{x}\cos x\,dx$$ \begin{align*}\int_0^a \cos\frac{a^2}{x}\cos x\,dx &= \left[-\frac{x^2}{a^2}\cos x\sin\frac{a^2}{x}\right]_{x=0}^{x=a} + \int_0^a \sin\frac{a^2}{x}\left(\frac{2x}{a^2}\cos x - \frac{x^2}{a^2}\sin(x)\right)\,dx\\ G(a) &= \frac32\sin(2a) -\int_0^a \frac{x^2}{a^2}\cos\left(x+\frac{a^2}{x}\right) + \frac{2x}{a^2}\sin\left(x+\frac{a^2}{x}\right)\,dx\end{align*} That's a lot of trig identities that go into that last line - mostly the angle-sum identities, which our manipulation was nice enough to set up for us cleanly.And now, we can finally differentiate cleanly. \begin{align*}G(a) &= \frac32\sin(2a) -\int_0^a \frac{x^2}{a^2}\cos\left(x+\frac{a^2}{x}\right) + \frac{2x}{a^2}\sin\left(x+\frac{a^2}{x}\right)\,dx\\ G'(a) &= 3\cos(2a) - \cos(2a) - \frac{2}{a}\sin(2a)\\ &\quad+\int_0^a \frac{2x^2}{a^3}\cos\left(*\right) + \frac{2x}{a}\sin\left(*\right) + \frac{4x}{a^3}\sin\left(*\right) - \frac{4}{a}\cos\left(*\right)\,dx\\ G'(a) &= 2\cos(2a) -\frac{2}{a}\sin(2a)\\ &\quad + \int_0^a \left(\frac{2x^2}{a^3}-\frac{4}{a}\right)\cos\left(x+\frac{a^2}{x}\right) + \left(\frac{2x}{a} + \frac{4x}{a^3}\right)\sin\left(x+\frac{a^2}{x}\right)\,dx\end{align*} And now... we'd like to differentiate again, but one of the terms doesn't have any powers of $x$ to cushion it, and differentiating it will break absolute convergence. Separate it out and integrate by parts again: \begin{align*}\int_0^a \frac{x^2}{a^3}\left(1-\frac{a^2}{x^2}\right)\cos\left(x+\frac{a^2}{x}\right)\,dx &= \left[\frac{x^2}{a^3}\sin\left(x+\frac{a^2}{x}\right)\right]_{x=0}^{x=a} - \int_0^a \frac{2x}{a^3}\sin\left(x+\frac{a^2}{x}\right)\,dx\\ &= \frac{1}{a}\sin(2a) - \int_0^a \frac{2x}{a^3}\sin\left(x+\frac{a^2}{x}\right)\,dx\end{align*} Multiply by $4$ and add/subtract, to clear the $\frac{4}{a}\cos(*)$ term: \begin{align*} G'(a) &= 2\cos(2a) + \frac{2}{a}\sin(2a) + \int_0^a -\frac{2x^2}{a^3}\cos\left(x+\frac{a^2}{x}\right) + \left(\frac{2x}{a} - \frac{4x}{a^3}\right)\sin\left(x+\frac{a^2}{x}\right)\,dx\\ G'(a) &= 2\cos(2a) - \frac1a\sin(2a) + \frac2a G(a) + \int_0^a \frac{2x}{a}\sin\left(x+\frac{a^2}{x}\right)\,dx\\ G''(a) &= -4\sin(2a) - \frac2a\cos(2a) + \frac1{a^2}\sin(2a) -\frac2{a^2} G(a) + \frac2a G'(a) + 2\sin(2a)\\ &\quad + \int_0^a 4\cos(*) - \frac{2x}{a^2}\sin(*)\,dx\\ G''(a) &= -2\sin(2a) + \frac1{a^2}\sin(2a) - \frac2a\cos(2a) -\frac2{a^2} G(a) + \frac2a G'(a)\\ &\quad + \int_0^a 4\cos(*) - \frac{2x}{a^2}\sin(*)\,dx\end{align*} Now, we deal with those integrals. From an integration by parts earlier, $\int_0^a (x^2-a^2)\cos(*) + 2x\sin(*)\,dx = a^2\sin(2a)$. From our expression for $G$, $\int_0^a x^2\cos(*) + 2x\sin(*) = \frac{3a^2}{2}\sin(2a)-a^2 G(a)$. Subtract the two, divide by $a^2$, and $\int_0^a \cos(*)\,dx = \frac12\sin(2a) - G(a)$. Similarly, from our latest expression for $G'$, $\int_0^a x\sin(*)\,dx = \frac{a}{2}G'(a) - G(a) - a\cos(2a) + \frac12\sin(2a)$. Apply these to the formula for $G''$, and \begin{align*}G''(a) &= -2\sin(2a) + \frac1{a^2}\sin(2a) - \frac2a\cos(2a) - \frac2{a^2}G(a) + \frac2{a}G'(a) +\\ &\quad 2\sin(2a) - 4 G(a) - \frac1a G'(a) + \frac2{a^2}G(a) + \frac2a\cos(2a) - \frac1{a^2}\sin(2a)\\ G''(a) &= \frac1{a}G'(a) - 4 G(a) \end{align*} This almost looks like a stretched Bessel equation of order zero - but the middle term has the wrong sign, and that's not something we can change by just flipping the sign of $x$ or something. No, the way to change that middle term is to multiply the function by powers of $x$. Combining with that stretch, let $H(t)=\frac1t G\left(\frac{t}{2}\right)$. Then $H'(t)=\frac{1}{2t}G'\left(\frac{t}{2}\right)-\frac1{t^2}G\left(\frac{t}{2}\right)$, $H''(t)=\frac{1}{4t}G''\left(\frac{t}{2}\right)-\frac1{t^2}G'\left(\frac{t}{2}\right)+\frac{2}{t^3}G\left(\frac{t}{2}\right)$, and \begin{align*}t^2 H''(t) + t H(t) + (t^2-1)H(t) &= \frac{t}{4}G''\left(\frac{t}{2}\right)-G'\left(\frac{t}{2}\right)+\frac2t G\left(\frac{t}{2}\right) + \frac12G'\left(\frac{t}{2}\right)\\ &\quad - \frac1t G\left(\frac{t}{2}\right) + t G\left(\frac{t}{2}\right) - \frac1t G\left(\frac{t}{2}\right)\\ &= \frac{t}{4}G''\left(\frac{t}{2}\right) - \frac12 G'\left(\frac{t}{2}\right) + tG\left(\frac{t}{2}\right)\\ &\stackrel{s=t/2}{=} \frac{s}{2}\left(G''(s) -\frac1s G'(s) + 4 G(s)\right) = 0\end{align*} That equation for $H(t)$ is the Bessel equation of order $1$.
Now, we still need an initial condition. What is $G(0)$? Well, our equation degenerates there in several ways, but we can take a limit: \begin{align*}\lim_{a\to 0^+}G(a) &= \lim_{a\to 0^+}\frac32\sin(2a) -\lim_{a\to 0^+}\int_0^a \frac{x^2}{a^2}\cos\left(x+\frac{a^2}{x}\right) + \frac{2x}{a^2}\sin\left(x+\frac{a^2}{x}\right)\,dx\\ &= 0 - \lim_{a\to 0^+}\int_0^1 \left(t^2\cos\left(at+\frac{a}{t}\right) + \frac{2t}{a}\sin\left(at+\frac{a}{t}\right)\right)\cdot a\,dt = 0\end{align*} The first part of that integral is bounded by $at^2$, which tends to zero uniformly. For the second part, we use $|\sin(x)|\le |x|$; it's bounded by $2at^2 + 2a$, which also goes to zero uniformly. But that's not enough - we're going to divide by $x$ at least once. We go one step stronger, and look at $\lim_{a\to 0^+}\frac1a G(a)$. The $\sin$ term gets us $3$. In the integral term, the integrand tends to $t^2\cos(0) + 2t^2+2$ pointwise; by dominated convergence (using the same estimates as before), $\lim_{a\to 0^+}\frac1a G(a) = 3 - 3 = 0$. That... well, that tells us $H$ is a multiple of the standard Bessel function $J_1$. We need to go another degree higher to find what multiple. For that, the expression we're working with isn't terribly convenient, so we go back to a much earlier one: \begin{align*}G(a) &= \int_0^a \left(1+\frac{a^2}{x^2}\right)\sin(x)\sin\left(\frac{a^2}{x}\right)\,dx\\ \frac1{a^2}G(a) &= \int_0^1 \left(\frac1{a^2}+\frac1{a^2t^2}\right)\sin(at)\sin\frac{a}{t}\cdot a\,dt\\ \frac1{a^2}G(a) &\approx \int_0^1 \frac{t^2+1}{at^2}\cdot at\cdot \sin\frac{a}{t}\,dt\\ \frac1{a^2}G(a) &\approx \int_0^1 \left(t+\frac1t\right)\sin\frac{a}{t}\,dt\end{align*} As $a\to 0^+$, that last form of the integrand tends to zero. The $t\sin\frac{a}{t}$ term tends to zero uniformly, while the other term is large enough to matter at zero. Now, we substitute: \begin{align*}\frac1{a^2}G(a) &\approx \int_0^1 \frac1t\sin\frac{a}{t}\,dt\\ &\,^{t=\tfrac{a}{x}}_{dt=-\tfrac{a}{x^2}\,dx}\\ \frac1{a^2}G(a) &\approx \int_{\infty}^{a} -\frac{x}{a}\sin(x)\cdot\frac{a}{x^2}\,dx\\ \frac1{a^2}G(a) &\approx \int_a^{\infty} \frac{\sin x}{x}\,dx = \frac{\pi}{2}\end{align*} That's our limit - $\lim_{a\to 0^+} \frac1{a^2}G(a)=\frac{\pi}{2}$. For normalization, note that $J_1(t)\approx \frac{t}{2}$ for $t$ near zero. Then $H(2a)\approx \frac1{2a}G(a) \approx \frac{\pi}{4}a$, and thus $H(2a)=\frac{\pi}{4}J_1(2a)$. Converting back to $G$, $G(a) = 2a H(2a) = \frac{\pi a}{2}J_1(2a)$. The original question asked was $G(1)$, for an integral of $\frac{\pi}{2} J_1(2)$. The answer is confirmed... and it only took me most of a day to get there.
Doing it a second time? It took longer to find the old post than to reedit it for this site's formatting.
Maple gets the answer $$ \frac{\pi}{2} J_1(2) $$ where $J_1$ is the Bessel function of first order. It says it used the "meijerg" method.
Consider $$F(a,b) = \int_0^{\infty}\sin(ax)\sin\left(\frac{b}{x}\right)\,dx$$
Now, the Laplace transform of $F$ as a function of $b$,
$$\mathcal{L}(F)=\int_0^{\infty}\frac{x\sin(ax)}{1+s^2x^2}dx=\frac{\pi}{2}\frac{e^{-\frac{a}{s}}}{s^2}$$
The last integral is computed in this site many times.
Finally, to invert the Laplace transform to recover $F(a,b)$ we use the inspection method.
That means that we'll look at the table Laplace transform pairs.
In this case we have good luck,
$$F(a,b) =\frac{\pi}{2}\sqrt\frac{b}{a}J_1(2\sqrt{ab})$$
where $J_1(x)$ is the Bessel Function of the First Kind