Relating the two errors terms in the prime number theorem I would like to show that the two errors terms in the prime number theorem $\pi(x)-\frac{x}{\log{x}}$ and $\psi(x)-x$ are quite similar (or differing by something like a factor of $(\log{x})^{\varepsilon}$). This is my attempt: by partial summation,
$$
\pi(x)= \frac{\psi(x)}{\log{x}}+\int_{2}^{x}\frac{\psi(t)}{t\log^2(t)}dt + O(\sqrt{x}).
$$
This shows that
$$
\pi(x)-\frac{x}{\log{x}} = \frac{\psi(x)-x}{\log{x}}+\int_{2}^{x}\frac{\psi(t)}{t\log^2(t)}dt + O(\sqrt{x}).
$$
The problem now is that the the order of the integral is bigger than the error term. So I was wondering what would be the way of relating the two errors. Intuitively they should be the same but I’ve been not able to prove this formally

In fact they're not the same! We do expect $\psi(x)-x$ to be very roughly $\sqrt x$ in size (that's the Riemann hypothesis). However, we would only expect something this good for $\pi(x)-\mathop{\rm li}(x)$ where li$(x) = \int^x \frac{dt}{\log t}$ is the logarithmic integral. For $\pi(x)-\frac x{\log x}$ the error term is provably of size $\frac x{(\log x)^2}$.
