Does the integral converge? $$\int_0^{\infty} \frac{\cos(x+1/x)}{\vert \ln (x) \vert ^p}\,dx, ~p \in \mathbb{R}$$
I tried to change $t=x+1/x$, but it get worse. I have no idea how to start.
 A: Since the integrand has singularities at $x=0$ and $x=1$, and also $\infty$ is the upper endpoint, we must split the integral into four pieces and examine the convergence of each one separately:
$$
\int_0^\infty = \int_0^{1/2} + \int_{1/2}^1 + \int_1^2 + \int_2^\infty.
$$
First we examine the $\int_2^\infty$ part. Rule of thumb: if we expect an integral of a product to converge because of the oscillations of one of the factors, then integrate by parts, integrating the oscillating factor. Here, a slick way is to write
$$
f(x) = \bigg( 1 - \frac1{x^2} \bigg) \cos \bigg(x+\frac1x\bigg) \quad\text{and}\quad g(x) = \bigg( 1 - \frac1{x^2} \bigg)^{-1} \frac1{(\log x)^p},
$$
so that $\int f(x)\,dx = \sin(x+\frac1x)+C$.
Then
\begin{align*}
\int_2^\infty \frac{\cos(x+1/x)}{(\log x)^p} \,dx &= \int_2^\infty f(x)g(x)\,dx \\
&= \sin\bigg(x+\frac1x\bigg) g(x) \bigg|_2^\infty - \int_2^\infty \sin\bigg(x+\frac1x\bigg) g'(x) \,dx.
\end{align*}
The boundary term converges as long as $p>0$, while the remaining integral satisfies
$$
\bigg| \int_2^\infty \sin\bigg(x+\frac1x\bigg) g'(x) \,dx \bigg| \le \int_2^\infty |g'(x)| \,dx = \int_2^\infty (-g'(x)) \,dx = g(2),
$$
since (as one can check) $g$ decreases to $0$ for $x\ge2$ when $p>0$. In short, this piece converges when $p>0$.
Next, for the $\int_1^2$ part, the bounds $-1\le \cos(x+\frac1x) \le-\frac13$ and $\frac12(x-1) \le \log x \le x-1$ suffice to show that this piece converges when $p<1$ and diverges otherwise. A similar proof works for the $\int_{1/2}^1$ part.
Finally, for the $\int_0^{1/2}$ part, we make the change of variables $y=\frac1x$ to get
$$
\int_0^{1/2} \frac{\cos(x+1/x)}{|\log x|^p} \,dx = \int_2^\infty \frac{\cos(y+1/y)}{(\log y)^p} \frac{dy}{y^2},
$$
and this integral converges absolutely for any $p\in\Bbb R$.
In summary, the integral definitely converges when $0<p<1$, and definitely diverges (at the singularity at $x=1$) when $p\ge1$ (unless you're considering Cauchy principal values or something more advanced than Riemann integrability).
(Note that technically, we didn't yet show that the integral diverges at the upper endpoint $\infty$ when $p\le0$!)
