Equivalence of two well-known forms of (RH): reference-request.

This is a reference-request about a very simple statement.

The Riemann hypothesis is well-known to be equivalent to $$(1)\ \ \ \pi(x) = \mathrm{Li}(x)+O(x^{1/2} \log x)$$ and to $$(2)\ \ \theta(x)=x+O(x^{1/2} \log^2 x).$$ Here as usual, $\pi(x) = \sum_{p < x} 1$ and $\theta(x) = \sum_{p< x} \log p$.

I am looking for a reference giving the proof of the equivalence between (1) and (2).

All the analytic number theory textbooks I have looked at gives at best a proof that $\theta(x) \sim \pi(x) \log x$, which is clearly not enough.

-
Have you tried writing $\pi(x)=\int_1^x\frac 1{\log x}d\theta(x)$, using integration by parts on the right hand side, and then plugging in (2) for $\theta(x)$? For the other direction, do something similar. – John Pardon Feb 17 '13 at 19:52
Thanks to unknown, Greg, and GH. I have accepted Greg's answer because what I mainly needed was an authoritative reference that I could cite in a paper that I am written (in a first version, I said "it is well-known that..." but I wanted the whole proof to be complete). – Joël Feb 18 '13 at 15:14

Write $\pi(t)=\mathrm{Li}(t)+f(t)$, so that $f(t)=O(t^{1/2}\log t)$ by assumption. Then $$\theta(x) = \int_{2-}^x\log t\ d\pi(t)=\int_{2-}^x\log t\ d\mathrm{Li}(t)+\int_{2-}^x\log t\ d f(t).$$ Here the first integral is $$\int_{2-}^x\log t\ d\mathrm{Li}(t) = \int_2^x\log t\frac{dt}{\log t} = x-2$$ and the second integral is $$\int_{2-}^x\log t\ df(t) = f(x)\log x - \int_2^x \frac{f(t)}{t}dt = O(x^{1/2}\log^2 x) + \int_2^x O(t^{-1/2}\log t)\ dt.$$ The last integral is clearly $$O(\log x)\int_2^x t^{-1/2}\ dt = O(x^{1/2}\log x),$$ hence altogether $$\theta(x) = x-2 + O(x^{1/2}\log^2 x)+O(x^{1/2}\log x) = x+O(x^{1/2}\log^2 x).$$