Continuous Real Function on Closed Interval is Bijective iff Strictly Monotone

Theorem
Let $\left[{a \,.\,.\, b}\right]$ and $\left[{c \,.\,.\, d}\right]$ be closed real intervals.

Let $f: \left[{c \,.\,.\, d}\right] \to \left[{a \,.\,.\, b}\right]$ be a continuous real function.

Suppose $f \left({c}\right), f \left({d}\right) \in \left\{ { a, b }\right\}$.

Then $f$ is bijective iff $f$ is strictly monotone.

Necessary condition
Suppose that $f$ is bijective.

From Continuous Bijection of Interval is Strictly Monotone, it follows that $f$ is strictly monotone.

Sufficient condition
Suppose that $f$ is strictly monotone.

From Strictly Monotone Function is Bijective, it follows that $f$ is a bijection on its image.

From Image of Interval by Continuous Function, it follows that the image of $f$ is a real interval.

Suppose that $f$ is strictly increasing, so $f \left({c}\right) < f \left({d}\right)$.

It follows that $f \left({c}\right) = a$, and $f \left({d}\right) =b$.

It follows that for all $x \in \left[{c \,.\,.\, d}\right]$, we have $ f \left({x}\right) \ge f \left({c}\right) = a$ and $f \left({x}\right) \le f \left({d}\right) = b$.

Thus, the image of $f$ is $\left[{a \,.\,.\, b}\right]$.

Suppose instead that $f$ is strictly increasing, so $f \left({c}\right) > f \left({d}\right)$.

It follows that $f \left({c}\right) = b$, and $f \left({d}\right) = a$.

It follows that for all $x \in \left[{c \,.\,.\, d}\right]$, we have $ f \left({x}\right) \le f \left({c}\right) = b$ and $f \left({x}\right) \ge f \left({d}\right) = a$.

Thus, the image of $f$ is again $\left[{a \,.\,.\, b}\right]$.