This is not a very detailed answer, but I can give you an idea how to solve these problems.

For the first equality you can deal with the coprimality condition using Mobius inversion. Then it is simply applying Euler-Maclaurin summation and playing around with identities of arithmetic functions. For the second equality, use partial summation.

These techniques can be found in Apostol's book on analytic number theory. Also try Iwaniec and Kowalski's book on analytic number theory.

Edit: You can find the statement of the partial summation trick (sometimes attributed to Abel) in Apostol's book, Theorem 4.2.

1

This is not a very detailed answer, but I can give you an idea how to solve these problems.

For the first equality you can deal with the coprimality condition using Mobius inversion. Then it is simply applying Euler-Maclaurin summation and playing around with identities of arithmetic functions. For the second equality, use partial summation.

These techniques can be found in Apostol's book on analytic number theory. Also try Iwaniec and Kowalski's book on analytic number theory.