Why is $P(X \geq a)$ the same as $E[\mathbf{1}_{X \geq a}]$ in a proof of the markov's inequality I didn't understand the last step 
the markov's inequality : $$P(X \geq a) \leq \frac{E[X]}{a}$$
let $X : \Omega \to \Bbb{R}$ be a random variable
let $$\mathbf{1}_{X \geq a} :\mathbb{R} \to \{0,1\}$$
$$\mathbf{1}_{X \geq a}(X) =
\begin{cases}
0,  & \text{if $X<a$ } \\
1, & \text{if $X\geq a$ }
\end{cases}$$
and let $$g = a \cdot \mathbf{1}_{X \geq a} :\mathbb{R} \to \{0,a\}$$
$$g(X) =
\begin{cases}
0,  & \text{if $X<a$ }  \\
a, & \text{if $X\geq a$ }
\end{cases}$$
then $$g(X) \leq X$$
$$E[g(X)] \leq E[X]$$
$$a\cdot E[\mathbf{1}_{X \geq a}(X)] \leq E[X]$$
$$E[\mathbf{1}_{X \geq a}(X)] \leq \frac{E[X]}{a} \implies P(X \geq a) \leq \frac{E[X]}{a}$$
I didn't understand this last step can someone please elucidate.

Taking expectation is to integrate a random variable over the outcome space w.r.t the probability measure. Recall that $\int_{\Omega} 1_{A} dP = \int_{A} 1 dP = P(A)$ by basic properties of Lebesgue integration.
Also note that the set $\{ X \geq a \}$ is the shorthand for $\{ \omega \in \Omega \mid X(\omega) \geq a \}$ which is always a subset of $\Omega$ and which is actually simply the preimage $X^{-1}([a, +\infty])$.
