Demonstrating Markov inequality on a uniform distribution

I was reading about the Markov inequality and tried to see if I could prove it for a uniform distribution. So say we have $X\sim U(a,b)$ and we are trying to prove

$$\mathop{\mathbb{P}}(X\ge \lambda)\le \frac{\mathop{\mathbb{E}}(X)}{\lambda}$$

So the right hand side is just

$$\frac{a+b}{2\lambda}$$

and I thought the left hand side should be

$$\int_{\lambda}^{b}\frac{1}{b-a}dx = \frac{b-\lambda}{b-a}$$

So now I would have to prove that

$$\frac{b-\lambda}{b-a} \le \frac{a+b}{2\lambda}$$

So if it's fair to assume (is it?) that $a< \lambda <b$, then after a bit of rearranging we have

$$b \lambda-\lambda ^2 \le \frac{b^2+a^2}{2}$$

and it is clear to me that $b^2+a^2$ is larger than $b \lambda-\lambda ^2$ but I don't see how to prove that it is more than twice as large.

• Why don't you get (b-a)(b+a)= b$^2$-a$^2$? – Michael Chernick Jul 26 '17 at 3:10
• @MichaelChernick oh you're right! But that means that the answer by Glen_b is also wrong as he was starting after my error... – Dan Nov 8 '17 at 15:44

As the sum of three squares, $(b-\lambda)^2+a^2+\lambda^2\geq 0$. (Hopefully that's obvious.)
Expand and rearrange so that terms in $\lambda$ are on the other side. Presumably you can see how to proceed from there.
• To get that, I started with $b^2+a^2\geq 2b\lambda-2\lambda^2$, put everything on the LHS, recognized the possibility to make $(b-\lambda)^2$ and then that the remaining terms would also be squares, which would clearly be $\geq 0$ as required. When you're trying to show something is non-negative, completing the square is an obvious thing to do. Ultimately the $2b\lambda$ term is what drives everything there. – Glen_b Jul 26 '17 at 0:03