Let $f$ be continuous. If for every open $A$, $f(A)$ is also open, then $f$ is injective Question:

Let $f:\mathbb{R} \rightarrow \mathbb{R}$ be a continuous function. For every $A\subset\mathbb{R}$ open, prove that if $f(A)$ is open, then $f$ is injective.

My attempt:

We prove the contrapositve. We exibit an open set $A$ such that $f(A)$ is not open. We have that $f$ is not injective. Hence, there exists $x,y\in\mathbb{R},x\neq y$, such that $f(x)=f(y)$. Take $A=(x,y)$. We notice that A is an open set. Since $f$ is continuous, it follows that $f(A)$ is an interval. We argue that $f(A)$ cannot be an open interval since, this would force $f(A)=(f(x),f(y))$ or $f(A)=(f(y),(f(x))$, both of them being the empty set (which is not an interval). 

Hence, since an interval is an open set iff it is an open interval, we conclude that $f(A)$ cannot be open.

Why i posted this question: since $x$ and $y$ are not in $A$, the only way to the image of $f(A)$ to be open, that is, for the extremes of this interval don't be part of it, is: $f(A)$ must have $f(x)$ and $f(y)$ as its extremes. Is this reasoning correct? Any counter example?
I think the idea could work, you just need to change stuff a bit. I will assume $x&lt;y$ and your setting.

Your wrong assumption:

I agree $f(A)$ is an interval (image of connected sets trough continuous functions is connected), but it has not necessarily $f(x)$ and $f(y)$ as extreme points, but the maximum and minimum of the image of the closed interval $[x,y]$ (that exist because $[x,y]$ is compact). 

A way to end the proof (spoiler):

If they max and min are met at the borders $x,y$ is all done: $(x,y)$ is mapped to a point $max=min=f(x)=f(y)$ because $[x,y]$ is mapped there that is not open.  

If not, I notice at least one between $min, max$ are image of interior points, they have to be met inside: that leads us to $min, max \in f(A)$, so $f((x,y))=(min,max]$ or $[min,max)$ or $[min,max]$, that is not open. 

We contradicted that $f(A)$ has to be open.
Suppose $f$ is not injective, then there is some $x_1&lt;x_2$ such that
$f(x_1) = f(x_2)$.

Let $M = \max_{x \in [x_1,x_2]} f(x) \ge f(x_1)$, $m = \min_{x \in [x_1,x_2]} f(x) \le f(x_1)$. 

If $m=M$, then $f((x_1,x_2)) = \{f(x_1)\}$.

If $M &gt; f(x_1)$, then either $f((x_1,x_2)) = [m,M]$, or $f((x_1,x_2)) = (m,M]$.

If $m&lt; f(x_1)$, then the same sort of reasoning applies.