values of convergence for an improper integral For which values of $p$ does the following integral converges / diverges:
$$ \int_0^{\infty} \frac{1-\cos x}{x^p} $$
Have tried using the limit test after splitting the integral into two integrals but got stuck.
Thanks.
 A: For $p>1$ it the integral from $1$ to $\infty$ does converge. To see this, you can simply bound the integrand by $2/x^p$. For $p\leq 1$ the integral from $1$ to $\infty $ diverges. To see this, note that
$$ \int_1^{\infty} \frac{1-\cos x}{x^p} dx \geq \sum_{k=1}^\infty \int_{k\pi}^{(k+1)\pi} \frac{1-\cos x}{x^p} dx \geq C \sum_{k=1}^\infty \frac{1}{(k+1)^p} =\infty$$
Here the constant $C$ incorporates the integral $\int_{k\pi}^{(k+1)\pi} (1-\cos x) dx $ which is bounded below, independent of $k$.
Now, we focus on $\int_0^1 \frac{1-\cos x}{x^p}dx$. Note that $1-\cos x= x^2/2 +O(x^4)$ near $0$. Thus, if $p<3$, then the integral converges, since 
$$\int_0^1 \frac{x^2}{x^p}dx<\infty$$
If $p\geq 3$, then we let $n$ be the smallest integer such that $2n+3>p$. We write
$$1-\cos x= x^2/2 -x^4/4! +\dots + (-1)^{n+1}x^{2n}/(2n)! + O(x^{2n+2})$$
Thus the integral converges if and only if the integral
$$\int_0^1  (x^{2-p}/2 -x^{4-p}/4! +\dots + (-1)^{n+1}x^{2n-p}/(2n)! )dx$$
converges.
Since $2n+2\leq p$, for sufficiently small $x$, the largest term above is $x^{2-p}$, and its integral dominates all the others (requires some justification). Since $\int_0^1 x^{2-p}dx=\infty$, it follows that the original integral diverges for $p\geq 3$. 
