Mean value theorem understanding

Suppose to the contrary there are two distinct values such that $f(a)=a$, and $f(b)=b$.

The defining $g(x)=f(x)-x$, we get $g(a)=0$ and $g(b)=0$.

By Mean Value Theorem (Note $g$ is also differentiable):

$g'(c)=\frac{g(b)-g(a)}{b-a}=0$ for some $c$ between $a$ and $b$.

This means $0=g'(c)=f'(c)-1$, so $f'(c)=1$, a contradiction.


It is not necessary to consider $g(x)=f(x)-x$.

Suppose that there are $a,b \in \mathbb R$ such that $b>a$, $f(a)=a$ and $f(b)=b$. Then

$\frac{f(b)-f(a)}{b-a}=1 \ne f'(c)$ for all $c \in (a,b)$, a contadiction