Train wait problem, probability If one commuter train comes every $15$ minutes and another comes every $40$ minutes, what is the average amount of time one would have to wait before getting on a train? Suppose that they are not synchronized.
The answer by the way is $6.5$ minutes. 
I don't see how the trains are not synchronized. Because they will arrive at the same time in $15*40$ minutes. Not sure if I understood the problem. 
I think it relates to the uniform distribution and the expected value of the uniform distribution. 
Please show steps in how you solve it. 
 A: The probability that you have to wait more than $x$ minutes for the $15$-minute train is the probability that you are in the first $15-x$ minutes of its cycle, which assuming a uniform distribution is
$$\frac{15-x}{15}=1-\frac{x}{15}\quad\hbox{for $0\le x\le15$}\ .$$
The probability that you have to wait more than $x$ minutes for the other train is similarly
$$1-\frac{x}{40}\quad\hbox{for $0\le x\le40$}\ .$$
The probability that you have to wait more than $x$ minutes for the first train to arrive is
$$\Bigl(1-\frac{x}{15}\Bigr)\Bigl(1-\frac{x}{40}\Bigr)\quad\hbox{for $0\le x\le15$}\ ,$$
assuming independence since the trains are not synchronised.  The cumulative probability function for your waiting time is
$$P(X\le x)=1-\Bigl(1-\frac{x}{15}\Bigr)\Bigl(1-\frac{x}{40}\Bigr)
  =\frac{11x}{120}-\frac{x^2}{600}\ .$$
The density function is
$$f(x)=\frac{d}{dx}P(X\le x)=\frac{11}{120}-\frac{x}{300}\quad\hbox{for $0\le x\le15$}$$
and the expected waiting time is
$$E(X)=\int_0^{15} xf(x)\,dx=\cdots=6.5625\ .$$
A: Since the trains are not synchronized, we don't know which train is in front of the other, nor how long it will take before either train shows up. All we know are the maximum wait times for each.
Let $x$ be the amount of time we must wait if we wanted to board train $1$, and let $y$ be the amount of time we must wait if we wanted to board train $2$ instead. Since we want to board the train that arrives first, we are trying to solve for $E(\min(x,y))$.
The possible combinations of wait times are distrbuted over $0 \leq x \leq 15$ and $0 \leq y \leq 40$. Therefore:
$E(\min(x,y)) = \frac{\int_0^{15}\int_{0}^{40} \min(x,y) ~dydx}{\int_0^{15}\int_{0}^{40} (1) ~dydx } = \frac{\int_0^{15}\int_{x}^{40} x ~dy dx + \int_0^{15}\int_{0}^{x} y ~dydx}{600} = \frac{3375 + 562.5}{600} = 6.5625$
A: Synchronised means there is a time when the trains arrive at the same time.  If we set a stopwatch clock to $0:00$ at this time, then we generate the following table:
$$\begin{array}{lll}A & \textsf{next train}
\\ \hline 0:00 & 0:15 & \textsf{both trains arrive at same time}
\\ 0:15 & 0:30
\\ 0:30 & 0:40
\\ 0:40 & 0:45
\\ 0:45 & 1:00
\\ 1:00 & 1:15
\\ 1:15 & 1:20
\\ 1:20 & 1:30
\\ 1:30 & 1:45
\\ 1:45 & 2:00 & \textsf{when the trains arrive at same time again}
\\\hdashline 2:00 & 2:15
\\ \vdots & \vdots
\end{array}$$
Suppose instead the $40$ minute train arrives some $x$ minutes after the clock is set, for $0<x<5$. (NB: If $x=5$ they will arrive at the same time at $0:45$, but if the offset is less than 5 minutes they will never arrive at the same time, because the cycle returns to the same situation with period of 2 hours).
$$\begin{array}{lll}A & \textsf{next train}
\\ \hline 0:00 & 0:00+x 
\\ 0:00+x & 0:15
\\ 0:15 & 0:30
\\ 0:30 & 0:40+x
\\ 0:40+x & 0:45
\\ 0:45 & 1:00
\\ 1:00 & 1:15
\\ 1:15 & 1:20+x
\\ 1:20+x & 1:30
\\ 1:30 & 1:45
\\ 1:45 & 2:00
\\\hdashline 2:00 & 2:00+x
\\ \vdots & \vdots
\end{array}$$
A: The expected waiting time depends on the (unknown) synchronization of the trains. Since everything repeats after $120$ minutes we may assume that there is a $c$ with $0\leq c<5$ such that successive trains come at the following times:
$$0,\ c, \ 15+c, \ 30+c, \ 40, \ 45+c, \ 60+ c, \ 75+c, \ 80, \ 90+c, \ 105+c, \ 120\ .$$ 
Five of the eleven intervals between trains have length $15$, causing an average waiting time of $7.5$ minutes when arriving at the station in one of these intervals. The other six intervals have to be taken care of individually. In all the expected waiting time  computes to
$$\eqalign{E(W|c)&={5\over8}\cdot 7.5+{c\over120}{c\over2}+{10-c\over120}{10-c\over2}+{5
+c\over120}{5+c\over2}\cr&\qquad\qquad+{5-c\over120}{5-c\over2}+{10+c\over120}{10+c\over2}+{15-c\over120}{15-c\over2}\cr
&={75\over16}+{6c^2-30c+475\over 240}\ .\cr}$$
This can be written as
$$E(W|c)={625\over96}+{(c-2.5)^2\over40}\ .$$
The minimal and maximal values of $E(W|c)$ are therefore $E(W|2.5)\doteq6.51$ and $E(W|0)={20\over3}\doteq6.667$. The mean of $E(W|c)$ over a uniformly distributed $c$ computes to the value $6.5625$ obtained by Marcus Andrews.
A: Here is a picture of the schedule for a $120$ minute period, after which the whole schedule repeats. We can let the initial delay between trains be $0\le x\lt5$, since the other delays of $5\le x\lt10$ and $10\le x\lt15$ are represented later in the cycle.

The probability of arriving in each of the intervals is proportional to the length of that interval. The average wait in each interval is half the length of that interval. That is, for a given interval of $t$, the contribution to the average wait time is
$$
\overbrace{\ \ \ \frac{t}2\ \ \ }^{\text{average wait}}\ \ \overbrace{\ \frac{t}{120}\ }^{\text{probability}}=\frac{t^2}{240}
$$
Thus, the average wait for a given $x$ is
$$
\begin{align}
&\frac{x^2}{240}+\frac{(5+x)^2}{240}+\frac{(10+x)^2}{240}
+\frac{(15-x)^2}{240}+\frac{(10-x)^2}{240}+\frac{(5-x)^2}{2400}+5\cdot\frac{15^2}{240}\\[6pt]
&=\frac{1600-30x+6x^2}{240}
\end{align}
$$
Assuming that $x$ is evenly distributed, we get an average wait time of
$$
\frac15\int_0^5\frac{1600-30x+6x^2}{240}\,\mathrm{d}x=\frac{105}{16}=6.5625
$$
