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.
 A: 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.
A: Hint:
Find $f(x)$ as  the line function ($f\left( x \right) =ax+b$)
A: Assume that $f(x)$ would take the form of a polynomial of $x$:
$$f(x)=a_0 + a_1 x + a_2 x^2 + \cdots,$$
then $f(f(x)) = a_0 f(x) + a_1 f(x) + a_2 f^2(x) + \cdots = A_0 + A_1 x + A_2 x^2 + \cdots$.
One would obtain
\begin{cases}
  A_0 = a_0+a_1a_0+a_2a_0^2 = 3, \\
  A_1 = a_1^2+2 a_0 a_1 a_2=\frac{1}{2}, \\
  A_2 = a_1a_2+a_2a_1^2+a_2^3a_0=0,\\
  A_n = g(a_1,a_2,\cdots,a_n) = 0,\quad n\geqslant3
\end{cases}
I don't really know how to solve this. If it is safe to assume that $a_2=a_3=\cdots=a_n=0$, then one would arrive at
$$a_1^2=\frac 1 2\quad\to a_1=\pm\frac{1}{\sqrt{2}}$$
and $$a_0=\frac{A_0}{1+a_1}=6\mp3\sqrt{2}.$$
A: Let $f(x)=ax+b$. Then, $f(f(x))=a^2x+ab+b$. We can set up a system of equations:
$$a^2=\frac{1}{2},$$
$$(a+1)b=3.$$
The first equation gives $a=\pm\frac{1}{\sqrt{2}}$, while the second results in $b=\frac{3\sqrt{2}}{\sqrt{2}\pm1}$ or $b=6\pm3\sqrt{2}$.
