A “general definition” of Riemann sum Suppose $f$ is Riemann integerable in $[0,1]$.Prove that $$\lim_{n\rightarrow \infty}\frac{1}{\phi(n)}\sum_{1\leq k\leq n,(k,n)=1}f\left(\frac{k}{n}\right)=\int_0^1f(x)dx$$Here $\phi(n)$ is Euler's function
My attempt: Let $\mu$ be the Möbius function.
$$\begin{align}
LHS-RHS&=\frac{\sum_{k=1}^{n}\sum_{d|(k,n)}\mu(d)f(\frac{k}{n})}{n\sum_{d|n}\frac{\mu(d)}{d}}-\frac{1}{n}\sum_{k=1}^{n}f(\frac{k}{n})\\
&=\frac{1}{n}\frac{\sum_{k=1}^{n}(\sum_{d|(k,n)}\mu(d)-\sum_{d|n}\frac{\mu(d)}{d})f(\frac{k}{n})}{\sum_{d|n}\frac{\mu(d)}{d}}
\end{align}
$$But it seems not to work.Does anyone know how to prove it?Thank you

Let $(X_n)_{n\geq 1}$ be a sequence of indepenent random variables such that
$$ \mathbf{P}(X_n = k) = \frac{1}{\phi(n)} \quad\text{for each $k$ between $1$ and $n$ coprime to $n$}. $$
In particular, we have
$$ \mathbf{E}[f(X_n)] ​= \frac{1}{\phi(n)} \sum_{\substack{1 \leq k \leq n \\ (k, n) = 1}} f(k/n) $$
for any test functions $f$ on $[0, 1]$. Then we have the following observations:
Step 1. Let $f$ be bounded, measurable, and $1$-periodic. If $(m, n) = 1$, then by the Chinese remainder theorem,
\begin{align*}
\mathbf{E}[f(X_{mn})]
&= \frac{1}{\phi(mn)}\sum_{\substack{1 \leq k \leq mn \\ (k, mn) = 1}} f\left(\frac{k}{mn}\right) \\
&= \frac{1}{\phi(m)\phi(n)} \sum_{\substack{1 \leq j \leq m \\ (j, m) = 1}} \sum_{\substack{1 \leq k \leq n \\ (k, n) = 1}} f\left(\frac{jn + km}{mn}\right)
= \mathbf{E}[f(X_m + X_n)].
\end{align*}
Here, the last line follows from the independence of $X_n$'s.
Step 2. If $n = p^r$ is a prime power, then for any bounded and measurable $f$ on $\mathbb{R}$,
$$ \mathbf{E}[f(X_{p^r})]
= \frac{p}{p-1} \left( \frac{1}{p^r} \sum_{k=1}^{p^r} f(k/p^r) \right) - \frac{1}{p-1} \left( \frac{1}{p^{r-1}} \sum_{k=1}^{p^{r-1}} f(k/p^{r-1}) \right). $$
Now assume in addition $f$ is Lipschitz continuous with the Lipschitz constant $\|f\|_{\text{Lip}}$. Then by the above formula, for each prime power $n = p^r$, we get
\begin{align*}
&\left| \mathbf{E}[f(X_{n})] - \int_{I} f(x) \, \mathrm{d}x \right| \\
&\leq \frac{p}{p-1} \sum_{k=1}^{p^r} \int_{(k-1)/p^r}^{k/p^r} \left| f(k/p^r) - f(x) \right| \, \mathrm{d}x
+ \frac{1}{p-1} \sum_{k=1}^{p^{r-1}} \int_{(k-1)/p^{r-1}}^{k/p^{r-1}} \left| f(k/p^{r-1}) - f(x) \right| \, \mathrm{d}x \\
&\leq \frac{2\|f\|_{\text{Lip}}}{p^{r-1}(p-1)}
\leq \frac{4\|f\|_{\text{Lip}}}{n}.
\end{align*}
Step 3. For each $n$, let $q_n$ denote the largest prime power dividing $n$. Since there are only finitely many $n$'s for which $q_n$ is bounded by each given number, it follows that $q_n \to \infty$ as $n \to \infty$. Write $m_n = n/q_n$ so that $n = q_n m_n$. If $f $ is 1-periodic and Lipschitz continuous, then by the previous steps,
\begin{align*}
\left| \mathbf{E}[f(X_n)] - \int_{0}^{1} f(x) \, \mathrm{d}x \right|
&= \left| \mathbf{E}[f(X_{q_n} + X_{m_n})] - \mathbf{E} \int_{0}^{1} f(x+X_{m_n}) \, \mathrm{d}x \right| \\
&\leq \mathbf{E}\biggl[ \frac{4}{q_n} \| f(\cdot + X_{m_n}) \|_{\text{Lip}} \biggr]
= \frac{4}{q_n} \| f \|_{\text{Lip}}.
\end{align*}
Therefore it follows that $\mathbf{E}[f(X_n)] \to \int_{0}^{1} f(x) \, \mathrm{d}x$.
Step 4. Finally, let $f$ be Riemann integrable on $[0, 1]$. Then for each $\varepsilon > 0$, by modifying the step functions realizing the upper/lower Darboux sums for $f$, we can find 1-periodic and Lipschitz continuous functions $\psi, \varphi$ on $\mathbb{R}$ such that $\psi \leq f \leq \varphi$ on $[0, 1]$ and $\int_{0}^{1} (\varphi(x) - \psi(x)) \, \mathrm{d}x < \varepsilon$. Using this, we get
$$ \limsup_{n\to\infty} \mathbf{E}[f(X_n)]
\leq \limsup_{n\to\infty} \mathbf{E}[\varphi(X_n)]
= \int_{0}^{1} \varphi(x) \, \mathrm{d}x
\leq \int_{0}^{1} f(x) \, \mathrm{d}x + \varepsilon, $$
and similarly
$$ \liminf_{n\to\infty} \mathbf{E}[f(X_n)]
\geq \liminf_{n\to\infty} \mathbf{E}[\psi(X_n)]
= \int_{0}^{1} \psi(x) \, \mathrm{d}x
\geq \int_{0}^{1} f(x) \, \mathrm{d}x - \varepsilon. $$
Letting $\varepsilon \downarrow 0$, the proof is complete.
