[proofplan]
We first use discreteness of $X$ to choose a [countable set](/page/Countable%20Set) of values that supports $X$ almost surely. The image of that set under $g$ is countable because a function sends a countable set to a countable set. Since $X$ lands in the support set almost surely, the composition $g(X)$ lands in its image almost surely. Finally, Borel measurability of $g$ and measurability of $X$ imply that $g\circ X$ is a [random variable](/page/Random%20Variable), so the countable almost-sure support proves discreteness.
[/proofplan]
[step:Choose a countable almost-sure support for $X$]
Because $X$ is discrete, there exists a countable set $S\subset\mathbb R$ such that $\mathbb P(X\in S)=1$. Equivalently, if we define the event $A:=X^{-1}(S)=\{\omega\in\Omega:X(\omega)\in S\}$, then $A\in\mathcal F$ and $\mathbb P(A)=1$. The measurability of $A$ follows from $S\in\mathcal B(\mathbb R)$, since every countable subset of $\mathbb R$ is Borel, and from the measurability of X.
[/step]
[step:Show that the image of the countable support is countable]
Define the image set $T:=g(S)=\{g(s):s\in S\}\subset\mathbb R$. We claim that $T$ is countable. Since $S$ is countable, either $S$ is finite or there exists a surjective map $a:\mathbb N\to S$. If $S$ is finite, then $T=g(S)$ is finite and hence countable. If $a:\mathbb N\to S$ is surjective, define $b:\mathbb N\to T$ by $b(n)=g(a(n))$. For every $t\in T$, there exists $s\in S$ with $t=g(s)$, and by surjectivity of $a$ there exists $n\in\mathbb N$ with $a(n)=s$. Hence $b(n)=t$, so $b$ is surjective. Therefore $T$ is countable.
[guided]
The purpose of this step is to transfer countability through the function $g$. Define $T:=g(S)=\{g(s):s\in S\}\subset\mathbb R$. We need to prove that $T$ is countable, because this will become the countable set on which $g(X)$ is supported.
There are two cases. If $S$ is finite, then its image $g(S)$ is finite, so $T$ is countable. If $S$ is infinite countable, then by countability there exists a surjective map $a:\mathbb N\to S$. We use this enumeration of $S$ to enumerate the image. Define $b:\mathbb N\to T$ by $b(n)=g(a(n))$.
We verify that $b$ is surjective. Let $t\in T$. By the definition of $T=g(S)$, there exists $s\in S$ such that $t=g(s)$. Since $a:\mathbb N\to S$ is surjective, there exists $n\in\mathbb N$ such that $a(n)=s$. Therefore $b(n)=g(a(n))=g(s)=t$. Thus every element of $T$ is hit by $b$, so $T$ is the image of $\mathbb N$ under a surjective map. Hence $T$ is countable.
[/guided]
[/step]
[step:Transfer the almost-sure support from $X$ to $g(X)$]
Define the composition $Y:(\Omega,\mathcal F)\to(\mathbb R,\mathcal B(\mathbb R))$ by $Y(\omega)=g(X(\omega))$. For every $\omega\in A$, we have $X(\omega)\in S$, and therefore $Y(\omega)=g(X(\omega))\in g(S)=T$. Thus $A\subset Y^{-1}(T)$. Since $\mathbb P(A)=1$ and $\mathbb P$ is a probability measure, monotonicity gives
\begin{align*}
\mathbb P(A)\leq \mathbb P(Y\in T)\leq 1.
\end{align*}
Hence
\begin{align*}
\mathbb P(Y\in T)=1.
\end{align*}
[/step]
[step:Verify measurability of the composition and conclude discreteness]
We verify that $Y=g\circ X$ is a real-valued random variable. Let $B\in\mathcal B(\mathbb R)$. Since $g$ is Borel measurable, $g^{-1}(B)\in\mathcal B(\mathbb R)$. Since $X$ is measurable, $Y^{-1}(B)=X^{-1}(g^{-1}(B))\in\mathcal F$. Therefore $Y:(\Omega,\mathcal F)\to(\mathbb R,\mathcal B(\mathbb R))$ is measurable. From the previous step, $Y$ is supported almost surely on the countable set $T$. Therefore $Y=g(X)$ is a discrete real-valued random variable.
[/step]