Prove that $X : \Omega \to \Bbb R$ is a random variable if $X$ is constant. I have to prove this:

Let $(\Omega, \mathcal F)$ be a measurable space,  $\mathcal F=\{\emptyset,  \Omega\}$ prove that   $X : \Omega \to \Bbb R$ is a random variable if and only if $X$ is constant.

I've tried using that $X$ is a random variable iff $X^{-1}B \in \mathcal F$ if $B$ is a Borel set but I cannot conclude anything, also I´ve tried with the other definition: $X$ is a random variable iff $(X \le x) \in \mathcal F$ $  \forall x \in R$.
Any hint or idea about what definition of random variable should I use?
 A: 
I've tried using that $X$ is a random variable iff $X^{-1}B \in \mathcal F$ if $B$ is a Borel set but I cannot conclude anything, also I've tried with the other definition: $X$ is a random variable iff $(X \le x) \in \mathcal F$ $  \forall x \in R$

You are on the right track. Either idea will work, but let's go with your second idea. Since $\mathcal{F} = \{\varnothing, \Omega\}$ (there are only two measurable sets), the statement "$\{X \le x\} \in \mathcal{F}$" is equivalent to
$$
\{X \le x\} = \varnothing \qquad\text{OR}\qquad \{X \le x \} = \Omega
$$
And that has to be true for all $x$. Now (assuming $\Omega$ nonempty), let $a \in \Omega$, and consider $X(a)$. What can you say about
$$
\{X \le X(a)\}?
$$
Also, what can you say about
$$
\{X \le y\}
$$
for any $y < X(a)$?
A: Use the second definition. Let $c=\sup \{x:\{X\leq x\} \neq \Omega\}$. Verify that $-\infty<c<\infty$. Note that $\{X\leq x\}=\Omega$ for $x>c$ and conclude that $X\leq c$. Next,note that $\{X\leq x\}=\emptyset$ for all $x<c$. Conclude that $X=c$.
