Find all intervals $\mathbb X$ of real numbers for which the function $f(x)$ is invertible We have the function $f:\mathbb{R}\longrightarrow \mathbb{R}$ and $f(x)=x^2-4x+2$.
I have to prove that the function is not invertible in $\mathbb{R}$ (I have done that) and
I have to find all intervals $\mathbb{X}$ of real numbers, for which the function is invertible in $\mathbb{X}$ and non-invertible in $\mathbb{R} - \mathbb{X}$.
It is obvious that we can define an inverse function of $f(x)$ for two intervals:
$\mathbb {X} = (-\infty; 2] \implies f^{-1}(x)=2-\sqrt{x+2}$ and $\mathbb{R} - \mathbb{X}=(2; +\infty)$
and
$\mathbb {X} = [2; +\infty)\implies f^{-1}(x)=2+\sqrt{x+2}$ and $\mathbb{R} - \mathbb{X}=(-\infty; 2)$
However those two intervals cannot be merged into one answer. Morevover, I have the feeling I am missing something. For example, is $\mathbb {X} = \{2\}$ a valid interval, too? Then I have a third case and $\mathbb{R} - \mathbb{X}=(-\infty;2) \cup  (2; +\infty)$.
Have I understood the question correctly and should I unclude that last third interval? How should I write down my answer when I have all these cases?
 A: You do not explain what it means that $f$ is invertible on a subset $M \subset \mathbb R$. Probably you mean that $f$ maps $M$ bijectively onto $f(M)$. Then you get an inverse $f_M^{-1} : f(M) \to M$ for $f_M : M \to f(M)$.
If you agree with this interpretation, then clearly $f$ is invertible on $M$ of and onyl if $f \mid_M : M \to \mathbb R$ is injective.
If you admit degenerate intervals $[a,a]$, then each single point subspace $\mathbb X =\{a\}$ is an interval.
Let us first show that $f$ is injective on an interval $\mathbb X$ (in which case we call $\mathbb X$ admissible) if and only if either $\mathbb X \subset [2,\infty)$ or $\mathbb X \subset (-\infty,2]$.
One half has been shown by you. For the converse let $\mathbb X$ be any interval not contained in $[2,\infty)$ or $(-\infty,2]$. This means that $\mathbb X$ contains a point $a$ of $\mathbb R \setminus [2,\infty) = (-\infty,2)$ and a point $b$ of $\mathbb R \setminus (-\infty,2] = (2,\infty)$. Thus $a < 2 < b$ and $[a,b] \subset \mathbb X$. Let $r = \min(2-a,b-2)$. Then $2-r,2+r \in \mathbb X$ and $f(2-r) = f(2+r)$.
Now we are looking for admissible intervals $\mathbb X$ such that $f$ is not injective on $\mathbb Y  = \mathbb R \setminus \mathbb X$.

*

*If $\mathbb X$ is bounded, then $f$ is not injective on $\mathbb Y$. In fact, $\mathbb X \subset (2-R,2+R)$ for some $R > 0$, thus $2-R,2+R \in \mathbb Y$ and $f(2-R) = f(2+R)$.


*Now let $\mathbb X$ be unbounded. Then $\mathbb Y$ is also an unbounded interval and it must not be admissible, i.e. it must not be contained in $[2,\infty)$ or $(-\infty,2]$. Thus, if $\mathbb X \subset [2,\infty)$ has left boundary point $a$, we must have $a > 2$, and if $\mathbb X \subset (-\infty,2]$ has right boundary point $b$, we must have $b < 2$
This gives a complete answer: The desired intervals $\mathbb X$ are the precisely the  subintervals of $[2,\infty)$ which are bounded or have left boundary point $> 2$ and the  subintervals of $(-\infty,2]$ which are bounded or have right boundary point $< 2$.
