CDF of a random variable defined by a coin toss. Assume that you choose point $\xi$ from $[1,4]$ in the following way. You toss a coin that can give head, tail or stood on edge with equal probabilities. If it stood on edge, then $\xi = 3$. If tail, then you going to choose $\xi$ randomly from $[1,2]$. If head, then randomly from $[2,4]$. The question is what are cumulative density function, mean and variance of such random variable?
Let's start from CDF. It is obvious that for $t \leq 1$ $F_\xi(t) = 0$ and for $t \geq 4$ $F_\xi(t) = 1$. I assumed that $F_\xi(t) = \frac{1}{3}\cdot\frac{t-1}{1}$ for $1 \leq t < 2$ and $F_\xi(t) = \frac{1}{3}+\frac{t-2}{4-2}=\frac{3t-4}{6}$ for $2 \leq t < 4$. Am I right or are there any mistakes here? Further computations of $M\xi$ and $D\xi$ are rather straightforward from CDF (split integral from $1$ to $4$ into two integrals from $1$ to $2$ and from $2$ to $4$ with corresponding derivatives of CDF on each interval). 
 A: Not quite. You do not seem to have taken into account the fact that the coin could fall on it's edge, so the probability of $3$ appearing is larger than you have shown it.
More precisely, you are right that the CDF is zero before $1$  and one after $4$.
Let us find $P(\xi \leq k)$. Note that if we define the random variable $C = 0,1,2$ with probability $\frac 13$  each (for the coin toss with $0$ representing the coin falling on an edge, $1$ representing tail and $2$ representing head), then $$P(\xi \leq k) = P(C = 0)P(\xi \leq k | C = 0) + P(C = 1)P(\xi \leq k | C = 1)  + P(C = 2)P(\xi \leq k | C = 2)$$
Now we can split into cases. Suppose that $1 \leq k < 2$. Then, note that the first and last term above would be zero, so the answer is just $\frac{1}{3}\frac{k-1}{1}  = \frac {k-1}3$, as you had predicted.
Suppose that $2 \leq k < 3$. Note that the second event occurs with probability $\frac 13$ now, since if $C=1$,  then every element picked uniformly from $[1,2]$ is smaller than $k$. The third event also occurs, and has probability $\frac{k - 2}{6}$. So the answer would be $\frac{1}{3} + \frac{k-2}{6} = \frac{k}{6}$.
For $3 \leq k \leq 4$, all three events above occur. Note that now, both the first and second event occur with probability $\frac 13$ each, and the third event occurs with probability $\frac{k-2}{6}$, again. Hence, here the answer is $\frac{k + 2}{6}$. 
Hence, the final CDF is:
$$
F(k) = \begin{cases}
0 & k \leq 1 \\
\frac{k-1}{3} & 1 \leq k < 2 \\
\frac k6 & 2 \leq k < 3 \\
\frac{k+2}6 & 3 \leq k \leq 4 \\
1 & k \geq 4
\end{cases}
$$
NOTE : As expected, there is a jump at $3$ of the CDF : the probability that $\xi = 3$ is non-zero, so this expected. This was not observed in your function, for example.
Now, you can use this function to get down to your expectation and variance calculations.
