I want to prove that T is the discrete topology on X if and only if every function $f:(X,T)\rightarrow (\Bbb R, T_{st})$ is continuous.
Here's my attempt:
$(\Rightarrow)$Assume That T is the discrete topology
using the theorem that a map is continuous if and only if the inverse of the function is open in the domain for every open set it maps in the codomain , I said that as all sets are open the discrete topology that obviously $f^{-1}(\Bbb R)$ is open for all open sets in $(\Bbb R, T_{st})$
$(\Leftarrow)$Now suppose f is continuous $\Rightarrow$ for all $U\subset \Bbb R$ the preimage $f^{-1}(U)$ is open in (X,T)
So we know that at least for open sets we'll map to open sets, we want to show that the same is true for closed sets too though
But heres where I get stuck, we assumed that f is continuous which means that $f^{-1}(\Bbb R)$ is closed for every closed set in $(\Bbb R, T_{st})$ , but closed sets exist in $(\Bbb R, T_{st})$ which seems to imply that closed sets exist in $(X,T)$ which would mean that T couldn't be the discrete topology?
What am I missing here ?
The forward direction is incorrect as you state it: you need to note that if $X$ is discrete and $f: X \to \mathbb{R}$ is any function, then $f^{-1}[U]$ is open in $X$ for all open $U$ (not just $\mathbb{R}$) in $\mathbb{R}$. So $f$ is continuous.
If all real-valued functions on $X$ are continuous, let $A \subseteq X$. The function $\chi_A: X \to \mathbb{R}$ defined by $$\chi_A(x)=\begin{cases} 1 & \text{ if } x \in A\\ 0 & \text{ if } x \notin A \end{cases}$$
is continuous by assumption. This implies that $\chi_A^{-1}[\{1\}] = A$ is closed as $\{1\}$ is closed in $\mathbb{R}$. As $A$ is arbitary, all subsets of $X$ are closed, which implies that $X$ has the discrete topology.