Evaluating the improper integral $\int_0^\infty \frac{x\cos x-\sin x}{x^3} \cos(\frac{x}{2}) \mathrm dx $ I've been working through the following integral and am stumped:
$$\int_0^\infty \frac{x\cos x-\sin x}{x^3}\cos\left(\frac{x}{2}\right)\mathrm dx$$
Given the questions in my class that have proceeded and followed this integral, I believe that this is some form of Fourier transform/integral. However, it doesn't look like any of the content surrounding it. That is, there is no $e^{-ikx}$ or $g(k)$ or anything else that I'm familiar with. 
I know that it's an even function, but that's about as far as I can get. If I try to split it over the subtraction, I get two non-converging integrals, so that wasn't much help either. I've been throwing lots of trig identities at it but nothing familiar has appeared yet.
Any help would be greatly appreciated.
Thank you.
 A: $$
\begin{align}
&\int_0^\infty\frac{x\cos(x)-\sin(x)}{x^3}\cos\left(\frac{x}{2}\right)\,\mathrm{d}x\tag{1}\\
&=\int_0^\infty\frac{x\left(\cos\left(\frac32x\right)+\cos\left(\frac12x\right)\right)-\left(\sin\left(\frac32x\right)+\sin\left(\frac12x\right)\right)}{2x^3}\,\mathrm{d}x\tag{2}\\
&=-\int_0^\infty\frac{x\left(\cos\left(\tfrac32x\right)+\cos\left(\tfrac12x\right)\right)-\left(\sin\left(\tfrac32x\right)+\sin\left(\tfrac12x\right)\right)}{4}\,\mathrm{d}x^{-2}\tag{3}\\
&=\int_0^\infty\frac{\left(\frac12\cos\left(\frac12x\right)-\frac12\cos\left(\frac32x\right)\right)-x\left(\frac32\sin\left(\frac32x\right)+\frac12\sin\left(\frac12x\right)\right)}{4x^2}\,\mathrm{d}x\tag{4}\\
&=\int_0^\infty\left(\frac{1-\cos\left(\frac32x\right)}{8x^2}-\frac{1-\cos\left(\frac12x\right)}{8x^2}-\frac{3\sin\left(\frac32x\right)}{8x}-\frac{\sin\left(\frac12x\right)}{8x}\right)\mathrm{d}x
\tag{5}\\
&=\int_0^\infty\left(\frac{3(1-\cos(x))}{16x^2}-\frac{1-\cos(x)}{16x^2}-\frac{3\sin(x)}{8x}-\frac{\sin(x)}{8x}\right)\mathrm{d}x
\tag{6}\\
&=\int_0^\infty\left(\frac{3\sin(x)}{16x}-\frac{\sin(x)}{16x}-\frac{3\sin(x)}{8x}-\frac{\sin(x)}{8x}\right)\mathrm{d}x
\tag{7}\\
&=-\frac38\int_0^\infty\frac{\sin(x)}{x}\,\mathrm{d}x\tag{8}\\
&=-\frac{3\pi}{16}\tag{9}
\end{align}
$$
Explanation:
$(2)$: trigonometric product formulas
$(3)$: prepare to integrate by parts
$(4)$: integrate by parts
$(5)$: separate integrals
$(6)$: substitute $x\mapsto2x$ and $x\mapsto\frac23x$
$(7)$: integrate by parts
$(8)$: combine
$(9)$: $\int_0^\infty\frac{\sin(x)}{x}\,\mathrm{d}x=\frac\pi2$
A: We can also use contour integration.
$$ \begin{align} &\int_{0}^{\infty} \frac{x \cos x - \sin x}{x^{3}} \, \cos \left(\frac{x}{2} \right) \, dx \\ &= \frac{1}{2} \int_{-\infty}^{\infty} \frac{x \left(\frac{e^{ix}+e^{-ix}}{2} \right) -\frac{e^{ix}-e^{-ix}}{2i}}{x^{3}} \left(\frac{e^{ix/2}+e^{-ix/2}}{2} \right) \, dx \\ &=  \frac{1}{2} \lim_{\epsilon \to 0^{+}} \int_{-\infty}^{\infty} \frac{x \left(\frac{e^{ix}+e^{-ix}}{2} \right) -\frac{e^{ix}-e^{-ix}}{2i}}{(x- i \epsilon)^{3}} \left(\frac{e^{ix/2}+e^{-ix/2}}{2} \right) \, dx \\ &= \frac{1}{8} \lim_{\epsilon \to 0^{+}} \int_{-\infty}^{\infty}\frac{(x+i)(e^{3ix/2}+e^{ix/2})}{(x- i\epsilon)^{3}} \, dx + \frac{1}{8} \lim_{\epsilon \to 0^{+}} \int_{-\infty}^{\infty} \frac{(x-i)(e^{-ix/2}+e^{-3ix/2})}{(x- i\epsilon)^{3}} \, dx  \\ &=\frac{1}{8} \lim_{\epsilon \to 0^{+}} 2 \pi i \,  \text{Res} \left[\frac{(z+i)(e^{3iz/2}+e^{iz/2})}{(z- i \epsilon)^{3}} , i\epsilon  \right] + 0 \tag{1} \\ &= \frac{1}{8} \lim_{\epsilon \to 0^{+}} \, 2 \pi i \, \frac{1}{2!} \lim_{z \to i \epsilon}\frac{d^{2}}{dz^{2}} \,  (z+i)(e^{3iz/2}+e^{iz/2}) \\ &= \frac{1}{8} \lim_{\epsilon \to 0^{+}} \frac{\pi}{4} \,  e^{-3 \epsilon/2} \left((\epsilon-3) e^{\epsilon} + 9 \epsilon -3 \right) \\ &= - \frac{3 \pi}{16} \end{align}$$

