Suppose that $a < b$ and $f: [a,b] \to\mathbb{R}$ is a continuous function such that the range of $f$ contains $[a,b]$. Prove that $f$ has a fixed point.
I've already proved the case of $[0,1]$ but I don't know how to do the general case. Help.
Proof for $[0,1]$:
Let $g(x)=f(x)-x$, then $g(0)=f(0)\geq 0$, and $g(1)=f(1)-1\leq 0$.
Otherwise, by using IVT, there must exist some $c$ in $[0,1]$ such that $g(c)=0$ meaning that $f(c)=c$.