Expected value of waiting time for the first of the two buses running every 10 and 15 minutes I came across an interview question:

There is a red train that is coming every 10 mins. There is a blue train coming every 15 mins. Both of them start from a random time so you don't have any schedule. If you arrive at the station at a random time and go on any train that comes the first, what is the expected waiting time?

 A: The answer is $$E[t]=\int_x\int_y \min(x,y)\frac 1 {10} \frac 1 {15}dx dy=\int_x\left(\int_{y<x}ydy+\int_{y>x}xdy\right)\frac 1 {10} \frac 1 {15}dx$$
Get the parts inside the parantheses:
$$\int_{y<x}ydy=y^2/2|_0^x=x^2/2$$
$$\int_{y>x}xdy=xy|_x^{15}=15x-x^2$$
So, the part is:
$$(.)=\left(\int_{y<x}ydy+\int_{y>x}xdy\right)=15x-x^2/2$$
Finally, $$E[t]=\int_x (15x-x^2/2)\frac 1 {10} \frac 1 {15}dx=
(15x^2/2-x^3/6)|_0^{10}\frac 1 {10} \frac 1 {15}\\=
(1500/2-1000/6)\frac 1 {10} \frac 1 {15}=5-10/9\approx 3.89$$
Here's the MATLAB code to simulate:
nsim = 10000000;
red= rand(nsim,1)*10;
blue= rand(nsim,1)*15;
nextbus = min([red,blue],[],2);
mean(nextbus)

A: Assuming each train is on a fixed timetable independent of the other and of the traveller's arrival time, the probability neither train arrives in the first $x$ minutes is $\frac{10-x}{10} \times \frac{15-x}{15}$ for $0 \le x \le 10$, which when integrated gives $\frac{35}9\approx 3.889$ minutes
Alternatively, assuming each train is part of a Poisson process, the joint rate is $\frac{1}{15}+\frac{1}{10}=\frac{1}{6}$ trains a minute, making the expected waiting time $6$ minutes 
A: I am probably wrong but assuming that each train's starting-time follows a uniform distribution, I would say that when arriving at the station at a random time the expected waiting time for:


*

*the $R$ed train is $\mathbb{E}[R] = 5$ mins

*the $B$lue train is $\mathbb{E}[B] = 7.5$ mins

*the train that comes the first is $\mathbb{E}[\min(R,B)] =\frac{15}{10}(\mathbb{E}[B]-\mathbb{E}[R]) = \frac{15}{4} = 3.75$ mins



As pointed out in comments, I understood "Both of them start from a random time" as "the two trains start at the same random time". Which is a very limiting assumption.
A: Suppose that red and blue trains arrive on time according to schedule, with the red schedule beginning $\Delta$ minutes after the blue schedule, for some $0\le\Delta<10$. For definiteness suppose the first blue train arrives at time $t=0$.
Assume for now that $\Delta$ lies between $0$ and $5$ minutes. Between $t=0$ and $t=30$ minutes we'll see the following trains and interarrival times: blue train, $\Delta$, red train, $10$, red train, $5-\Delta$, blue train, $\Delta + 5$, red train, $10-\Delta$, blue train. Then the schedule repeats, starting with that last blue train.
If $W_\Delta(t)$ denotes the waiting time for a passenger arriving at the station at time $t$, then the plot of $W_\Delta(t)$ versus $t$ is piecewise linear, with each line segment decaying to zero with slope $-1$. So the average wait time is the area from $0$ to $30$ of an array of triangles, divided by $30$. This gives
$$
\begin{align}\bar W_\Delta &:= \frac1{30}\left(\frac12[\Delta^2+10^2+(5-\Delta)^2+(\Delta+5)^2+(10-\Delta)^2]\right)\\&=\frac1{30}(2\Delta^2-10\Delta+125).
\end{align}$$
Notice that in the above development there is a red train arriving $\Delta+5$ minutes after a blue train. Since the schedule repeats every 30 minutes, conclude $\bar W_\Delta=\bar W_{\Delta+5}$, and it suffices to consider $0\le\Delta<5$.
If $\Delta$ is not constant, but instead a uniformly distributed random variable, we obtain an average average waiting time of
$$
\frac15\int_{\Delta=0}^5\frac1{30}(2\Delta^2-10\Delta+125)\,d\Delta=\frac{35}9.$$
A: This is a Poisson process. 
The red train arrives according to a Poisson distribution wIth rate parameter 6/hour.
The blue train also arrives according to a Poisson distribution with rate 4/hour. 
Red train arrivals and blue train arrivals are independent. 
Total number of train arrivals Is also Poisson with rate 10/hour.  Since the sum of 
The time between train arrivals is exponential with mean 6 minutes.  Since the exponential mean is the reciprocal of the  Poisson rate parameter.
Since the exponential distribution is memoryless,  your expected wait time is 6 minutes. 
A: One way to approach the problem is to start with the survival function.  In order to have to wait at least $t$ minutes you have to wait for at least $t$ minutes for both the red and the blue train.   Thus the overall survival function is just the product of the individual survival functions:
$$ S(t) = \left( 1 - \frac{t}{10} \right) \left(1-\frac{t}{15} \right) $$
which, for $0 \le t \le 10$, is the the probability that you'll have to wait at least $t$ minutes for the next train. This takes into account the clarification of the the OP in a comment that the correct assumptions to take are that each train is on a fixed timetable independent of the other and of the traveller's arrival time, and that the phases of the two trains are uniformly distributed,
Then the pdf is obtained as
$$ p(t) = (1-S(t))' = \frac{1}{10} \left( 1- \frac{t}{15} \right) + \frac{1}{15} \left(1-\frac{t}{10} \right) $$
And the expected value is obtained in the usual way:
$E[t] = \int_0^{10} t p(t) dt = \int_0^{10}  \frac{t}{10} \left( 1- \frac{t}{15} \right) + \frac{t}{15} \left(1-\frac{t}{10} \right) dt = \int_0^{10} \left( \frac{t}{6} - \frac{t^2}{75} \right) dt$,
which works out to $\frac{35}{9}$ minutes.
