Functional Equation $f(f(x))=\frac{x}{2}+3$ Find all functions $f:\mathbb{R}\rightarrow \mathbb{R}$ of class $C^1$ where $f\circ f(x)=\dfrac{x}{2}+3$.
I need help with this problem.

Let $f^{\circ n}$ be the shorthand for composing $f$ with itself for $n$ times.
Let $g(x) = f(x+6)-6$. Since $f \in C^1$, so does $g$. Notice
$$g\left(\frac{x}{2}\right) = f\left(\frac{x+6}{2}+3\right)-6 = f(f^{\circ 2}(x+6)))-6
= f^{\circ 2}(f(x+6)) - 6\\ = \frac{f(x+6)}{2} + 3 - 6 = \frac{f(x+6)-6}{2} = \frac{g(x)}{2}$$ 
When $x = 0$, this implies $g(0) = 0$. 
When $x \ne 0$, divide both sides by $\frac{x}{2}$ gives us
$\displaystyle\;\frac{g(x)}{x} = \frac{g(x/2)}{x/2}$.
Repeat applying this, we find
$\displaystyle\;\frac{g(x)}{x} = \frac{g(x/2^k)}{x/2^k}$ for any integer $k > 0$.
As a result,
$$\frac{g(x)}{x} = \lim_{k\to\infty}\frac{g(x/2^k)}{x/2^k} 
\stackrel{\color{blue}{\because\text{ RHS exists}}}{=} \lim_{h\to 0} \frac{g(h)}{h} = \lim_{h\to 0}\frac{g(h)-g(0)}{h} \stackrel{\color{blue}{g \in C^1}}{=} g'(0)
$$
This means for some constant $a$,
$$g(x) = ax \quad\implies\quad f(x) = a(x-6)+6
\quad\implies\quad f(f(x)) = a^2(x-6) + 6
$$
Compare rightmost expression with the functional equation $f(f(x)) = \frac{x}{2} + 3$,
we find
$$a = \pm \frac{1}{\sqrt{2}}
\quad\implies\quad f(x) = \pm\frac{1}{\sqrt{2}}(x-6) + 6$$
This means the original functional equation has two and only two solutions.
