Expectation and PDF of bus waiting time 
I have a constant chance of arriving at the bus stop at all times during the hour, and two buses arrive per hour - one on the hour and one at 40 minutes past the hour. If $S$ is the time I wait for the bus, what is the pdf and the expected time I have to wait until the bus comes? 

I am trying to solve the above question. I'm getting the expected time to be $16.666$ but I'm not sure if this is correct. I'm also not sure how to find the pdf. Thanks in advance for any help.
 A: It's useful to split this into two cases as a function of the arrival time. Let event $A_0=$ arrival at bus stop before 40 minutes past the hour (that is, $\geq 0$ but $<40$ minutes), and $A_1=$ arrival at bus stop $\geq 40$ minutes past the hour. These events have probabilitites
$$
P(A_0) = \frac{40}{60} = \frac{2}{3}; \qquad P(A_1) = \frac{1}{3}
$$
Now we can consider the waiting time for a bus. Let $S$ be the waiting time in minutes. Now the CDF is
$$
\begin{split}
F_S(S) = P(S<s) &= P(S<s|A_0)P(A_0) + P(S<s | A_1)P(A_1) \\
\end{split}
$$
The term $P(S=s|A_0)$ is evenly distributed between $0$ and $40$, and the term $P(S=s | A_1)$ is evenly distributed between $0$ and $20$, and therefore
$$
\begin{split}
F_S(s) = P(S<s) &= P(S<s|A_0)P(A_0) + P(S<s | A_1)P(A_1) \\
&= \text{Uniform}[0,40] \frac{2s}{3} + \text{Uniform}[0,20]\frac{1s}{3}
\end{split}
$$
Therefore, the PDF is (just the derivative of $F_S$)
$$
f_S(s) = \left\{
\begin{array}{ccc}
\frac{1}{30},& 0 \leq s \leq 20 \\
\frac{1}{60},& 20 \leq s \leq 40 \\
0 , & \text{otherwise}
\end{array}
\right.
$$
The mean value is
$$
\mathbb{E}[S] = \int_0^{40}f_S(s') s' \, ds' = \int_0^{20} \frac{s'}{30} \, ds' + \int_{20}^{40} \frac{s'}{60} \, ds' = \frac{20}{3} + 10 \approx 16.6667
$$
A: Guide:
For the density, it has the form of 
$$f(t) = \begin{cases} 2c & 0 < t < 20 \\ c & 20 \le t < 40 \\ 0 & \text{Otherwise} \end{cases}$$
Just determine $c$ to make it a pdf.
Your expected value is fine.
A: Your chances of arriving at the bus stop between H:00 and H:40 are 2/3, and 1/3 between H:40 and H+1:00.
If you arrive in the first two/thirds of the hour, your waiting time is distributed evenly over the interval (0,40). In the other case, over (0,20).
The total pdf will be (1/60')*F,
where
F is 2 for t in (0,20), and
F is 1 for t in (20,40).
Not sure about the values at the transition points (0, 20, and 40), but as they form a set of measure 0, they have no practical importance.
Hope this helps.
