# Analytic Number Theory/The Chebychev ψ and ϑ functions

Proposition (the Chebychev ψ function may be written as the sum of Chebyshev ϑ functions):
We have the identity
    $\psi (x)=\sum _{m=1}^{\log _{2}(x)}\vartheta (x^{1/m})$.
Proposition (estimate of the distance between the Chebychev ψ and ϑ functions):
Whenever $x\geq 3,594,641$, we have
    $\psi (x)-\vartheta (x)={\sqrt {x}}+O\left({\frac {\sqrt {x}}{\ln(x)^{2}}}\right)$.
Note: The current proof gives an inferior error term. A subsequent version will redeem this issue. (Given the Riemann hypothesis, the error term can be made even smaller.)
Proof: We know that the formula
    $\psi (x)=\sum _{m=1}^{\log _{2}(x)}\vartheta (x^{1/m})$
holds. Hence,
    $\psi (x)-\vartheta (x)=\sum _{m=2}^{\log _{2}(x)}\vartheta (x^{1/m})$.
By a result obtained by Pierre Dusart (based upon the computational verification of the Riemann hypothesis for small moduli), we have
    $\left|\theta (x)-x\right|\leq {\frac {0.2}{\ln(x)^{2}}}x$
whenever $x\geq 3,594,641$. If $x$ is in that range, we hence conclude
    $\psi (x)-\vartheta (x)=\sum _{m=2}^{\log _{2}(x)}\vartheta (x^{1/m})\leq \left(1+{\frac {0.2}{\ln(x)^{2}}}\right)\sum _{m=2}^{\log _{2}(x)}x^{1/m}$.
By Euler's summation formula, we have
    $\sum _{m=2}^{\log _{2}(x)}x^{1/m}=\int _{2}^{\log _{2}(x)}x^{1/t}dt+\int _{2}^{\log _{2}(x)}\{t\}\left({\frac {d}{dt}}x^{1/t}\right)dt+\{\log _{2}(x)\}x^{1/\log _{2}(x)}-\{2\}x^{1/2}$.
Certainly $\{2\}=0$ and $\{\log _{2}(x)\}\leq 1$. Moreover, $x^{1/\log _{2}(x)}=2$. Now derivation shows that
    $-\exp \left({\frac {\ln(x)}{t}}\right){\frac {t^{2}}{\ln(x)}}$
is an anti-derivative of the function
    $x^{1/t}-{\frac {2t}{\ln(x)}}x^{1/t}$
of $t$. By the fundamental theorem of calculus, it follows that
    $\int _{a}^{b}\left(1-{\frac {2t}{\ln(x)}}\right)x^{1/t}dt=\left[-\exp \left({\frac {\ln(x)}{t}}\right){\frac {t^{2}}{\ln(x)}}\right]_{t=a}^{t=b}$
for real numbers $a,b\in \mathbb {R}$ such that $a<b$. This integral is not precisely the one we want to estimate. Hence, some analytical trickery will be necessary in order to obtain the estimate we want.
We start by noting that if only the bracketed term in the integral were absent, we would have the estimate we desire. In order to proceed, we replace $x$ by the more general expression $xy$ (where $y\geq 1$), and obtain
    $\int _{a}^{b}\left(1-{\frac {2t}{\ln(xy)}}\right)x^{1/t}y^{1/t}dt=\left[-\exp \left({\frac {\ln(xy)}{t}}\right){\frac {t^{2}}{\ln(xy)}}\right]_{t=a}^{t=b}$.
The integrand is non-negative so long as
    $t\leq {\frac {\ln(xy)}{2}}$.
Moreover, if $t_{0}$ is strictly within that range, we obtain
    $\int _{2}^{t_{0}}x^{1/t}y^{1/t}dt\leq \left(1-{\frac {2t_{0}}{\ln(xy)}}\right)^{-1}\int _{2}^{t_{0}}\left(1-{\frac {2t}{\ln(xy)}}\right)x^{1/t}y^{1/t}dt=\left[-\exp \left({\frac {\ln(xy)}{t}}\right){\frac {t^{2}}{\ln(xy)}}\right]_{t=2}^{t=t_{0}}$.
We now introduce a constant $K\in (2,t_{0})$ and obtain the integrals
    $\int _{2}^{K}x^{1/t}y^{1/t}dt$ and $\int _{K}^{t_{0}}x^{1/t}y^{1/t}dt$.
The first integral majorises the integral
    $y^{1/K}\int _{2}^{K}x^{1/t}dt$,
whereas the second integral majorises the integral
    $\int _{K}^{t_{0}}x^{1/t}dt$.
We obtain that
    $\int _{2}^{t_{0}}x^{1/t}dt\leq {\frac {1}{y^{1/K}}}\int _{2}^{K}x^{1/t}y_{1}^{1/t}dt+\int _{K}^{t_{0}}x^{1/t}y_{2}^{1/t}dt$.
