I came across the following advanced question in the textbook:
Let $R(N)$ denote the number of ordered pairs $(n, m) \in [N]^2$ such that $n, m, N$ are relatively prime.
I have to show that $R(N) = \sum_{d|N} \mu(d) * (N/d)^2$ where $\mu$ denotes the Mobius function.
I've tried writing the number of ordered pairs as
$$\sum_{m = 1}^N\sum_{n = 1}^N\sum_{d \mid (m,n)}\mu(d)$$ but I have no clue how to proceed.
I am a starter within the subject of discrete mathematics and number theory. Any help would be grateful. Thanks in advance.