Let $C$ be the Cantor set and $\mu$ be the uniform measure. Find $\int x^2 d\mu$ This is one of my homework problems:
Let $C$ be the Cantor set and $\mu$ be the uniform measure (with the usual Cantor distribution). Find $\int x^2 d\mu$.
I tried finding the value by using symmetry property, and failed, unsurprisingly. I also tried to use Fubini's theorem by setting $\int x^2 d\mu=\int_{0}^{1} \int_{0}^{x} 2t dx d\mu$, but I think it does not simplify the problem.
So what should I deal with it?

Here is another solution. Let $X_1, X_2, \cdots$ be i.i.d. and $\mathsf{P}(X_i = 0) = \mathsf{P}(X_i = 2) = \frac{1}{2}$. Then
$$ Y = \sum_{m=1}^{\infty} \frac{X_m}{3^m} \tag{*}$$
has the distribution $\mu$. So it follows that
$$ \int x^2 \, d\mu
= \mathsf{E}[Y^2]
= \mathsf{Var}(Y) + \mathsf{E}[Y]^2
= \sum_{n=1}^{\infty} \frac{1}{9^n} + \left( \sum_{n=1}^{\infty} \frac{1}{3^n} \right)^2
= \frac{3}{8}.
$$

Proof of $\text{(*)}$. Let $U$ be independent of $(X_i)_{i=1}^{\infty}$ and has the uniform distribution over $[0, 1]$. If
$$ C_n = [0, 1] \setminus \bigcup_{m=1}^{n} \bigcup_{k=0}^{3^{m-1} - 1} \left( \frac{3k+1}{3^m}, \frac{3k+2}{3^m} \right) $$
denotes the $n$-th step in the construction of the Cantor set $C$, then
$$ Y_n = \sum_{m=1}^{n} \frac{X_m}{3^m} + \frac{1}{3^n} U $$
has the uniform distribution over $C_n$. Indeed, the summation part picks one subinterval out of total $2^n$ subintervals of $C_n$ equally likely, then the uniform part $3^{-n}U$ picks a point uniformly randomly out of that subinterval. Then


*

*The distribution of $Y_n$ converges to $\mu$.

*$Y_n$ converges $\mathsf{P}$-a.s. to $Y$.
Combining two facts gives the desired identity $\text{(*)}$.
