Prove that $f$ is constant if $f(x)=f(x^2-x+1)$

Let $g(x)=x^2-x+1$. Observe that for $x\in[0,1]$, $g(x)\geq x$. In particular, $$ g(x)-x=x^2-2x+1=(x-1)^2. $$ Can you show that $\lim_{n\rightarrow\infty}g^n(x)=1$ for all $x\in[0,1]$? Then, $$ f(x)=f(g(x))=f(g^2(x))=\cdots=f(g^n(x)). $$ Then, since $f$ is continuous at $1$, $$ \lim_{n\rightarrow\infty}f(g^n(x))=f(1). $$

Hints on showing that $\lim_{n\rightarrow\infty}g^n(x)=1$: We know that $x,g(x),g^2(x),\dots$ is an increasing and bounded sequence. Therefore, we know that it has a limit. Suppose that $L$ is the limit. Suppose, for contradiction, that $L$ is less than $1$, can you find a contradiction? (If $x_k$ is sufficiently close to $L$, then can you show that $x_{k+1}>L$?)


Hints: Take $x_0 \in [0, 1]$ and let $x_{n+1} = x_n^2 - x_n + 1$. Then $x_{n+1} \geq x_n$ (why?) and $f(x_{n+1}) = f(x_n)$. In addition, $x_{n+1} \leq 1$, and in fact you can show $x_n \to 1$. Can you see why this proves your claim?