My question evolving the following well-known theorem in calculus:
If $f(x)$ is a continuous function on $[a,b]$, then there exists at least one point $c\in [a,b]$ such that $$ \dfrac{1}{b-a}\int_a^b f(x)dx = f(c). $$
I was wondering, for which condition of $f(x)$ that we can guarantee $c$ is in $(a,b)$, more specifically, $c$ can not be $a$ or $b$?
My attempt is try to find $f(x)$ such that $$ \dfrac{1}{b-a}\int_a^b f(x)dx = f(a) \quad\text{or}\quad \dfrac{1}{b-a}\int_a^b f(x)dx = f(b). $$ But so far, nothing works out.
I do not think one can find a reasonable condition equivalent to $$M_f={1\over b-a}\int\limits_a^bf(x)\,dx \neq f(a),f(b) \qquad (*)$$ For example if $(*)$ holds for a continuous function $f,$ it is possible to modify a function $f$ on the interval $[a,a+\delta],$ obtaining a new continuous function $g$ so that $M_f=M_g=g(a). $ Hence the property $(*)$ does not depend on the global behavior of $f.$
A sufficient condition could be: $f$ is nonconstant, i.e. $m=\min f< \max f=M,$ and $f(a),f(b)\in \{m,M\}.$ In particular this occurs, when $f$ is nondecreasing or nonincreasing ($m<M$).