TITLE: Is there any continuous ternary function which can not be represented by composition of continuous binary functions?
QUESTION [5 upvotes]: Let $f : X^3 \rightarrow X$.
If $X$ is $\mathbb Z$, then there will be a couple of functions $g,h$ from $\mathbb Z^2$ to $\mathbb Z$ that satisfies $f(x,y,z) = g(h(x,y),z)$ since there is a bijection $h :\mathbb Z^2 \rightarrow \mathbb Z$.
However, If $X$ is $\mathbb R$, then there are no continuous bijection from $\mathbb R^2$ to $\mathbb R$.
My question is : Is there any continuous function $f : \mathbb R^3 \rightarrow \mathbb R$ that can't be represented by composition of continuous functions $g_i : \mathbb R^2 \rightarrow \mathbb R$?
And similar questions for $f : \mathbb R^n \rightarrow \mathbb R$.
Sorry, I'm not sure about my tags.

REPLY [6 votes]: As pointed out by Pierre PC in his comment, the answer follows from the Kolmogorov theorem. Just for a record let us state one of the version of the theorem due to Lorentz (there are many other more refined versions; the reader will not have difficulties to find the references).

Theorem. There exist constants $0<\lambda_p\leq 1$, $1\leq p\leq n$ and strictly increasing functions $\phi_q:[0,1]\to [0,1]$, $0\leq q\leq 2n$ such that
  if $f:[0,1]^n\to\mathbb{R}$ is continuous, then there is another continuous function $g:[0,n]\to\mathbb{R}$ such that
  $$
f(x_1,\ldots,x_n)=\sum_{q=0}^{2n}
 g\left(\lambda_1\phi_q(x_1)+\ldots+\lambda_n\phi_q(x_n)\right).
$$

It is very surprising that neither the functions $\phi_q$ nor the constants $\lambda_p$ depend on $f$.
For a proof see pages 168-174  in
G. G. Lorentz, Approximation of functions, 1966.