Section 10.1 The formula
First, let me recall the formula I want to prove. Again, \(\psi\) is the function
\begin{equation*}
\psi(x) = \sum_{n \lt x} \Lambda(n) + \frac{1}{2} \Lambda(x),
\end{equation*}
where \(\Lambda\) is the von Mangoldt function (equaling \(\log p\) if \(n>1\) is a power of the prime \(p\text{,}\) and zero otherwise).
Theorem 10.1. von Mangoldt's formula.
For \(x \geq 2\) and \(T > 0\text{,}\)
\begin{equation*}
\psi(x) - x = - \sum_{\rho: |\Imag(\rho)| \lt T} \frac{x^\rho}{\rho}
- \frac{\zeta'(0)}{\zeta(0)} - \frac{1}{2} \log (1-x^{-2}) + R(x,T)
\end{equation*}
with \(\rho\) running over the zeroes of \(\zeta(s)\) in the region \(\Real(s) \in [0,1]\text{,}\) and
\begin{equation*}
R(x,T) = O \left( \frac{x \log^2 (xT)}{T} + (\log x) \min\left\{1, \frac{x}{T \langle x \rangle} \right\} \right).
\end{equation*}
Here \(\langle x \rangle\) denotes the distance from \(x\) to the nearest prime power other than possibly \(x\) itself.
\begin{equation*}
-\frac{\zeta'(s)}{\zeta(s)} = \sum_{n=1}^\infty \Lambda(n) n^{-s}.
\end{equation*}
\(c>0\text{,}\)
\begin{equation*}
\frac{1}{2 \pi i} \int_{c - i\infty}^{c + i\infty} y^s \frac{ds}{s}
= \begin{cases} 0 \amp 0 \lt y \lt 1 \\ \frac{1}{2} \amp y = 1 \\
1 \amp y > 1
\end{cases}
\end{equation*}
\(\Real(s) = c\text{.}\)\(n \leq x\text{,}\)\(y = x/n\text{;}\)
\begin{equation*}
\psi(x) = \frac{1}{2 \pi i} \int_{c-i \infty}^{c + i\infty}
-\frac{\zeta'(s)}{\zeta(s)} \frac{x^s}{s}\,ds.
\end{equation*}
\(f\)\(\frac{1}{2 \pi i} \frac{f'}{f}\)\(s\)\(f\text{,}\)\(f\)\(s\text{.}\)\(x^s/s\)\(s=0\text{,}\)\(\zeta\text{.}\)\(\zeta\)\(s=1\)\(x\text{,}\)\(\rho\)\(\zeta\)\(-x^\rho/\rho\text{.}\)
\begin{equation*}
\sum_{n=1}^\infty -\frac{x^{-2n}}{(-2n)} = - \frac{1}{2} \log (1 - x^{-2}).
\end{equation*}
\(x^s/s\)\(s=0\text{,}\)\(-\zeta'(0)/\zeta(0)\text{.}\)\(c-iT \to c+iT\)\(c-iT \to -U-iT \to -U+iT \to c+iT\text{,}\)\(U \to \infty\text{.}\)\(c-iT \to c+iT\)\(c-i\infty \to c+i\infty\text{,}\)\(c \pm iT \to -\infty \pm iT\text{,}\)\(U \to -\infty\)\(-U-iT \to -U+iT\)\(R(x,T)\text{.}\)
Section 10.2 Truncating the vertical integral
We first replace the infinite vertical integral in [cross-reference to target(s) "L-isolate" missing or not unique] with a finite integral, and estimate the error term.
Lemma 10.2.
For \(c,y,T > 0\text{,}\) put
\begin{equation*}
I(y,T) = \frac{1}{2 \pi i} \int_{c-iT}^{c+iT} y^s \frac{ds}{s},
\end{equation*}
with the integral taken along the straight contour, and
\begin{equation*}
\delta(y) = \begin{cases} 0 \amp 0 \lt y \lt 1 \\ \frac{1}{2} \amp y = 1 \\
1 \amp y > 1.
\end{cases}
\end{equation*}
Then
\begin{equation*}
|I(y,T) - \delta(y)| \lt \begin{cases} y^c \min\{1, T^{-1} |\log y|^{-1} \} \amp
y \neq 1 \\ cT^{-1} \amp y = 1. \end{cases}
\end{equation*}
Proof.
I'll do the case \(0 \lt y \lt 1\) to illustrate, and leave the others for you. Note that there are two separate inequalities to prove; we establish them using two different contours.
Since \(y^s/s\) has no poles in \(\Real(s) > 0\text{,}\) for any \(d>0\text{,}\) we can write
\begin{equation*}
\int_{c-iT}^{c+iT} y^s \frac{ds}{s} =
\int_{c-iT}^{d-iT} y^s \frac{ds}{s} -
\int_{c+iT}^{d+iT} y^s \frac{ds}{s} +
\int_{d-iT}^{d+iT} y^s \frac{ds}{s},
\end{equation*}
in which each contour is straight. As \(d \to \infty\text{,}\) the integrand in the third integral converges uniformly to 0. We can thus write
\begin{equation*}
\int_{c-iT}^{c+iT} y^s \frac{ds}{s} =
\int_{c-iT}^{\infty-iT} y^s \frac{ds}{s} -
\int_{c+iT}^{\infty+iT} y^s \frac{ds}{s}
\end{equation*}
and each of the two terms is dominated by
\begin{equation*}
\frac{1}{T} \int_c^\infty y^t\,dt = y^c T^{-1} |\log y|^{-1}.
\end{equation*}
Since we must then divide by \(2\pi > 2\text{,}\) we get one of the claimed inequalities.
Now go back and replace the original straight contour with a minor arc of a circle centered at the origin. This arc has radius \(R = \sqrt{c^2+T^2}\text{,}\) and on the arc the integrand \(y^s/s\) is dominated by \(y^c/R\) because \(y \lt 1\text{.}\) Thus the integral is dominated by \(\pi R (y^c/R)\text{,}\) and dividing by \(2\pi\) yields the other claimed inequality.
\begin{equation*}
\int_{c-i\infty}^{c+i\infty} -\frac{\zeta'(s)}{\zeta(s)} \frac{x^s}{s}\,ds
- \int_{c-iT}^{c+iT} -\frac{\zeta'(s)}{\zeta(s)} \frac{x^s}{s}\,ds
= O\left( \frac{x (\log x)^2}{T} + (\log x) \min\left\{
1, \frac{x}{T \langle x \rangle} \right\} \right).
\end{equation*}
By the lemma (applied with \(y = x/n\)), the left side is dominated by
\begin{equation*}
\sum_{n=1, n \neq x}^\infty
\Lambda(n) \left( \frac{x}{n} \right)^c \min\{1, T^{-1} |\log (n/x)|^{-1}\}
+ c T^{-1} \Lambda(x).
\end{equation*}
We get to choose any convenient value of \(c\text{;}\) it keeps the notation simple to take \(c = 1 + (\log x)^{-1}\text{.}\) Note that then \(x^c = ex = O(x)\text{.}\)
To estimate the summand, it helps to distinguish between terms where \(\log (n/x)\) is close to zero, and those where it is bounded away from zero. For the latter, the quantity \(|\log (n/x)|^{-1}\) is bounded above; so the summands with, say, \(|n/x - 1| \geq 1/4\text{,}\) are dominated by
\begin{equation*}
O\left( x T^{-1} \left( -\frac{\zeta'(c)}{\zeta(c)} \right) \right)
= O(x T^{-1} \log x).
\end{equation*}
For the former, consider values \(n\) with \(3/4 \lt n/x \lt 1\) (the values with \(1 \lt n/x \lt 5/4\) are treated similarly, and \(n/x = 1\) contributes \(O(\log x)\)). Let \(x'\) be the largest prime power strictly less than \(x\text{;}\) then the summands \(x' \lt n \lt x\) all vanish. In particular, it is harmless to assume \(x' > 3x/4\text{,}\) since otherwise the summands we want to bound all vanish.
We now separately consider the summand \(n = x'\text{,}\) and all of the summands with \(3/4 \lt n \lt x'\text{.}\) The former contributes
\begin{equation*}
O\left( \log(x) \min\left\{1, \frac{x}{T(x-x')}\right\}\right).
\end{equation*}
For each term of the latter form, we can write \(n = x' - m\) with \(0 \lt m \lt x/4\text{,}\) and
\begin{equation*}
\log \frac{x}{n} \geq - \log \left(1 - \frac{m}{x'} \right)
\geq \frac{m}{x'},
\end{equation*}
so these terms contribute
\begin{equation*}
O \left( x T^{-1} (\log x)^2 \right).
\end{equation*}
Section 10.3 Shifting the contour
It remains to rewrite the integral
\begin{equation*}
\frac{1}{2\pi i} \int_{c-iT}^{c+iT} - \frac{\zeta'(s)}{\zeta(s)} \frac{x^s}{s}\,ds
\end{equation*}
by shifting the contour and picking up residues. The new contour will be the three sides of the rectangle joining \(c-iT, -U-iT, -U+iT, U+iT\) in that order, for suitable \(T\) and \(U\text{.}\)
We should choose \(U\) to be large and positive, so as to keep the vertical segment away from the trivial zeroes of \(\zeta\text{.}\) Since those occur at negative even integers, we may simply take \(U\) to be a large odd positive integer.
It is a bit trickier to pick \(T\text{.}\) Note that we were actually given a value of \(T\) in the hypotheses of the theorem, but that \(T\) might be very close to the imaginary part of a zero of \(\zeta\text{.}\) However, there is no harm in shifting \(T\) by a bounded amount: the sum over zeroes may change by the presence or absence of \(O(\log T)\) terms each of size \(O(x T^{-1} \log T)\text{,}\) but we are allowing the error term to be as big as \(O(x T^{-1} \log^2 T)\text{.}\)
We now need to know how far away we can make \(T\) from the nearest zero, given that we can only shift by a bounded amount. This requires a slightly more refined count of zeroes than the one we gave before; see exercises.
Lemma 10.3.
The number of zeroes of \(\zeta\) with imaginary part in \([T, T+1]\) is \(O(\log T)\text{.}\)This means we can shift \(T\) so that the difference between it and the imaginary part of any zero of \(\zeta\) is at least some constant times \((\log T)^{-1}\text{.}\)
We will also need a truncated version of the product representation of \(\zeta'/\zeta\text{;}\) see exercises.
Lemma 10.4.
For \(s = \sigma + it\) with \(-1 \leq \sigma \leq 2\) and \(t\) not equal to the imaginary part of any zero of \(\zeta\text{,}\)
\begin{equation*}
\frac{\zeta'(s)}{\zeta(s)} = \sum_{\rho: |t - \Imag(\rho)| \lt 1}
\frac{1}{s - \rho} + O(\log |t|),
\end{equation*}
where \(\rho\) runs over critical zeroes of \(\zeta\text{.}\)
Putting these two lemmas together, we deduce that (after shifting \(T\) by a bounded amount) for \(s\) on the contour with \(\Real(s) \in [-1,2]\text{,}\)
\begin{equation*}
\frac{\zeta'(s)}{\zeta(s)} = O(\log^2 T).
\end{equation*}
Thus the integrals over the horizontal contours \(c-iT \to -1-iT\) and \(-1+iT \to c+iT\) are
\begin{equation*}
O \left( \log^2 T \int_{-1}^c |x^s/s|\,ds \right)
\leq O\left( \frac{x \log^2 T}{T \log x} \right),
\end{equation*}
which is subsumed by our proposed error bound.
It remains to bound the integrals over the rectangular contour \(-1-iT \to -U-iT \to -U+iT \to -1+iT\text{.}\) For this, we use the functional equation for \(\zeta\text{,}\) in the form
\begin{equation*}
\zeta(1-s) = \pi^{1/2-s} \frac{\Gamma(s/2)}{\Gamma((1-s)/2)} \zeta(s).
\end{equation*}
Using a classical identity (one of Legendre's duplication formulas for \(\Gamma\)), we can rewrite this as
\begin{equation*}
\zeta(1-s) = 2^{1-s} \pi^{-s} \cos (\pi s /2) \Gamma(s) \zeta(s).
\end{equation*}
We want to bound the log derivative of the left side; it is equal to the sum of the log derivatives of the various factors on the right side. The first two factors give constants. The third gives a constant times \(\tan (\pi s/2)\text{,}\) which is bounded if we keep \(s\) at a bounded distance from any odd integer. The fourth gives \(\Gamma'(s)/\Gamma(s)\text{,}\) which we proved in a previous exercise is \(O(\log |s|)\) as \(|s| \to \infty\) if \(\Real(s) \geq 1/2\text{.}\) The fifth gives \(\zeta'(s)/\zeta(s)\text{,}\) which is bounded as \(|s| \to \infty\) if \(\Real(s) \geq 2\text{.}\)
Putting it all together, we deduce that if \(s\) is kept at a bounded distance from any negative even integer, we have
\begin{equation*}
\frac{\zeta'(s)}{\zeta(s)} = O(\log |s|) \qquad (|s| \to \infty,
\Real(s) \leq -1).
\end{equation*}
Applying this along the remaining rectangular contour, we bound the horizontal contributions by
\begin{equation*}
O \left( \int_1^\infty (\log s + \log T) x^{-s}/T \,ds \right)
\leq
O\left(
\frac{1}{T x \log^2 x} + \frac{\log T}{T x \log x}
\right),
\end{equation*}
which is subsumed by our error bound. We bound the vertical contribution in the limit as \(U \to 0\) by
\begin{equation*}
O \left( \frac{T \log U}{U x^U} \right),
\end{equation*}
which tends to zero. We are done!