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.

• @Tyler6 : You can use $\displaystyle\int\frac{x\cos x - \sin x}{x^3}\cos\frac{x}{2}dx = -\frac{3}{16}\left( \int\limits_0^{x/2}\frac{\sin x}{x} + \int\limits_0^{3x/2}\frac{\sin x}{x} \right) -\frac{\cos^2\frac{x}{2}}{x^2}\left(\frac{x}{2}\cos\frac{x}{2} - \sin\frac{x}{2}\right) + C$ $~~$ Why Fourier Transforms ? – user90369 Mar 13 at 11:46

6 Answers

$\newcommand{\bbx}[1]{\,\bbox[8px,border:1px groove navy]{{#1}}\,} \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack} \newcommand{\dd}{\mathrm{d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,} \newcommand{\ic}{\mathrm{i}} \newcommand{\mc}[1]{\mathcal{#1}} \newcommand{\mrm}[1]{\mathrm{#1}} \newcommand{\pars}[1]{\left(\,{#1}\,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,} \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}} \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$ \begin{align} &\int_{0}^{\infty}{x\cos\pars{x} - \sin\pars{x} \over x^{3}}\, \cos\pars{x \over 2}\,\dd x = \int_{0}^{\infty}{x\bracks{1 - 2\sin^{2}\pars{x/2}} - \sin\pars{x} \over x^{3}}\,\cos\pars{x \over 2}\,\dd x \\[5mm] & = {1 \over 2}\int_{0}^{\infty}{2x\cos\pars{x/2} - 2x\sin\pars{x}\sin\pars{x/2} - 2\sin\pars{x}\cos\pars{x/2} \over x^{3}}\,\,\,\dd x \\[5mm] & = {1 \over 2}\int_{0}^{\infty}{x\cos\pars{x/2} + x\cos\pars{3x/2} - \sin\pars{3x/2} - \sin\pars{x/2} \over x^{3}}\,\,\,\dd x \\[1cm] & = -\,{1 \over 2}\int_{0}^{\infty}{1 - \cos\pars{x/2} \over x^{2}}\,\dd x - {1 \over 2}\int_{0}^{\infty}{1 - \cos\pars{3x/2} \over x^{2}}\,\dd x \\[5mm] & - {1 \over 4}\int_{x\ =\ 0}^{x\ \to\ \infty}\bracks{2x - \sin\pars{3x/2} - \sin\pars{x/2}}\,\dd\pars{1 \over x^{2}} \end{align}

Integrating by parts the last integral: \begin{align} &\int_{0}^{\infty}{x\cos\pars{x} - \sin\pars{x} \over x^{3}}\, \cos\pars{x \over 2}\,\dd x = \\[5mm] & = -\,{1 \over 2}\int_{0}^{\infty}{1 - \cos\pars{x/2} \over x^{2}}\,\dd x - {1 \over 2}\int_{0}^{\infty}{1 - \cos\pars{3x/2} \over x^{2}}\,\dd x \\[5mm] & + {1 \over 4}\int_{x = 0}^{\infty}{2 - 3\cos\pars{3x/2}/2 - \cos\pars{x/2}/2 \over x^{2}}\,\dd x \\[1cm] & = -\,{1 \over 2}\int_{0}^{\infty}{1 - \cos\pars{x/2} \over x^{2}}\,\dd x - {1 \over 2}\int_{0}^{\infty}{1 - \cos\pars{3x/2} \over x^{2}}\,\dd x \\[5mm] & + {3 \over 8}\int_{0}^{\infty}{1 - \cos\pars{3x/2} \over x^{2}}\,\dd x + {1 \over 8}\int_{0}^{\infty}{1 - \cos\pars{x/2} \over x^{2}}\,\dd x \\[1cm] & = -\,{3 \over 8}\int_{0}^{\infty}{1 - \cos\pars{x/2} \over x^{2}}\,\dd x -\,{1 \over 8}\int_{0}^{\infty}{1 - \cos\pars{3x/2} \over x^{2}}\,\dd x \\[5mm] & = -\,{3 \over 16}\int_{0}^{\infty}{1 - \cos\pars{x} \over x^{2}}\,\dd x -\,{3 \over 16}\int_{0}^{\infty}{1 - \cos\pars{x} \over x^{2}}\,\dd x = -\,{3 \over 8}\ \int_{0}^{\infty}{1 - \cos\pars{x} \over x^{2}}\,\dd x \\[5mm] & = -\,{3 \over 4}\int_{0}^{\infty}{\sin^{2}\pars{x/2} \over x^{2}}\,\dd x = -\,{3 \over 8}\ \underbrace{\int_{0}^{\infty}{\sin^{2}\pars{x} \over x^{2}}\,\dd x} _{\ds{=\ {\pi \over 2}}}\ = \ \bbox[#ffe,10px,border:1px dotted navy]{\ds{-\,{3 \over 16}\,\pi}} \end{align}

By integrating by parts: $\ds{\int_{0}^{\infty}{\sin^{2}\pars{x} \over x^{2}}\,\dd x = \int_{0}^{\infty}{\sin\pars{x} \over x}\,\dd x = {1 \over 2}\,\pi}$.

\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$

• I see that this may be similar to Felix Marin's answer, but I think the path may be different enough, and possibly simpler, to warrant leaving it. – robjohn Oct 29 '16 at 13:53

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$.

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}

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}}}.$$

• elegant approach – G Cab Mar 15 at 22:53
• @GCab Thanks. I tried to understand the essence of the problem. – Yuri Negometyanov Mar 15 at 23:06
• – Yuri Negometyanov Apr 30 at 16:04

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}$$