Problem with a continuous function I tried to solve this problem but I could not continue
Let $f: [a, b​​]\to \mathbb{R}$ be a continuous function. 
Prove that if $x_1, x_2,\ldots,x_n  \in (a,b​)$, then
exists $x_0 \in (a, b​​)$ such that
$$f (x_0) =\frac{f (x_1) + f (x_2) +\cdots + f (x_n)}{n}$$
the function is continuous, so $\forall\ x_1, x_2,\ldots,x_n  \in(a, b​​)$
$$\begin{align*}
\lim_{x \to \ x_1}f(x)&=f (x_1)=L_1\\
\lim_{x \to \ x_2}f(x)&=f (x_2)=L_2\\
\lim_{x \to \ x_3}f(x)&=f (x_3)=L_3\\
&\vdots\\
\lim_{x \to \ x_n}f(x)&=f (x_n)=L_n\\
\end{align*}$$
We have that:
$$\lim_{x \to \ x_0}f(x)=f (x_0)=\frac{f (x_1) + f (x_2) +\cdots + f (x_n)}{n}= \frac{1}{n}\sum_{j=1}^n f(x_j)$$
Now
$$\min\left \{ L_1,L_2,L_3,\cdots,L_n \right \}\le\frac{1}{n}\sum_{j=1}^n f(x_j)\le\max\left \{ L_1,L_2,L_3,\cdots,L_n \right \}$$
and at this point I'm lost ...
 A: Even though this question has been answered informally, I'll put this up so it doesn't appear unanswered. Let $S:=\{x_1,x_2,.....,x_n\}$. Then consider
$$\max_{x \in S} \, \,f(x) = f(x_i)$$
for some $1 \leq i \leq n$. Now it is clear that
$$\frac{f(x_1)+f(x_2)+.......+f(x_n)}{n} \leq \frac{n\cdot f(x_i)}{n} = f(x_i). $$
Similarly we can take 
$$\min_{x\in S} f(x) = f(x_j)$$
for some $1\leq j \leq n$ and have
$$f(x_j) \leq \frac{f(x_1)+f(x_2)+.......+f(x_n)}{n}.$$
Hence by taking 
$$f(x_0):= \frac{f(x_1)+f(x_2)+.......+f(x_n)}{n} $$
we have $f(x_0)\in [f(x_j),f(x_i)]\subset (a,b)$.
Therefore, as $f$ is continuous on $(a,b)$ it is continuous on $[f(x_j),f(x_i)]$ and the intermediate value theorem guarantees the existence of $x_0$ within this interval.
A: Let $f: [a, b​​]\to \mathbb{R}$ be a continuous function. 
Prove that if $x_1, x_2,\ldots,x_n  \in (a,b​)$, then
exists $x_0 \in (a, b​​)$ such that
$$f (x_0) =\frac{f (x_1) + f (x_2) +\cdots + f (x_n)}{n}$$
Well, First we'll relable $x_1, ..., x_n$ so that $x_1 \leq x_2 \leq ... \leq x_n$ then the first important thing to notice is that $[x_1,x_n] \subset \mathbb{R}$ is closed and bounded, so we know that it's compact. The second thing is the important fact about continuous functions, they map compact sets to compact sets.  
So, we know that $f([x_1,x_n])$ is also compact, so it is closed and bounded. 
Bounded: since we're in $\mathbb{R}$ we know that $\sup(f([x_1,x_n])$ and $\inf(f([x_1,x_n]))$ exist. 
Closed: Since the set is closed we now know that $\sup(f([x_1,x_n])), \inf(f([x_1,x_n]))\in f([x_1,x_n])$. 
This tells us that we have $x, y\in [x_1,x_n]$ such that $f(x) = \sup(f([x_1,x_n]))$ and $f(y) = \inf(f([x_1,x_n]))$. 
From here, we can see how to solve the problem, since $$A =\frac{f (x_1) + f (x_2) +\cdots + f (x_n)}{n} \leq \frac{f(x) + f(x) + \cdots f(x)}{n} = f(x)$$ and $$A =\frac{f (x_1) + f (x_2) +\cdots + f (x_n)}{n} \geq \frac{f(y) + f(y) +\cdots f(y)}{n} = f(y)$$ Since $x_1, ..., x_n \in [x_1,x_n]$
So now we have $y,x\in [x_1,x_n]$ such that $f(y) < A < f(x)$. (Note: if $A = f(x)$ or $A = f(y)$ then we're done since $x,y \in (a,b)$ by assumption, so we're supposing they aren't equal)
Moreover WLOG we'll assume $x < y$, and so $f$ is continuous on $[x,y]$ (since $[x,y] \subset [x_1,x_n]$) 
Thus we use IVT, which tells us that that we have $x_0\in (x,y)\subset (a,b)$ for which $f(x_0) = A$.
