# Topological spaces admitting an averaging function

Let $M$ be a topological space. Define an averaging function as a continuous map $f:M \times M \to M$ which satisfies $f(a,b) = f(b,a)$ for all $a,b \in M$ and $f(a,a) = a$ for all $a \in M$.

These seem like reasonable properties for a function which deserves the name “average” to have, since they are enjoyed by the usual averaging functions on $\mathbb{R}^n$.

One can rule out an averaging function on both $S^1$ and $S^2$ by some cohomological arguments. I have not worked out whether any sphere admits an averaging function, but I suspect not.

Euclidean spaces all do (given by the usual average).

Does anyone have a characterization of spaces which admit an averaging function?

Here is a proof that no sphere (of dimension $>0$) admits an averaging function. Suppose there is an averaging function $f:S^n\times S^n\to S^n$. Let $T(x_0,x_1,x_2,\dots,x_n)=(-x_0,-x_1,x_2,\dots,x_n)$; then $T:S^n\to S^n$ is homotopic to the identity and satisfies $T(T(x))=x$. Now consider the map $g:S^n\to S^n$ given by $g(x)=f(x,T(x))$. Since $T$ is homotopic to the identity, $g$ is homotopic to $x\mapsto f(x,x)=x$, and so $g$ has degree $1$. But note that so $g$ factors through the quotient $S^n\to S^n/{\sim}$, where $\sim$ identifies $x$ with $T(x)$. It is easy to see that $S^n/{\sim}\cong S^n$ and the quotient map has degree $2$. Thus $g$ must have even degree, which is a contradiction.
On the other hand, here are some spaces that have means. First, suppose $M=|X|$ is the geometric realization of a countable contractible simplicial set. The functor $X\mapsto X\times X/\Sigma_2$ commutes with geometric realization for countable simplicial sets, so we get a CW-complex structure on $M\times M/\Sigma_2$ such that the diagonal $M\to M\times M/\Sigma_2$ is a subcomplex. Since $M$ is contractible, it follows by obstruction theory that $M$ is a retract of $M\times M/\Sigma_2$. But such a retraction is exactly a mean on $M$. (The restriction to countable simplicial sets is just so that the product has the right topology; if you work in the category of compactly generated spaces rather than all spaces, you can remove the countability hypothesis. I also suspect that this argument works for arbitrary contractible CW-complexes (not just realizations of simplicial sets), but in that case it is not obvious how to get a CW-structure on $M\times M/\Sigma_2$ with the diagonal as a subcomplex).
There are also some spaces with means with more interesting homotopical properties. For instance, let $(A_n)_{n\geq 0}$ be a sequence of countable $\mathbb{Z}[1/2]$-modules (as above, the countability hypothesis can be dropped if you work with compactly generated spaces). Consider the bounded chain complex of $\mathbb{Z}[1/2]$-modules whose objects are the $A_n$ and whose maps are all zero. Via the Dold-Kan correspondence, we obtain from this chain complex a countable simplicial $\mathbb{Z}[1/2]$-module $X$ such that $\pi_n(X)=A_n$. The geometric realization $M=|X|$ is then a topological $\mathbb{Z}[1/2]$-module with $\pi_n(M)=A_n$. We can then define a mean on $M$ by $f(a,b)=(a+b)/2$.