Piece-wise probability density and cumulative distribution function exercise Given a random variable $X$ with the density function:
$f(x) = a$ if $0 \leq x \leq b$      and 
$f(x) = b$ if $b < x < a + b$
I want to solve the following exercises regarding this distribution:
a) How large is $a$ if $b = 3a$?
b) $a = 0.5, b = 1$, then:
i) What is $P(X>1)$?
ii) What is $P(0.8<X<1.2)$
iii) What is $x_1$ s.t. $ P(X<x_1) = 0.05$?
c) Calculate $F(x)$
My ideas:
a) The area under the function has to sum up to $1$, hence I assume that $6a^2 = 1$ and hence $a = \sqrt{1/6}$ — is that correct?
b)
i) $[\frac{1}{2}x^2]_1^{1.5}$ 
ii) $ 0.5 * [\frac{1}{2}x^2]_{0.8}^{1} + [\frac{1}{2}x^2]_1^{1.2}$
iii) My idea would to solve for b in $\int_{0}^b f(x) x dx = 0.5 $ — but how exactly would I formulate $f(x)$?
c) I would assume we end up with two $F(x)$, each one being the integral of the respective $f(x)$ and hence $0.5x$ and $x$ respectively, is that correct?
Thanks

Your value for (a) is correct.
For (b), it seems you have somehow derived the wrong CDF $F(x)$.  The PDF $f(x)$ is piecewise constant:
$$
f(x) = \begin{cases}
    \hfill \frac{1}{2} \hfill & 0 \leq x \leq 1 \\
    \hfill 1 \hfill & 1 < x < \frac{3}{2}
\end{cases}
$$
(It looks like an L rotated $90$ degrees counter-clockwise.)  You seem to have assumed that the PDF was
$$
f(x) = \begin{cases}
    \hfill \frac{x}{2} \hfill & 0 \leq x \leq 1 \\
    \hfill x-\frac{1}{2} \hfill & 1 < x < \frac{3}{2}
\end{cases}
$$
However, seemingly, you have produced the correct CDF $F(x)$ in part (c); it is, in fact,
$$
F(x) = \begin{cases}
    \hfill \frac{x}{2} \hfill & 0 \leq x \leq 1 \\
    \hfill x-\frac{1}{2} \hfill & 1 < x < \frac{3}{2}
\end{cases}
$$
That is, exactly what you seem to have used for $f(x)$ in part (b).
