Why must $r$ be put in modulus for $\int^{\infty}_0\frac{1-\cos(rx)}{x^2}dx=\frac{\pi}{2}|r|$? Here's the question: Prove that $$\int^{\infty}_0\frac{1-\cos(rx)}{x^2}~\mathrm dx=\frac{\pi}{2}|r|·$$
When I finished my working, I got $\frac{\pi}{2}r$
Why is the $r$ put in modulus? Is it because the graph lies entirely above the x axis? 
 A: Integrating by part:
$$
\int_0^{+\infty} \frac {1-\cos(rx)}{x^2}\, \mathrm dx = \int_{+\infty}^0 (1 - \cos(rx)) \mathrm d \frac 1 x =\left. \frac {1-\cos(rx)}x \right\vert_{+\infty}^0  - r\int_{+\infty}^0 \frac {\sin(rx)}x\, \mathrm dx = r \int_0^{+\infty} \frac {\sin(rx)}x \,\mathrm dx. 
$$
Now 
$$
\DeclareMathOperator\sgn{sgn}
\int_0^{+\infty} \frac {\sin(rx)}x \,\mathrm dx =\int_0^{+\infty} \frac {\sin(rx)}{rx}\,\mathrm d(rx)=
\begin{cases}\displaystyle
\int_0^{+\infty} \frac {\sin u}u\, \mathrm du, & r > 0,\\
0, & r=0,\\ \displaystyle 
\int_{-\infty}^0 \frac {\sin u}u\, \mathrm du, & r < 0,
\end{cases}
= \sgn r \cdot \int_0^{+\infty} \frac {\sin u}u\, \mathrm du = \sgn r \cdot \frac \pi 2,
$$
hence the integral equals
$$
r \sgn r \cdot \frac \pi 2 = \frac \pi 2 \vert r \vert. 
$$
The implicit assumption could be $r>0$ when dealing the integral $\int_0^{+\infty} \sin(rx)\,\mathrm dx /x$. 
A: The other answers explain how you get $|r|$ in your answer, but here’s why it should happen:
Notice that $1-\cos(rx) \geq 0$ for all $x$, regardless of what $r$ is. Integrating a nonnegative function over any interval should give you a nonnegative value. 