$(1)$ The second integral vanishes since the function $ \displaystyle \frac{(z-i)(e^{-iz/2}+e^{-3iz/2})}{(z- i\epsilon)^{3}} $ is analytic in the lower half-plane where $\left| e^{iaz} \right| \le 1$ if $a \le 0$.
A: Inspired by Felix Marin's calculation using integration by parts.
Observe
\begin{align}
\int^\infty_0 \frac{x\cos x-\sin x}{x^3}\cos\frac{x}{2}\ dx=&\ \frac{1}{2}\int^\infty_{-\infty} \frac{x\cos x-\sin x}{x^3}e^{ix/2}\ dx\\
=&\ \frac{-1}{4} \int^\infty_{-\infty} [x\cos x-\sin x] e^{ix/2}\ d\left(\frac{1}{x^2} \right). 
\end{align}
Using integration by parts, we have
\begin{align}
\frac{-1}{4} \int^\infty_{-\infty} [x\cos x-\sin x] e^{ix/2}\ d\left(\frac{1}{x^2} \right)=&\   \frac{1}{4} \int^\infty_{-\infty}d([x\cos x-\sin x]e^{ix/2}) \frac{1}{x^2}\\
=&\ \frac{-1}{4} \int^\infty_{-\infty}\frac{\sin x}{x}e^{ix/2}\ dx + \frac{i}{8} \int^\infty_{-\infty} \frac{x\cos x-\sin x}{x^2}e^{ix/2}\ dx.
\end{align}
Now, observe
\begin{align}
\int^\infty_{-\infty}\frac{\sin x}{x}e^{ix/2}\ dx = \mathcal{F}^{-1}\left[\operatorname{sinc\left(\frac{x}{\pi}\right)}\right]\left(\frac{1}{2}\right) = \pi \mathcal{F}^{-1}[\operatorname{sinc}]\left( \frac{1}{2\pi}\right) = \pi. 
\end{align}
Next, observe
\begin{align}
\int^\infty_{-\infty} \frac{x\cos x-\sin x}{x^2} e^{ix/2}\ dx =&\ \int^\infty_{-\infty} \frac{d}{dx}\left( \frac{\sin x}{x}\right) e^{ix/2}\ dx\\
=&\ -\frac{i}{2}\int^\infty_{-\infty}\frac{\sin x}{x} e^{ix/2}\ dx = -\frac{i\pi}{2}. 
\end{align}
Hence combining everything yields
\begin{align}
\int^\infty_0 \frac{x\cos x-\sin x}{x^3} \cos \frac{x}{2}\ dx = -\frac{\pi}{4} + \frac{\pi}{16} = -\frac{3\pi}{16}.
\end{align}
A: Integration by parts can be performed for the indefinite integral, using relations

$$\dfrac{x\cos x-\sin x}{x^2} = \left(\dfrac{\sin x}{x}\right)',\quad
 \sin^3 z =\frac{3\sin z-\sin3z}4,\quad \cos^3z=\frac{3\cos
 z+\cos3z}4.$$

One can get
\begin{align}
&\int \dfrac{x\cos x-\sin x}{x^3}\,\cos\dfrac x2\, \mathrm dx 
= \int\dfrac1{4\sin \frac x2}\,\mathrm d\left(\dfrac{\sin x}{x}\right)^2  \\[4pt]
&=\dfrac1{4\sin \frac x2}\left(\dfrac{\sin x}{x}\right)^2
+\int\left(\dfrac{\sin x}{x}\right)^2\dfrac{\cos\frac x2}{8\sin^2 \frac x2}\,\mathrm dx
=\dfrac1{x^2}\sin\frac x2\,\cos^2 \frac x2
+\dfrac12\int\dfrac{\cos^3\frac x2}{x^2}\,\mathrm dx\\[4pt]
&=\dfrac1{x^2}\sin\frac x2
-\dfrac1{4x^2}\left(3\sin\frac x2-\sin \frac {3x}2\right)
+\dfrac18\int\dfrac{3\cos\frac x2+\cos\frac{3x}2}{x^2}\,\mathrm dx\\[4pt]
&=\dfrac1{4x^2}\left(\sin\frac x2+\sin \frac {3x}2\right)
-\dfrac18\int\left(3\cos\frac x2+\cos\frac{3x}2\right)\,\mathrm d\frac1x\\[4pt]
&=\dfrac1{8x^2}\left(2\sin\frac x2+2\sin\frac{3x}2-3x\cos\frac {x}2-x\cos \frac {3x}2\right)
-\dfrac3{16}\int\frac1x\left(\sin\frac x2+\sin\frac{3x}2\right)\,\mathrm dx.
\end{align}
Since
$$\lim\limits_{x\to0}\dfrac{2\sin\frac x2+2\sin\frac{3x}2-3x\cos\frac {x}2-x\cos\frac {3x}2}{8x^2}
= \lim\limits_{x\to0}\dfrac{2\frac x2+2\frac{3x}2-3x-x+O(x^3)}{8x^2}=0,$$

