\documentclass[11pt]{article}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage[english]{babel}
\usepackage[latin1]{inputenc}
\usepackage[OT1]{fontenc}
\usepackage{epic, eepic}
\usepackage{tikz}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\textwidth 150mm
\textheight 240 mm %228mm
\oddsidemargin -6mm
\evensidemargin-10mm
%\topmargin -10mm
\parindent0pt
\parskip4pt
\frenchspacing
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%% Begin Macros %%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\boxit#1#2{\hbox{\vrule
\vtop{%
\vbox{\hrule\kern#1%
\hbox{\kern#1#2\kern#1}}%
\kern#1\hrule}%
\vrule}}
\def\bboxit#1#2{\boxit{#1}{\boxit{#1}{#2}}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand\tpe{\thispagestyle{empty}}
\def\bskip#1,{\vspace*{#1\baselineskip}}
\newcommand\mpg[1]{\marginpar{\raggedleft\tiny#1}}
\newcommand\rmpg[1]{\reversemarginpar\marginpar{\raggedright\tiny#1}}
\newcommand\nmpg[1]{\normalmarginpar\marginpar{\tiny#1}}
\newcommand\mps[1]{\marginpar{\raggedleft\small\sf#1}}
\newcommand\rmps[1]{\reversemarginpar\marginpar{\small\sf#1}}
\newcommand\ra{\rightarrow}
\newcommand\Ra{\ensuremath{\Rightarrow}}
\newcommand\lra{\longrightarrow}
\newcommand\cd{\cdot}
\newcommand\st{\; | \;}
\newcommand{\nl}{\newline}
\newcommand{\lb}{\linebreak}
\newcommand{\pb}{\pagebreak}
\newcommand{\Iff}{\Leftrightarrow}
\newcommand{\IFF}{\Longleftrightarrow}
\def\ch#1,#2,{{#1\choose #2}}
\newcommand\ZZ{\mathbb Z}
\newcommand\RR{\mathbb R}
\newcommand\QQ{\mathbb Q}
\newcommand\CC{\mathbb C}
\newcommand\PP{\mathbb P}
\newcommand\NN{\mathbb N}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand\mb{\mathbf}
\newcommand\mn{\mathrm}
\newcommand\mc{\mathcal}
\def\emm#1,{{\em#1}\/}
\def\disp{\displaystyle}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand\vanish[1]{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\bskip#1,{\vspace*{#1\baselineskip}}
%%%%%%%%%%%%%%%%%%% End Macros %%%%%%%%%%%%%%%%%%%
\begin{document}
% \maketitle
\thispagestyle{empty}
\null\bskip-5,
{\small\sc CS101, 2012\hfill{\boxit{2mm}{\bf Sample solution}\hfill
Einar Steingr\'imsson}}
\bskip.5,
\hrule
\bskip.2,
\hrule
\bskip1,
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\bskip1,
{\bf{Problem:}} In an urn we have three red balls and two blue balls.
If we draw three balls at random, without putting back a ball we have
drawn, what is the probability that we get two blue balls (and thus
one red ball)?
{\bf{Solution:}} We draw a probability tree to represent the possible
outcomes.
\def\bu{$\bullet$}
\def\R{{\color{red}R}}
\def\B{{\color{blue}B}}
\bskip1,
\def\litur{white}
\setlength{\unitlength}{1mm}
\begin{picture}(100,75)(5,-19)
\put(10,00){
\begin{tikzpicture}
\tikzstyle{every node}=[fill=\litur!60,circle,inner sep=0pt]
\tikzstyle{level 1}=[sibling distance=80mm]
\tikzstyle{level 2}=[sibling distance=40mm]
\tikzstyle{level 3}=[sibling distance=20mm]
% \tikzstyle{level 4}=[sibling distance=60mm]
% \tikzstyle{level 5}=[sibling distance=0mm]
\node {\bu}
child {node {\R}
child {node {\R}
child {node {\R}}
child {node {\B}}}
child {node {\B}
child {node {\R}}
child {node {\B}}
}
}
child {node {\B}
child {node {\R}
child {node {\R}}
child {node {\B}}}
child {node {\B}
child {node {\R}}
child[fill=none] {edge from parent[draw=none]}
}
};
\end{tikzpicture}
}
\put(8,-8){\R\R\R}
\put(28,-8){\R\R\B}
\put(48,-8){\R\B\R}
\put(68,-8){\R\B\B}
\put(88,-8){\B\R\R}
\put(108,-8){\B\R\B}
\put(128,-8){\B\B\R}
\put(62,43){3/5}
\put(98,43){2/5}
\put(27,25){2/4}
\put(53,25){2/4}
\put(107,25){3/4}
\put(133,25){1/4}
\put(12,10){1/3}
\put(28,10){2/3}
\put(52,10){2/3}
\put(68,10){1/3}
\put(92,10){2/3}
\put(108,10){1/3}
\put(132,10){3/3}
\end{picture}
Starting at the root, the probability is 3/5 that we draw a red ball
first, and 2/5 that we draw a blue ball first. If we draw a red ball
first, which corresponds to going down the left edge from the root,
then there are two red and two blue balls left, and so it is equally
likely that we next draw a red ball and a blue ball. That is why we
have 2/4 on both edges going down from the left child of the root.
The rest of the tree is constructed in the same way, with the
resulting outcome of each path down from the root displayed at each
leaf in the tree. There is no right child on the far right, because
at that point we have already drawn two blue balls, and so there are
none left (which is why the probability on the single edge is 3/3, or
1).
Looking at the outcomes, we see that three of them have two Bs, namely
RBB, BRB and BBR. For each of these outcomes we multiply the
probabilities along the edges from the root to that leaf, so for RBB,
for example, we get $(3/5)\cd(2/4)\cd(1/3)$. All in all, we thus get
the following, when we sum up the probabilities for the three outcomes
in question:
$$
\frac{3}{5}\cd\frac{2}{4}\cd\frac{1}{3} ~+~
\frac{2}{5}\cd\frac{3}{4}\cd\frac{1}{3} ~+~
\frac{2}{5}\cd\frac{1}{4}\cd\frac{3}{3} ~=~
\frac{1}{10} ~+~ \frac{1}{10} ~+~ \frac{1}{10} ~=~ \frac{3}{10}.
$$
\end{document}