In Markov inequality proof, why is $\int_a^\infty xp(x) \, dx \ge \int_a^\infty ap(x) \, dx$ Markov inequality, 
$$\Pr(X \ge a) \le \frac{E[x]}{a}$$
Proof
$$\begin{aligned} 
    E(X) &= \int_0^\infty xp(x)\,dx = \int_0^a xp(x)\,dx + \int_a^\infty xp(x)\,dx \\  
    &\ge \int_a^\infty xp(x)\,dx \ge \int_a^\infty ap(x) \, dx 
\end{aligned}$$
Why is the last inequality true?
Why is it ok to change $x$ to $a$, and we know it is less than or equal to?
How did they figure it out?
Thanks!

For every $x\ge a$, 
$$
xp(x) \ge ap(x)
$$
and using positivity of $\int$ and $p(x)$:
$$
\int_a^\infty xp(x) \,dx \ge \int_a^\infty  ap(x) \,dx
$$
