For f Continuous Real-valued Real function, the set $ \{ x : \exists x' \neq x: f(x)=f(x') \}$ is either empty or uncountable I am trying to show that for f $ \mathbb R \rightarrow \mathbb R$ (Edit continuous ), the set :
$ S=\{ x: \exists x'\neq x :f(x)=f(x')\}$ is either empty or uncountable
If f is an injection, S is clearly empty
If not, then there are $x,x'$ ; $ x \neq x'$ with $f(x)=f(x')$
now we consider a ball  $B(y, \epsilon ) $ and, by continuity of $f$ positive Reals $\delta_x, \delta_y$ with $f(B(x, \delta_x ), f((B(x', \delta_{x'})) \subset B(y, \epsilon)$
now, we consider $ \delta := min(\delta_x, \delta_x')$
Then the intersection  $B(x, \delta) \cap B(x',\delta)$ is uncountably-infinite.
Edit Key above is that $f(x)=f(x')=y $ and the balls $B(x, \delta_x), B(x', \delta_x')$ are connected and by continuity , so is their image under $f$,
$T=f[B(x, \delta)] \cap f[B(x',\delta)]$ is connected as well, and it contains y as an interior point.
Therefore
Is this a valid argument valid? I think I'm at least on the right track.
 A: I think your approach is not exactly on the right track because $S$ may not be open. E.g. consider the function defined by
\begin{align*}
f(x) &= 0 & \text{ for } &  -1 \leq x \leq 1,\\
f(x) &= x-1 & \text{ for } & x > 1,\\
f(x) &= x+1 & \text{ for } & x < -1.
\end{align*}
Then $S = [-1,1]$.
Suppose that there there exists $x \in \mathbb{R}$ and $\delta > 0$ for which $f([x-\delta,x+\delta])$ has $y = f(x)$ as an endpoint. Then, consider the intervals $f([x-\delta,x])$ and $f([x,x+\delta])$. These each have $y$ end point on the same side (left or right end). Subcase 1: If $f([x-\delta,x]) \cap f([x,x+\delta])$ is a singleton, we must have that either $f([x-\delta,x]) = \{y\}$ or $f([x,x + \delta]) = \{y\}$ so that in either case $S$ is uncountable. Subcase 2: If instead $f([x-\delta,x]) \cap f([x,x+\delta])$, is not a singleton, then $f([x-\delta,x]) \cap f([x,x+\delta])$ is uncountable and hence $S$ is uncountable.
Now assume there does not exist such an $x \in \mathbb{R}$. Let $x \neq x'$ satisfy $f(x) = f(x')$. Pick $\delta > 0$ for which $[x-\delta,x+\delta] \cap [x'-\delta,x'+\delta] = \emptyset$. By assumption, the images $f([x-\delta,x+\delta])$ and $f([x'-\delta,x'+\delta])$ each contain $y = f(x) = f(x')$ as an interior point. Thus, the intersection $f([x-\delta,x+\delta]) \cap f([x'-\delta,x'+\delta])$ is uncountable so that $S$ is uncountable.
