Prove that the integral $\int_{1}^{\infty} \frac{\cos(x)}{\sqrt{x}}\, \mathrm dx$ converges conditionally

Prove that the integral $$\int_{1}^{\infty} \frac{\cos(x)}{\sqrt{x}}\, \mathrm dx$$ converges conditionally

First, I wanted to proof its convergence by building another integral that would allow me to use the comparison criterion. However, the integral I got was $$\int_{1}^{\infty} \frac{1}{\sqrt{x}}\, \mathrm dx$$ and is divergent. Then I planned to use the criterion of absolute convergence and prove that it diverges

Absolute divergence is easy to show using

$$\frac{|\cos x|}{\sqrt{x}} \geqslant \frac{\cos^2 x}{\sqrt{x}}= \frac{1}{2\sqrt{x}}+ \frac{\cos 2x}{2\sqrt{x}},$$

since $$\int_1^\infty \frac{dx}{2\sqrt{x}}$$ is divergent and $$\int_1^\infty \frac{\cos 2x}{2\sqrt{x}} \, dx = \frac{1}{2\sqrt{2}}\int_2^\infty \frac{\cos t}{\sqrt{t}} \, dt$$ is convergent (by Dirichlet's test or whatever you use for the first part).

This is just standard integration by parts; let $$f(x)=\int_1^x \cos y\, \mathrm dy$$, then $$f \in C^1([1,\infty])$$ is bounded (by $$2$$!), so:

$$\int_N^M \frac{\cos(x)}{\sqrt{x}}dx=\int_N^M f'(x)x^{-1/2}dx=f(M)M^{-1/2}-f(N)N^{-1/2}+(1/2)\int_N^M f(x)x^{-3/2}dx$$

$$|\int_N^M \frac{\cos(x)}{\sqrt{x}}dx| \le 2M^{-1/2}+2N^{-1/2}+(1/2)\int_N^M 2x^{-3/2}dx \le 4N^{-1/2} \to 0, M \ge N \to \infty$$

hence the OP integral is indeed conditionally convergent

Note that the result uses only that $$|\int_1^x \cos y dy| \le C$$ and $$x^{-1/2}$$ differentiable and decreasing to zero as $$x \to \infty$$ so it is true with the same proof for any pair of functions like that (for series this is just Abel summation by parts and it is similarly valid for integrals under these assumptions)