Now we would like to set $t_{0}=\log _{2}(x)$. To do so, we must ensure that $y$ is sufficiently large so that $K$ resp. $t_{0}$ is strictly within the admissible interval.
The two summands on the left are now estimated using our computation above, where $t_{0}$ is replaced by $K$ for the first computation: Indeed,
    $\int _{2}^{K}x^{1/t}y_{1}^{1/t}dt\leq \left(1-{\frac {2K}{\ln(xy_{1})}}\right)^{-1}\left[-\exp \left({\frac {\ln(xy_{1})}{t}}\right){\frac {t^{2}}{\ln(xy_{1})}}\right]_{t=2}^{t=K}$
and
    $\int _{K}^{t_{0}}x^{1/t}y_{2}^{1/t}dt\leq \left(1-{\frac {2t_{0}}{\ln(xy_{2})}}\right)^{-1}\left[-\exp \left({\frac {\ln(xy_{2})}{t}}\right){\frac {t^{2}}{\ln(xy_{2})}}\right]_{t=K}^{t=t_{0}}$.
Putting the estimates together and setting $t_{0}=\log _{2}(x)$, we obtain
    $\int _{2}^{\log _{2}(x)}x^{1/t}dt\leq {\frac {1}{y_{1}^{1/K}}}\left(1-{\frac {2K}{\ln(xy_{1})}}\right)^{-1}\left[-\exp \left({\frac {\ln(xy_{1})}{t}}\right){\frac {t^{2}}{\ln(xy_{1})}}\right]_{t=2}^{t=K}+\left(1-{\frac {2t_{0}}{\ln(xy_{2})}}\right)^{-1}\left[-\exp \left({\frac {\ln(xy_{2})}{t}}\right){\frac {t^{2}}{\ln(xy_{2})}}\right]_{t=K}^{t=\log _{2}(x)}$
whenever
    $K\leq {\frac {\ln(xy_{1})}{2}}$ and $\log _{2}(x)\leq {\frac {\ln(xy_{2})}{2}}$.
We now choose the ansatz
    $1-{\frac {2K}{\ln(xy_{1})}}=C$ and $1-{\frac {2t_{0}}{\ln(xy_{2})}}=D$
for constants $C$ and $D$. These equations are readily seen to imply
    $y_{1}={\frac {1}{x}}\exp \left({\frac {2K}{1-C}}\right)$ and $y_{2}={\frac {1}{x}}\exp \left({\frac {2\log _{2}(x)}{1-D}}\right)$.
Note though that $y_{1}\geq 1$ and $y_{2}\geq 1$ is needed. The first condition yields
    $K\geq {\frac {1-C}{2}}\ln(x)$.
The equations for $y_{1}$ and $y_{2}$ may be inserted into the above constraints on $K$ and $\log _{2}(x)$; this yields
    $K\leq {\frac {2K}{1-C}}$ and $\log _{2}(x)\leq {\frac {2\log _{2}(x)}{1-D}}$, that is, $C\geq {\frac {1}{2}}$ and $D\geq {\frac {1}{2}}$.
If all these conditions are true, the ansatz immediately yields
    $\int _{2}^{\log _{2}(x)}x^{1/t}dt\leq {\frac {C^{-1}}{y_{1}^{1/K}}}\left[-\exp \left({\frac {\ln(xy_{1})}{t}}\right){\frac {t^{2}}{\ln(xy_{1})}}\right]_{t=2}^{t=K}+D^{-1}\left[-\exp \left({\frac {\ln(xy_{2})}{t}}\right){\frac {t^{2}}{\ln(xy_{2})}}\right]_{t=K}^{t=\log _{2}(x)}$.
We now amend our ansatz by further postulating
    $K=\left({\frac {1-C}{2}}+\alpha \right)\ln(x)$.
This yields
    $y_{1}={\frac {1}{x}}\exp \left({\frac {(1-C+2\alpha )\ln(x)}{1-C}}\right)$
and
    ${\frac {C^{-1}}{y_{1}^{1/K}}}\left[-\exp \left({\frac {\ln(xy_{1})}{t}}\right){\frac {t^{2}}{\ln(xy_{1})}}\right]_{t=2}^{t=K}={\frac {C^{-1}}{y_{1}^{1/K}}}\left[-\exp \left({\frac {\frac {(1-C+2\alpha )\ln(x)}{1-C}}{t}}\right){\frac {t^{2}}{\ln(xy_{1})}}\right]_{t=2}^{t=K}$.
From this we deduce that in order to obtain an asymptotically sharp error term, we need to set $\alpha =0$. But doing so yields the desired result. $\Box$