Bernt Oksendal - Stochastic differential equations question 2.1 part a I have just started working through Bernt Oksendal's Stochastic Differential equations and I basically want to double check my answer since the book does not have solutions for this particular question. 
The question is as follows
Suppose that $X:\Omega \to \mathbb{R}$ is a function that assumes only countably many values $a_1,a_2,... \in\mathbb{R}$.
a) show that $X$ is a random variable if and only if   
$X^{-1}(a_k) \in \mathcal{F} $  for all k=1,2,... (where $\mathcal{F}$ is the $\sigma$ algebra on $\Omega$) 
My answer to this bit is as follows
A random variable $X$ is an $\mathcal{F}$-measurable function $X:\Omega \to \mathbb{R}^n$ and a function $X$ is $\mathcal{F}$-measurable if $X^{-1}(U) := \{\omega \in \Omega ; X(\omega) \in U\} \in \mathcal{F}$  for all open sets $U\in \mathbb{R}^{n}$
Therefore since $X$ can only take values $a_1,a_2,... \in \mathbb{R}$ (i.e $X(\omega)$ takes values $a_1,a_2...$ ), for $X$ to be $\mathcal{F}$ measurable we must have  $a_1,a_2,... \in U$ and therefore $X^{-1}(a_k) \in \mathcal{F}$
Basically is what I have done correct? 
 A: It's unclear what you mean when you say you must have $a_1,a_2,\ldots \in U ...$ surely you don't mean that each point is in every open set $U$?
If the set of values were finite, you could use the fact that you can cover them with disjoint open sets, but the fact that one or more of them could be a limit point complicates this. However, note that a point can always be separated from the rest by a countable intersection of open sets, since we an easily show that the point itself is equal to some countable intersection of open intervals. So since the inverse image of an open set is measurable, we can write $X^{-1}(\{a_i\})$ as a countable intersection of measurable sets, which is measurable. So that shows that if $X$ is measurable, then $X^{-1}(\{a_i\})$ must be. 
And note that the proof of this direction had nothing to do with the set of values being countable. The inverse image of a singleton under a measurable function (where the image space is $\mathbb R$ with the Borel measure) is always measurable. In fact the usual (and more general) definition of measurability is simply that the inverse image of a measurable set is measurable, so this and the fact that a singleton in $\mathbb R$ is Borel-measurable implies that $X^{-1}(\{a_i\})$ is measurable.
The other direction needs the countability. The inverse image of an open set $U$ (or any set, actually) is the inverse image of some subset of the $a_i$ (whichever of the $a_i$ are in $U$).  Under the assumption that the inverse image of each $a_{i}$ is measurable, this will be a countable union of measurable sets, which is measurable.