$$\int\limits_{0}^{\infty} \dfrac{\sin x}x\,\mathrm dx =\frac\pi2,$$

then
$$\int\limits_{0}^{\infty} \dfrac{x\cos x-\sin x}{x^3}\,\cos\dfrac x2\, \mathrm dx
=-\frac3{16}\left(\int\limits_{0}^{\infty} \dfrac{\sin\frac x2}{\frac x2}\,\mathrm d\frac x2+\int\limits_{0}^{\infty} \dfrac{\sin \frac{3x}2}{\frac{3x}2}\,\mathrm d\frac{3x}2\right) = \color{green}{\mathbf{-\frac{3\pi}{16}}}.$$
A: I use the Laplace transform method instead of Fourier because the first one is the main tool for an electrician (who I am) and the Laplace transform is very similar to the Fourier transform. 
By definition of the Laplace transform:
$\mathcal{L}f(x)=\int_{0}^{\infty}e^{-sx}f(x)dx=F(s)$
$\mathcal{L}g(x)=\int_{0}^{\infty}e^{-sx}g(x)dx=G(s)$
Now we use the  following equation from the Laplace transform theory:
$$\int_{0}^{\infty}F(x)g(x)dx=\int_{0}^{\infty}G(x)f(x)dx$$
and apply it to the required integral.
We take 
$F(x)=\frac{1}{x^3}$
$g(x)=x\cos x\cos \frac{x}{2}-\sin x\cos \frac{x}{2}$
and get after taking the Laplace and inverse Laplace transforms
$f(x)=\frac{x^2}{2}$
$G(x)=\frac{4x^2-3}{(4x^2+1)^2}-\frac{4x^2+45}{(4x^2+9)^2}$
Placing these results into the relationship above we arrive at the next expression for the required integral:
$$I=\frac{1}{2}\int_{0}^{\infty}x^2\left [ \frac{4x^2-3}{(4x^2+1)^2}-\frac{4x^2+45}{(4x^2+9)^2} \right ]dx$$ 
$I=\left [- \frac{3}{16}\arctan 2x- \frac{3}{16}\arctan\frac{2x}{3}+\frac{9x}{4(4x^2+9)^2}+\frac{x}{4(4x^2+1)^2}\right ]_{0}^{\infty}=$
$=- \frac{3}{16}\frac{\pi}{2}- \frac{3}{16}\frac{\pi}{2}=- \frac{3\pi}{16}$
A: Simple attempt:
$$let\ \   f(x)=\left\{\begin{matrix}
 &  1-x^{2}\ \ \ ,\  |x|< 1& \\ 
 & 0\ \ \ \ \ \ \ \ \ \ , \ \  |x|> 1 & 
\end{matrix}\right
\\$$
by  fouier transform of f(x)  we have  :
$$F(a)=\int_{0}^{\infty }f(t).cos(at)dt=\int_{0}^{1}\ (1-t^{2}).cos(at)\ dt=\int_{0}^{1}cos(at)dt-\int_{0}^{1}t^{2}cos(at)dt$$
$$\therefore F(a)=\frac{sin(a)}{a}-\frac{2acos(a)+(a^{2}-2).sin(a)}{a^{3}}=-\frac{2acos(a)-2sin(a)}{a^{3}}$$
$$\therefore f(a)=1-a^{2}=\frac{2}{\pi }\int_{0}^{\infty }F(x).cos(ax)\ dx=-\frac{4}{\pi }\int_{0}^{\infty }\frac{xcos(x)-sin(x)}{x^{3}}.\ cos(ax)dx$$
Now let put a=1/2   then  we have
$$putting\ a=\frac{1}{2}\ \ \ \Rightarrow \int_{0}^{\infty }\frac{xcos(x)-sin(x)}{x^{3}}.cos\left ( \frac{x}{2} \right )dx\ =\frac{-3\pi }{16}$$
A: This is very old exercise has been evaluated by applying MAZ Identity 

