\documentclass{article}
\input{18440-preamble}

\begin{document}
\pset{6}{Dan Ports}{2003/10/20}{drkp@mit.edu}

\begin{ppart}{Problem 1}
\paragraph{Part a}
The boundaries of the probability space are the lines $y=0$, $x=1$, and $y=x$. 
The lines dividing the regions are $y=y-x$ (or $y=\frac{x}{2}$), $y=1-x$, and $y-x=1-x$, or ($y=2x-1$).
See the attached sketch.
\paragraph{Part b}
\[X = \begin{cases}
y & R_{ABC}\\
y & R_{ACB}\\
y-x & R_{BAC}\\
y-x & R_{BCA}\\
1-x & R_{CAB}\\
1-x & R_{CBA} \\
\end{cases}
\]
\paragraph{Part c}
\begin{eqnarray*}
\Pr{R_{ABC}} &=& 2\int_{\frac{2}{3}}^1\int_{\frac{x}{2}}^{2x-1} \,dy\,dx = \frac{1}{6} \\
\Pr{R_{ACB}} &=& 2\int_{\frac{1}{2}}^{\frac{2}{3}}\int^{x}_{1-x} \,dy\,dx +  2\int_{\frac{2}{3}}^1\int^{x}_{2x-1} \,dy\,dx = \frac{1}{18} + \frac{1}{9} = \frac{3}{18}\\
\Pr{R_{BAC}} &=& 2\int_{\frac{2}{3}}^1\int^{\frac{x}{2}}_{1-x} \,dy\,dx = \frac{1}{6} \\
\Pr{R_{BCA}} &=& 2\int_{\frac{1}{2}}^{\frac{2}{3}}\int_0^{2x-1} \,dy\,dx +  2\int_{\frac{2}{3}}^1\int^{0}_{1-x} \,dy\,dx = \frac{1}{18} + \frac{1}{9} = \frac{3}{18}\\
\Pr{R_{CAB}} &=& 2\int_{0}^{\frac{1}{2}}\int_{\frac{x}{2}}^{x} \,dy\,dx +  2\int_{\frac{1}{2}}^{\frac{2}{3}}\int_{\frac{x}{2}}^{1-x} \,dy\,dx = \frac{1}{8} + \frac{1}{24} = \frac{1}{6}\\
\Pr{R_{CAB}} &=& 2\int_{0}^{\frac{1}{2}}\int_{\frac{x}{2}}^{x} \,dy\,dx +  2\int_{\frac{1}{2}}^{\frac{2}{3}}\int_{\frac{x}{2}}^{1-x} \,dy\,dx = \frac{1}{8} + \frac{1}{24} = \frac{1}{6}\\
\Pr{R_{CBA}} &=& 2\int_{0}^{\frac{1}{2}}\int^{\frac{x}{2}}_0 \,dy\,dx +  2\int_{\frac{1}{2}}^{\frac{2}{3}}\int^{\frac{x}{2}}_{2x-1} \,dy\,dx = \frac{1}{8} + \frac{1}{24} = \frac{1}{6}\\
\end{eqnarray*}


\paragraph{Part d}
\begin{eqnarray*}
\E{X} &=& \int\int_{S} X\,dA\\
&=& \int\int_{R_{ABC}} y\,dA + \int\int_{R_{ACB}} y\,dA + \int\int_{R_{BAC}} x-y\,dA\\
&&+ \int\int_{R_{BCA}} x-y\,dA + \int\int_{R_{CAB}} 1-x\,dA + \int\int_{R_{CBA}} 1-x\,dA \\
&=&  2\int_{\frac{2}{3}}^1\int_{\frac{x}{2}}^{2x-1} y \,dy\,dx \\
&&+ 2\int_{\frac{1}{2}}^{\frac{2}{3}}\int^{x}_{1-x} y\,dy\,dx +  2\int_{\frac{2}{3}}^1\int^{x}_{2x-1} y\,dy\,dx  \\
&&+ 2\int_{\frac{2}{3}}^1\int^{\frac{x}{2}}_{1-x} x-y \,dy\,dx \\
&&+ 2\int_{\frac{1}{2}}^{\frac{2}{3}}\int_0^{2x-1} x-y\,dy\,dx +  2\int_{\frac{2}{3}}^1\int^{0}_{1-x} x-y\,dy\,dx \\
&&+ 2\int_{0}^{\frac{1}{2}}\int_{\frac{x}{2}}^{x} 1-x\,dy\,dx +  2\int_{\frac{1}{2}}^{\frac{2}{3}}\int_{\frac{x}{2}}^{1-x} 1-x\,dy\,dx \\
&&+ 2\int_{0}^{\frac{1}{2}}\int^{\frac{x}{2}}_0 1-x\,dy\,dx +  2\int_{\frac{1}{2}}^{\frac{2}{3}}\int^{\frac{x}{2}}_{2x-1} 1-x\,dy\,dx \\
&=& \frac{11}{108} + \frac{1}{36} + \frac{2}{27} + \frac{11}{108} + \frac{1}{36} + \frac{2}{27} + \frac{1}{12} + \frac{1}{54} + \frac{1}{12} + \frac{1}{54}\\
&=& \frac{11}{18}
\end{eqnarray*}
\end{ppart}

\begin{ppart}{Problems 2 \& 3}
We consider the general case of service stations located at points $a$, $b$, $c$ ($0 \le a \le b \le c \le 100$). Then the expected distance is 
\begin{eqnarray*}
\E{X} &=& \int_0^a a-x \, dx + \int_a^{a+\frac{b-a}{2}} x-a\,dx \\  
&& + \int^b_{a+\frac{b-a}{2}} b-x\,dx + \int_b^{b+\frac{c-b}{2}} x-b\,dx \\
  && + \int^c_{b+\frac{c-b}{2}} c-x\,dx + \int_c^{100} x-c\,dx \\
&=& \frac{b^2}{2}+b\left(-\frac{c}{2}-\frac{a}{2}\right)+\frac{3c^2}{4}-100c+\frac{3a^2}{4} + 5000 \\
\end{eqnarray*}
For the case in which the service stations are located in towns A and B and exactly in between, $a = 0$, $b=50$, and $c=100$. Using the formula above, $\E{X} = 25$.

When the service stations are located at $a=25$, $b=50$, $c=75$, $\E{X} = 17.375$. So this is a better location than before.

To find the optimum locations, we take the partial derivative with respect to $a$ and set it equal to zero:
\[\frac{3a}{2} - \frac{b}{2} = 0\]
So $a = \frac{b}{3}$. Next, taking the partial derivative with respect to $b$ and setting it equal to zero:
\[\frac{5b}{6} - \frac{c}{2} = 0\]
So $b = \frac{3c}{5}$. Finally, taking the partial derivative with respect to $c$ and setting it equal to zero:
\[\frac{6c}{5} - 100 = 0\]
So we conclude $c = \frac{5}{6}100 \approx 83.33$. Thus $b = 50$ and $a \approx 16.67$. This is the optimum placement of stations.
\end{ppart}
\end{document}
