I am trying to solve the following question
Does there exist a continuous function from $[a,b]$ to $[a,b]$ which is onto and $a$ and $b$ are the only two fixed points?
The function $f(x)= x$ has $a$ and $b$ as fixed points but it also has other fixed points.
When $a=0$ and $b=1$ the function $f(x) = x^2$ works. So I tried the function $f(x) = (x-a)(x-b) + x$ but in general I found that it does not work.
The function $f(x) = \log\left( \frac{e^b-e^a}{b-a}x+ \frac{be^a - ae^b}{b-a}\right)$ works for several examples that I have checked but I am not able to prove in general.
Given points $a<b$, I can imagine a function inside the rectangle of vertices at $(a,a), (a,b), (b,a), (b,b)$ such that the curve joins $(a,a)$ and $(b,b)$ and does not pass through any points of the form $(x,x)$ but I am not able to construct explicitly. Hints are appreciated.
You have already found the simple example $f(x)=x^2$ on the interval $[0,1]$. This example translates to every other interval $[a,b]$, where $a<b$. Simply take $$g(x)=(b-a)\left(\frac{x-a}{b-a}\right)^2+a.$$ In general, if $f(x)$ is such a function on the interval $[0,1]$ then $$g(x)=(b-a)f\left(\frac{x-a}{b-a}\right)+a,$$ is such a function on the interval $[a,b]$.