Proposition 7.6.4. Step 3.
Let \(\chi \neq \chi_0\) be a nonprincipal character modulo \(q\text{.}\) We have
\begin{equation}
\sum_{n \leq x} \frac{\chi(n) \Lambda(n)}{n} =
\begin{cases}
O(1), \amp \text{if } L(1,\chi) \neq 0, \\
-\log x + O(1), \amp \text{otherwise}.
\end{cases}\tag{7.6.11}
\end{equation}
Proof: Nonzero case.
Assume that \(L(1,\chi) \neq 0\text{.}\) Consider the sum
\begin{equation*}
\sum_{n \leq x} \frac{\chi(n)\log n}{n}\text{.}
\end{equation*}
By
Corollary 7.5.3 this sum converges as
\(x \to \infty\text{,}\) so it is bounded, i.e.,
\(O(1)\text{.}\)
On the other hand, we have
\begin{equation}
\sum_{n \leq x} \frac{\chi(n)\log n}{n}
= \sum_{n \leq x} \frac{\chi(n)}{n} \sum_{d \mid n} \Lambda(n)
= \sum_{dk \leq x} \frac{\chi(dk)}{dk} \Lambda(d)\text{.}\tag{7.6.12}
\end{equation}
The first equality follows from the identity \(\log n = \sum_{d \mid n} \Lambda(d)\) which we have seen before. The second equality is by substitution \(n=dk\text{.}\)
Since every Dirichlet character is completely multiplicative, we have \(\chi(dk) = \chi(d)\chi(k)\) (for all \(d,k\text{,}\) including if \((d,k) \gt 1\)). So the summand in the last sum can be rewritten as
\begin{equation}
\frac{\chi(dk)}{dk} \Lambda(d) = \frac{\chi(d)\Lambda(d)}{d} \cdot \frac{\chi(k)}{k}\text{.}\tag{7.6.13}
\end{equation}
First we will fix \(d\) and evaluate the sum over \(k \leq \frac{x}{d}\text{.}\) We know that for \(d \leq x\text{,}\)
\begin{equation}
\sum_{k \leq \frac{x}{d}} \frac{\chi(k)}{k} = L(1,\chi) + O\left(\frac{d}{x}\right)\tag{7.6.14}
\end{equation}
\begin{align*}
\sum_{dk \leq x} \frac{\chi(d)\Lambda(d)}{d} \cdot \frac{\chi(k)}{k}
\amp = \sum_{d \leq x} \frac{\chi(d)\Lambda(d)}{d} \cdot \left( L(1,\chi) + O\left(\frac{d}{x}\right) \right) \\
\amp = L(1,\chi) \sum_{d \leq x} \frac{\chi(d)\Lambda(d)}{d}
+ \sum_{d \leq x} \frac{\chi(d)\Lambda(d)}{d} \cdot O\left(\frac{d}{x}\right) \\
\amp = L(1,\chi) \sum_{d \leq x} \frac{\chi(d)\Lambda(d)}{d}
+ \sum_{d \leq x} \chi(d)\Lambda(d) \cdot O\left(\frac{1}{x}\right)
\end{align*}
We want to simplify that last sum. First, observe that we can bound the sum:
\begin{equation*}
\left| \sum_{d \leq x} \chi(d)\Lambda(d) \right| \leq \sum_{d \leq x} |\Lambda(d)| = \sum_{d \leq x} \Lambda(d)\text{.}
\end{equation*}
Here we are using that \(|\chi(d)| \leq 1\) because each \(\chi(d)\) is a root of unity, or zero. Every value of \(\Lambda(d)\) is either \(\log p\) or zero; and \(\log p \gt 0\) (we have \(\log 2 \lt 1\text{,}\) but still \(\gt 0\)). Recall that \(\sum_{d \leq x} \Lambda(d) = \psi(x)\text{,}\) Chebyshev’s \(\psi\) function, by definition. And recall that by Chebyshev’s estimates, \(\psi(x) = O(x)\text{.}\)
So, \(\sum_{d \leq x} \chi(d)\Lambda(d) = O(x)\text{.}\) Can we conclude that \(\sum_{d \leq x} \chi(d)\Lambda(d)O(\frac{1}{x}) = O(1)\text{?}\) Not immediately. The problem is that the implicit constant appearing in the \(O(1/x)\) factor might a priori depend on \(d\text{;}\) and it might grow as \(d\) grows.
Well, the \(O(1/x)\) factors are not arbitrary, independent things. They come from the same place: the tails of the sum \(\sum \frac{\chi(k)}{k}\text{.}\) Specifically, we have
\begin{equation}
\left| \sum_{k \gt x} \frac{\chi(k)}{k} \right|
\leq C \cdot \frac{1}{x}\tag{7.6.15}
\end{equation}
for some constant \(C\) that doesn’t depend on \(x\text{.}\) In particular that means
\begin{equation*}
\left| \sum_{k \gt \frac{x}{d}} \frac{\chi(k)}{k} \right|
\leq C \cdot \frac{d}{x}
\end{equation*}
where the constant \(C\) doesn’t depend on \(x\) or on \(d\text{.}\) So, the sum we’re trying to bound can now be bounded:
\begin{equation}
\left| \sum_{d \leq x} \frac{\chi(d)\Lambda(d)}{d} O\left(\frac{d}{x}\right) \right|
\leq \sum_{d \leq x} \left| \frac{\chi(d)\Lambda(d)}{d} \cdot C \cdot \frac{d}{x} \right|
\leq \frac{C}{x} \sum_{d \leq x} \Lambda(d)\tag{7.6.16}
\end{equation}
and again, the sum of \(\Lambda(d)\) is equal to \(\psi(x)\) which is \(O(x)\text{.}\)
In conclusion,
\begin{equation}
L(1,\chi) \sum_{d \leq x} \frac{\chi(d) \Lambda(d)}{d} + O(1)
= \sum_{n \leq x} \frac{\chi(n)\log(n)}{n}
= O(1)\tag{7.6.17}
\end{equation}
and so therefore
\begin{equation}
L(1,\chi) \sum_{d \leq x} \frac{\chi(d) \Lambda(d)}{d} = O(1)\tag{7.6.18}
\end{equation}
Finally, since \(L(1,\chi) \neq 0\text{,}\) we can divide to get that the sum is \(O(1)\) as claimed.
Proof: Zero case.
Assume that \(L(1,\chi) = 0\text{.}\) We will show that \(\log x + \sum_{n \leq x} \frac{\chi(n)\Lambda(n)}{n}\) is bounded.
Recall the identities
\begin{equation*}
\Lambda(n) = \sum_{d \mid n} \mu(d) \log \frac{n}{d} = - \sum_{d \mid n} \mu(d) \log d\text{.}
\end{equation*}
(As a reminder: We have mentioned the identity \(\log n = \sum_{d \mid n} \Lambda(d)\text{.}\) Then Möbius inversion gives \(\Lambda = \mu * \log\text{,}\) which is the first equality. The second equality is algebraic simplification.)
Using these identities,
\begin{align}
\sum_{d \mid n} \mu(d) \log \frac{x}{d}
\amp = (\log x) \sum_{d \mid n} \mu(d) - \sum_{d \mid n} \mu(d) \log d \tag{7.6.19}\\
\amp = (\log x) \sum_{d \mid n} \mu(d) + \Lambda(n) \tag{7.6.20}\\
\amp = \begin{cases}
\log x, \amp \text{if } n = 1 \\
\Lambda(n), \amp \text{if } n \gt 1
\end{cases}\tag{7.6.21}
\end{align}
because if \(n = 1\) then \(\sum_{d \mid n} \mu(d) = 1\) and \(\Lambda(n) = 0\text{,}\) while if \(n \gt 1\) then \(\sum_{d \mid n} \mu(d) = 0\text{.}\)
Now we consider \(\log x + \sum_{n \leq x} \frac{\chi(n) \Lambda(n)}{n}\text{,}\) with the goal of showing it is bounded. Both of the expressions \(\log x\) and \(\Lambda(n)\) can be replaced with \(\sum_{d \mid n} \mu(d) \log \frac{x}{d}\text{.}\) In addition, when \(n=1\) we have \(\frac{\chi(n)}{n} = \frac{\chi(1)}{1} = 1\text{.}\) After we make this substitution, we will interchange the order of summation:
\begin{align}
\log x + \sum_{n \leq x} \frac{\chi(n)\Lambda(n)}{n}
\amp = \sum_{n \leq x} \frac{\chi(n)}{n} \sum_{d \mid n} \mu(d) \log \frac{x}{d}\tag{7.6.22}\\
\amp = \sum_{d \leq x} \mu(d) \log \frac{x}{d} \sum_{k \leq \frac{x}{d}} \frac{\chi(dk)}{dk}\tag{7.6.23}\\
\amp = \sum_{d \leq x} \mu(d) \left( \log \frac{x}{d}\right) \frac{\chi(d)}{d} \sum_{k \leq \frac{x}{d}} \frac{\chi(k)}{k}\tag{7.6.24}\\
\amp = \sum_{d \leq x} \mu(d) \left( \log \frac{x}{d}\right) \frac{\chi(d)}{d} \left( L(1,\chi) + O\left(\frac{d}{x} \right) \right)\tag{7.6.25}\\
\amp = \sum_{d \leq x} \mu(d) \left( \log \frac{x}{d}\right) \frac{\chi(d)}{d} \cdot O\left(\frac{d}{x} \right)\tag{7.6.26}\\
\amp = O\left(\frac{1}{x}\right) \sum_{d \leq x} \mu(d) \left( \log \frac{x}{d} \right) \chi(d)\tag{7.6.27}\\
\amp = O\left(\frac{1}{x}\right) O\left(\sum_{d \leq x} \log \frac{x}{d} \right)\tag{7.6.28}\\
\amp = O(1) \quad \text{(!!) (Exercise)}\tag{7.6.29}
\end{align}
Therefore \(\sum_{n \leq x} \frac{\chi(n)\Lambda(n)}{n} = -\log x + O(1)\text{.}\)