Question: Let $f:\mathbb{R}\rightarrow\mathbb{R}$ be a continuous function and consider the set $A=\{x\in\mathbb{R}:\text{there exists } y\in\mathbb{R}, y\neq x, \text{such that } f(x)=f(y)\}$. We want to show that $A$ is Borel measurable.
I am not quite sure how to proceed. I have an idea of what makes a set Borel (it is contained in the Borel sigma algebra) but I am not quite sure how to show it in this case. In particular, I'd like to try and wrap my head around why $A$ is Borel, and second why, for instance, $y\neq x$ is no important, and why $A$ would (I assume) not be Borel without that assumption. Thank you!
We have the canonical projection map $\pi_1 : \mathbb{R} \times \mathbb{R} \to \mathbb{R}$ sending $(x,y) \mapsto x$, which is continuous. Take $F = \{(x,y) \, | \, f(x) = f(y) \}$, a closed subset of $\mathbb{R} \times \mathbb{R}$, and $U = \{(a,b) \, | \, a \neq b \}$, which is an open subset of $\mathbb{R} \times \mathbb{R}$ (it is the complement of the diagonal).
Then your set is $A = \pi_1(F \cap U)$.
Now $F$ is closed and $\mathbb{R} \times \mathbb{R}$ is $T_2$ and $\sigma$-compact (just means that it's a countable union of compact sets), so we can write $F = \cup_{i=1}^{\infty} F_i$ where each $F_i$ is compact.
Also since $U$ is open, we can write $U = \cup_{j=1}^{\infty} Q_j$ where each $Q_j$ is compact (we can construct this countable union of compact sets in many obvious ways, a standard example of which is using dyadic squares)
So,$A = \pi_1( (\cup_i F_i) \cap (\cup_j Q_j)) = \pi_1(\cup_{i,j} (F_i \cap Q_j)) = \cup_{i,j} \pi_1(F_i \cap Q_j)$, and since $\pi_1$ is continuous, each $\pi_1(F_i \cap Q_j)$ is compact, expressing $A$ as a countable union of compact sets, so it is Borel.