Find all (if that's possible) functions $f:\mathbb{R}\rightarrow\mathbb{R}$ such that $$f(f(x))=\sin x.$$
This is a problem a friend gave me. He said he saw it on a book a long time ago, but he couldn't remember what book. I literally have no idea how to solve this so I can't post my attempt here.

I think there is an analytic solution.
Let $f(z) = \sum_{n=1}^\infty c_n z^n$ be analytic for $|z|$ small enough. We have $$f(f(z)) = \sum_{n=1}^\infty c_n f(z)^n =\sum_{n=1}^\infty c_n (\sum_{k=1}^\infty c_k z^k)^n$$ $$ = \sum_{n=1}^\infty c_n \sum_{m=1}^\infty z^m \sum_{\sum_{l=1}^n k_l = m} \prod_{l=1}^n c_{k_l}$$ $$ = \sum_{m=1}^\infty z^m \sum_{n=1}^m c_n\sum_{\sum_{l=1}^n k_l = m} \prod_{l=1}^n c_{k_l}$$ And if we are given an analytic function $g(z) = \sum_{m=1}^\infty b_m z^m$, the equation $g(z) = f(f(z))$ for $|z|$ small enough becomes
$$b_m = \sum_{n=1}^m c_n\sum_{\sum_{l=1}^n k_l = m} \prod_{l=1}^n c_{k_l}$$ $$ = c_1 c_m + c_m c_1^m + \underbrace{\sum_{n=2}^{m-1} c_n\sum_{\sum_{l=1}^n k_l = m}\prod_{l=1}^n c_{k_l}}_{\text{only } c_k, \ k < m \text{ appears there}} $$
so that a solution for the coefficients always exist when $b_1 = 1$ : $$c_1 = 1, \qquad c_m = \frac{1}{2}(b_m - \sum_{n=2}^{m-1} c_n\sum_{\sum_{l=1}^n k_l = m}\prod_{l=1}^n c_{k_l})$$ All we have to do then is proving $f(z) = \sum_{n=1}^\infty c_n z^n$ converges : that $c_n = \mathcal{O}(R^n)$ for some $R$.