I was trying to prove
$$\left|\int_{0}^{a}{\frac{1-\cos{x}}{x^2}}dx-\frac{\pi}{2}\right|\leq \frac{3}{a}$$ or $\leq \frac{2}{a}$. My work: I would like to use Fubini's theorem to prove it.
I notice that $\frac{1}{x^2}=\int^{\infty}_{0}{ue^{-xu}}du$.
Then, I got $\int_{0}^{a}{\frac{1-\cos{x}}{x^2}}dx=\int_{0}^{\infty}u\int_{0}^{a}{(1-\cos{x})e^{-xu}}dxdu$.
Then, I got $\int_{0}^{a}{(1-\cos{x})e^{-xu}}dx=-e^{-au}u+\frac{1}{u+u^3}+e^{-au}\frac{u^2\cos{a}-u\sin{a}}{u+u^3}$.
Then, $\int_{0}^{a}{\frac{1-\cos{x}}{x^2}}dx=\int_0^{\infty}u(\frac{e^{au}-1}{u}+\frac{u-e^{au}(u\cos{a}+\sin{a})}{1+u^2})du\\=\int_0^{\infty}({e^{au}+\frac{-ue^{au}(u\cos{a}+\sin{a}-2)}{1+u^2}})du+\frac{\pi}{2}.$
I was trying to show $|\int_0^{\infty}({e^{au}+\frac{-ue^{au}(u\cos{a}+\sin{a}-2)}{1+u^2}})du|\leq\frac{3}{a}$ or $\frac{2}{a}$.
But I do not have a clue. Can some give me hints?
There appears to be a minor mistake in your computation. We have: $$\begin{align*} \int_0^a \frac{1-\cos(x)}{x^2}dx&=\int_0^a(1-\cos x)\int_0^\infty u e^{-xu}\,du\,dx\\ &=\int_0^\infty u\int_0^a (1-\cos x)e^{-xu}dx\,du\\ &=\int_0^\infty (1-e^{-au})-\frac{u^2}{1+u^2}+\frac{u^2\cos a-u\sin a}{1+u^2}\\ &=\int_0^\infty e^{-au}\left(-1+\frac{u^2\cos a-u\sin a}{1+u^2}\right)du+\int_0^\infty\frac{1}{1+u^2}du\\ &=\int_0^\infty e^{-au}\left(-1+\frac{u^2\cos a-u\sin a}{1+u^2}\right)du+\frac{\pi}{2}. \end{align*} $$ To complete your proof, you need to show that $$ \left|\int_0^\infty e^{-au}\left(-1+\frac{u^2\cos(a)-u\sin(a)}{1+u^2}\right)du\right|\leq \frac{2}{a}. $$ Now $\int_0^\infty e^{-au}\,du=1/a$, so it will suffice to check that $$ \left|\frac{u^2\cos(a)-u\sin(a)}{1+u^2}\right|\leq 1. $$ The numerator above is the dot prodcut of $(u^2,u)$ and $(\cos(a),-\sin(a))$, so the Cauchy-Schwarz inequality implies $$ |u^2\cos(a)-u\sin(a)|\leq u \sqrt{1+u^2}\leq 1+u^2. $$