(This question was originally asked on StackExchange: <https://math.stackexchange.com/questions/82437/can-one-average-close-smooth-functions> )


Suppose $M$ is a connected, smooth, second-countable manifold.


Let $U \subset M^n$ be some neighbourhood of the diagonal. We will call a function $a: U \times \Delta\_n \rightarrow M$ an "averaging operator of order n" if $a|\_{U \times v\_i} = \pi\_i$, where $v\_i$ denotes the i-th vertex of the standard $n$-simplex $\Delta\_n$.


Intuitively, $a$ should tell us how to take a weighted average of "close" functions. 


Does every $M$ admit a smooth averaging operator of order $n$, for some $U$ and all $n$?


(I am trying to prove that smooth functions are dense in $Hom(M,N)$ without embedding $N$ into any $\mathbb{R}^n$ and I think it would easily follow from the above.)



Can one approximate "close" smooth functions?
There is a couple of standard methods.


First, one can embed $M$ into some $\mathbb R^N$ and fix a smooth neighborhood retraction onto the image. Then let $a$ be the composition of the weighted average in $\mathbb R^N$ and the retraction.


Second (this is an extended version of Nikite Kalinin's answer), you can take the barycenter with respect to a Riemannian metric on $M$. For $x\_1,\dots,x\_n\in M$ and $(m\_1,\dots,m\_n)\in\Delta\_n$, define the barycenter as a point where the function
$$
 x\mapsto \sum m\_i\cdot dist(x,x\_i)^2
$$
attains its minimum. Since the square of the Riemannian distance is smooth near the diagonal, and in normal coordinates it has the same first and second derivatives at the diagonal as the Euclidean counterpart, an easy application of the implicit function theorem shows that the barycenter is well-defined and depends smoothly on its arguments in a neighborhood of the diagonal. Moreover the size of the neighborhood can be estimated in terms of the injectivity radius and sectional curvatures of the Riemannian metric.


