$\sum_{i=1}^x\sum_{j=1}^xf(i\cdot j)$ Double Summing a (Not Completely) Multiplicative Function

Let $ f(n)$ be a multiplicative function that is not completely multiplicative, i.e $ f(m)\cdot f(n)= f(m\cdot n)$ only if $ gcd(m,n)=1$ . Let $ S(x)$ be the double sum over $ f$ , that is:

$ $ S(x)=\sum_{i=1}^x\sum_{j=1}^xf(i\cdot j)$ $

It is not difficult to see that if $ f(n)$ were completely multiplicative, then $ S(x)$ could be simplified:

$ $ S(x)=\sum_{i=1}^x\sum_{j=1}^xf(i\cdot j)= \sum_{i=1}^xf(i)\sum_{j=1}^xf(j)= \biggl(\sum_{k=1}^xf(k)\biggr)^2$ $

But since $ f(n)$ is not completely multiplicative, this simplification is not completely true, and it fails in every combination where $ gcd(i,j)\neq1$ . Hence, $ S(x)$ can be written this way provided we add some additional error term, let’s call it $ E$ :

$ $ S(x)=\sum_{i=1}^x\sum_{j=1}^xf(i\cdot j)= \biggl(\sum_{k=1}^xf(k)\biggr)^2+E$ $

$ E$ is either negative or positive, I’m not sure. Obviously, $ E$ is comprised of all the small errors generated by the initial sum term, when $ gcd(i,j)\neq1$ . I am mainly interested in the cases where $ f(n)$ takes the form of:

  1. Euler totient function: $ $ S_{\varphi}(x)=\sum_{i=1}^x\sum_{j=1}^x\varphi(i\cdot j)$ $
  2. Sum of divisors function: $ $ S_{\sigma_1}(x)=\sum_{i=1}^x\sum_{j=1}^x\sigma_1(i\cdot j)$ $
  3. Moebius function: $ $ S_{\mu}(x)=\sum_{i=1}^x\sum_{j=1}^x\mu(i\cdot j)$ $

My question is, what is this error term $ E$ exactly? how can I calculate it? How can I properly sum all those small errors to get a correct evaluation of $ S(x)$ ? For clarification, I am concerned with evaluating $ S(x)$ , but I think I must evaluate $ E$ first in order to do it. I am taking this approach because I can compute $ \biggl(\sum_{k=1}^xf(k)\biggr)^2$ very efficiently, and so, finding the error term $ E$ will solve my question.