I am trying to prove the following statement:
Show that the set of real numbers that have a decimal expansion with the digit 5 appearing infinitely often is a Borel set.
$\textbf{using a Borel measurable function}$ (similar questions have been asked before but none (as far as I have been able to see) have tried to prove it in this way.
The only thing that I have been able to come up with after several tries is to use the indicator function $\chi_{E}:\mathbb{R}\to\mathbb{R}$, $\chi_{E}(x):=\begin{cases} 1 & \text{if }x\in E\\ 0 &\text{if }x\notin E\end{cases}$
where $E:=\{x\in \mathbb{R}: x \text{ has a decimal expansion with the digit 5 appearing infinitely often} \}$.
Then if $B$ is a Borel set we have that $\chi_E^{-1}(B)=\begin{cases}E &\text{ if }0\notin B\text{ and }1\in B\\ \mathbb{R}\setminus E & \text{ if }0\in B\text{ and }1\notin B\\ \mathbb{R} & \text{ if }0\in B\text{ and }1\in B\\ \emptyset & \text{ if }0\notin B\text{ and }1\notin B\end{cases}$ so in particular if we set $\mathcal{S}:=\{\emptyset,E,\mathbb{R}\setminus E,\mathbb{R}\}$ this should be an $\mathcal{S}$-measurable function and $\textbf{I was wondering if it is also a Borel measurable function}$ so I can say that $\chi_{E}^{-1}(\{1\})=E$ is Borel.
So, I would be very grateful if someone either gave me an hint about how to do this or disproved my approach explaining to me why this isn't a feasible approach.
This is rather long to be a comment, so I post it as an answer.
Let $E:=\{x\in \mathbb{R}: x \text{ has a decimal expansion with the digit 5 appearing infinitely often} \}$
For any $n \in \Bbb N$, $n>0$, let $E_n:=\{x\in \mathbb{R}: x \text{ has a decimal expansion with the digit 5 appearing in the $n$th position} \}$.
It is easy see that, for any $n \in \Bbb N$, $n>0$, $E_n$ is a Borel measurable set, so $\chi_{E_n}$ is a Borel measurable function.
Now, note that $\chi_E= \limsup_{n \to \infty} \chi_{E_n}$. So $\chi_E$ is a Borel measurable function. So $E$ is a Borel measurable set.
Remark: The above argument can be done directly with the sets, but the OP requested to use Borel measurable functions. Directly with the sets, we would have: $$ E = \limsup_n E_n = \bigcap_{k=1}^{\infty} \bigcup_{n=k}^{\infty} E_n$$ Since, for any $n \in \Bbb N$, $n>0$, $E_n$ is a Borel measurable set, it follows that $E$ is a Borel measurable set.