{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "$\n", " \\renewcommand{\\P}{\\mathbf{P}}\n", " \\def\\given{\\,\\middle|\\,}\n", " \\newcommand{\\setm}{\\setminus}\n", " \\newcommand{\\Pr}[1]{\\mathbf{P}\\left(#1 \\right)}\n", " \\newcommand{\\given}{\\,\\middle|\\,}\n", " \\newcommand{\\qp}[1]{\\left(#1\\right)}\n", " \\newcommand{\\Var}[1]{\\mathrm{Var}\\left[#1\\right\\]}\n", " \\newcommand{\\E}[1]{\\mathrm{E}\\left[#1\\right\\]}\n", "$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Math 451: Homework 1\n", "- Submitted 9/17/17 by Colton Grainger for Math 451-1: Probability Theory, Engineering Outreach\n", "- **Text:** *Stochastic Modeling and Mathematical Statistics* by Francisco J. Samaniego, CRC Press" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## § 1.8\n", "### Prob 3\n", "\n", "Suppose $A$, $B$, and $C$ are three events in a random experiement with sample space $\\Omega$. We will express a handful plain language events as sets in terms of the set operations **union**, **intersection**, **complement** and **difference**.\n", "- Only $A$ occurs: \n", " - $A\\setm (B \\cup C)$.\n", "- $A$ and $B$ occur but $C$ does not occur: \n", " - $(A\\cap B) \\setm C$.\n", "- Exactly one of the events occurs: \n", " - $A\\setm (B\\cup C)$, \n", " - $B\\setm (C\\cup A)$, \n", " - $C\\setm (A\\cup B)$.\n", "- At least one of the events occurs: \n", " - $A \\cup B \\cup C$.\n", "- At most one of the events occurs: \n", " - $(A \\cup B \\cup C)^{c}$,\n", " - $A \\setm (B \\cup C)$,\n", " - $B \\setm (C \\cup A)$,\n", " - $C \\setm (A \\cup B)$.\n", "- Exactly two of the events occur:\n", " - $(A \\cap B) \\setm C$,\n", " - $(B \\cap C) \\setm A$,\n", " - $(C \\cap A) \\setm B$.\n", "- At least two of the events occur: \n", " - $(A \\cap B) \\cup (B \\cap C) \\cup (C \\cap A)$.\n", "- At most two of the events occur: \n", " - all events from \"at most one occurs\",\n", " - all events from \"exactly two occur\".\n", "- All three events occur:\n", " - $A \\cap B \\cap C$.\n", "- None of the events occur:\n", " - $(A \\cup B \\cup C)^{c}$." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Prob 4\n", "Let $\\Omega^n$ be the discrete sample space for the outcomes of $n$ successive rounds of roulette, i.e.,\n", "$$\n", " \\Omega^n = \\{ 0, 00, 1, \\ldots, 36\\}^n.\n", "$$\n", "\n", "For all simple events $x$ in $\\Omega^n$, let $\\P(x) = \\frac{1}{36^n}$. As every subset $E$ of $\\Omega^n$ can be written as the union of finitely many pairwise disjoint simple events $x$, we've defined $\\mathbf{P}$ on all subsets of $\\Omega$, thus defining a *probability space* \n", "$$\n", " (\\Omega^n, \\text{power set of } \\Omega^n, \\mathbf{P}).\n", "$$\n", "\n", "In $\\Omega^2$, what's the probability that either the first round spins $12$ or the second round spins $18$?\n", "\n", "Call this event $E$, where \n", "\\begin{align}\n", " E &= \\{ (a,b) \\in \\Omega^2 : a = 12 \\text{ or } b = 18\\}\\\\\n", " &= \\{ (12,b) \\} \\cup \\{ (a,16) \\}.\n", "\\end{align}\n", "\n", "Using the inclusion-exclusion formula,\n", "\\begin{align}\n", " \\P(E) &= \\P(\\{ (12,b) \\} \\cup \\{ (a,16) \\})\\\\\n", " &= \\P((12,b)) + \\P((a,16)) - \\P((12,16))\\\\\n", " &= \\frac{38}{38^n} + \\frac{38}{38^n} - \\frac{1}{38^n}\\\\\n", " &= \\frac{75}{1444}.\n", "\\end{align}\n", "\n", "What's the probability that the first spin is 12 or 18? Well, we're now in the space $\\Omega^1$ with \n", "\\begin{align}\n", " E &= \\{ x \\in \\Omega^1 : x = 12 \\text{ or } x = 18\\}\\\\\n", " &= \\{12\\} \\cup \\{18\\}.\n", "\\end{align}\n", "\n", "We see that\n", "\\begin{align}\n", " \\P(E) &= \\frac{1}{38} + \\frac{1}{38}\\\\\n", " & = \\frac{1}{19}.\n", "\\end{align}\n", " \n", "Notice the events of spinning $12$ or spinning an $18$ *are* pairwise disjoint in $\\Omega^1$. However, the events of spinning $12$ first and of spinning $18$ second in $\\Omega^2$ *are not* pairwise disjoint. " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Prob 5\n", "\n", "Consider the sample space of obtaining either an $A$ or a $B$ in three courses, $\\{A,B\\}^3$. We can represent the elements in $\\{A,B\\}^3$ as leaves of the following binary tree:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "courses = [[[],[]],[[],[]]],[[[],[]],[[],[]]]\n", "ascii_art(BinaryTree(courses))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "where each left branch denotes an $A$, and the (independent) probabilities for the first, second, and third left branches are $0.3$, $0.6$ and $0.8$ respectively. There are $2^3$ simple events in our sample space, but we're only after four:\n", "- $AAA$\n", "- $AAB$\n", "- $ABA$\n", "- $BAA$.\n", "\n", "Considering each simple event as a multistage experiment, we have \n", "- $\\Pr{AAA} = 0.154$\n", "- $\\Pr{AAB} = 0.036$\n", "- $\\Pr{ABA} = 0.096$\n", "- $\\Pr{BAA} = 0.336$.\n", "\n", "As each simple event (denote as $E_i$) is pairwise disjoint from the other three, so the probability of getting more $A$s than $B$s is the sum \n", "$$\n", " \\Pr{\\bigcup_{\\forall i} E_i} = \\sum_{\\forall i}\\Pr{E_i} = 0.622.\n", "$$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Prob 9\n", "\n", "Suppose that $\\Omega$ is the sample space for the random experiment of choosing one worker at a factory. Let $A$ and $B$ be independent events in the space. Let $\\P$ be a probaility measure on $\\Omega$ such that\n", "$$\n", " \\Pr{A} = 0.65\\\\\n", " \\Pr{B} = 0.7\\\\\n", " \\Pr{A \\cap B} = 0.455.\n", "$$\n", "\n", "As the events $A$ and $B$ are independent, we have $\\Pr{A \\cap B} = \\Pr{A}\\Pr{B}$ (similarly for the complements of $A$ and $B$). Let's plot the known entries into a multiplacation table.\n", "\n", "|multiply | $1$ | $\\Pr{A}$ | $\\Pr{A^c}$ |\n", "| ---- | --- | -------- | --------- |\n", "|$1$ | $1$ | $0.65$ | |\n", "|$\\Pr{B}$ | $0.7$ | $0.455$ |$\\quad\\quad\\quad$|\n", "|$\\Pr{B^c}$| | $\\quad\\quad\\quad$ | ||\n", "\n", "Normativity implies $1 = \\Pr{A \\cup A^c} = \\Pr{A}+\\Pr{A^c}$, and thus\n", "\n", "|multiply | $1$ | $\\Pr{A}$ | $\\Pr{A^c}$ |\n", "| ---- | --- | -------- | --------- |\n", "|$1$ | $1$ | $0.65$ | $0.35$ |\n", "|$\\Pr{B}$ | $0.7$ | $0.455$ |$\\quad\\quad\\quad$|\n", "|$\\Pr{B^c}$| $0.3$| $\\quad\\quad\\quad$ | ||\n", "\n", "We find the remaining probabilities with the multiplication rule for independent events.\n", "\n", "|multiply | $1$ | $\\Pr{A}\\quad$ | $\\Pr{A^c}\\quad$ |\n", "| ---- | --- | -------- | --------- |\n", "|$1$ | $1$ | $0.65$ | $0.35$ |\n", "|$\\Pr{B}$ | $0.7$ | $0.455$ | $0.245$ |\n", "|$\\Pr{B^c}$| $0.3$| $0.195$ | $0.105$ ||\n", "\n", "It follows that\n", "\n", "- $\\Pr{A^c \\cap B} = 0.245$ and\n", "- $\\Pr{A^c \\cap B^c} = 0.105$.\n", "\n", "Lastly,\n", "$$\n", " \\Pr{A \\cup B} = \\Pr{A} + \\Pr{B} - \\Pr{A \\cap B} = 0.895.\n", "$$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Prob 10\n", "\n", "Suppose an urn contains $6$ chips numbered from 1 to 6. Let $\\Omega$ be the sample space for randomly drawing $3$ chips without replacement. Then $$|\\Omega| = {6 \\choose 3} = 20.$$ \n", "\n", "We'll find the probability of the event $E$ that largest chip drawn is the 4-chip.\n", "\n", "Consider a multistage experiment. \n", "\n", "- Draw the 4-chip first. There is $1$ way to do so. \n", "- Of the remaining $3$ chips less than the 4-chip, draw $2$. There are $3$ ways to do so. \n", "\n", "We are finished; there are $1\\times3$ ways to draw.\n", "\n", "Whence $$\\Pr{E} = \\frac{|E|}{|\\Omega|} = \\frac{3}{20}.$$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Prob 16\n", "Suppose I draw $4$ marbles without replacement from a bowl of $4$ red, $3$ white and $2$ blue. \n", "\n", "Let the sample space $\\Omega$ be the $9*8*7*6 = 3024$ permutations of length $4$ on a set of $9$ elements.\n", "\n", "How many of these permutations contain at least $1$ marble of each color?\n", "\n", "Consider the following multistage experiment.\n", "\n", "- Draw $1$ of $4$ red marbles.\n", "- Draw $1$ of $3$ white marbles.\n", "- Draw $1$ of $2$ blue marbles.\n", "- Draw $1$ remaining of $6$ marbles.\n", "\n", "There are $4*3*2*6 = 144$ permutations containing at least $1$ marble of each color.\n", "\n", "Whence the probability of drawing at least $1$ marble of each color is $1/21$.\n", "\n", "(Is this question nuanced? Am I missing a subtle point?---Maybe. I had come up with a different solution in terms of conditional probabilities, but, prefer the above approach on revision.)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Prob 43\n", "\n", "With a probability of mowing his yard each Saturay, Samaniego exists for $5$ Saturdays. \n", "\n", "To find the probality that he mows his lawn at least $4$ times, consider that \n", "- there's a ${5 \\choose 5}$ combination to mow $5$ times \n", " - with probability $\\qp{\\frac{2}{3}}^5$ and\n", "- there're ${5 \\choose 4}$ combinations to mow $4$ times,\n", " - each with probability $\\qp{\\frac{2}{3}}^4\\qp{\\frac{1}{3}}$.\n", "\n", "Each above combination is a simple event in our sample space, whence the desired probability is the sum \n", "$$\n", "{5 \\choose 5}\\qp{\\frac{2}{3}}^5+{5 \\choose 4}\\qp{\\frac{2}{3}}^4\\qp{\\frac{1}{3}} \\approx 0.461.\n", "$$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Prob 46\n", "\n", "Each student in a population of $n = 10^3$ has a predictive dream with independent probability $p = 10^{-5}$ nightly. We'll determine the probability that at least one student has a predictive dream over $7$ nights.\n", "\n", "In the sample space of $1$ night, the complement to the event that at least one student has a predictive dream is the probability that *none* do. \n", "\n", "Whence, any night, the probability that at least $1$ student has a predictive dream is\n", "\n", "\\begin{align}\n", " 1 - {n \\choose 0}p^0(1-p)^n \n", " &= 1 - \\qp{1- \\frac{1}{10^5}}^{10^3}\\\\\n", " &= \\frac{10^{5\\cdot 10^3} - (10^3-1)^{10^3}}{10^{5\\cdot 10^3}},\n", "\\end{align}\n", "\n", "call it $\\alpha$.\n", "\n", "Now, having established the probability for a night, we proceed to determine the probabilty for week's time, $N = 7$. Again, the probability that at least one student has a predictive dream in the sample space of a week is $1$ minus the probability that *no one* does (shame), i.e.,\n", "\n", "\\begin{align}\n", " 1 - {N \\choose 0}\\alpha^0(1-\\alpha)^N \n", " &= 1 - \\qp{1-{\\alpha}}^{7}\\\\\n", " &= \\frac{10^{5\\cdot 10^3\\cdot 7} - (10^3-1)^{10^3\\cdot 7}}{10^{5\\cdot 10^3\\cdot 7}}.\n", "\\end{align}\n", "\n", "With later limit theorems, we can verify that this number is very close to" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "n = 10^3\n", " # population\n", "p = 10^(-5)\n", " # incidence\n", "a = 1 - e^(-n*p) \n", " #1 minus the Poisson approx that no student dreams in a night\n", "N(1 - binomial(7,0)*a^0*(1 - a)^7)\n", " #1 minus prob that some student dreams in 7 nights" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Prob 61\n", "\n", "Suppose a committee consists of $8$ students, where each of $4$ disjoint classes have $2$ student representatives.\n", "\n", "How many possible subcommittees of $4$ can be made from $8$? \n", "- Well, there are ${8 \\choose 4} = 70$.\n", "\n", "In how many of the $70$ possible subcommittees are all $4$ classes represented? \n", "\n", "- There are $16$ such subcommittees---one for each simple event in the space of choosing a representative from $2$, repeated $4$ times.\n", "\n", "In the case that the subcommittee is formed at random, what is the probability that $2$ of the classes would be completely excluded?\n", "\n", "- $6/70$. There are only ${4 \\choose 2} = 6$ subcommittees of the $70$ that exclude $2$ classes." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Prob 65\n", "\n", "What is the probability that all $4$ suits are present in a random $5$ card poker hand? \n", "\n", "- $\\frac{1370928}{2598960} = \\frac{2197}{4165}$. Why?\n", " - There are ${52 \\choose 5} = 2598960$ possible hands, and\n", " - $13^4\\cdot48 = 1370928$ such hands with at least one card of every suit. " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Prob 70\n", "\n", "Suppose that the kiddos, Jessica, Wolfgang and Frank, each have their own collection of cards from a random distribution of $20$ with replacement. Say that Jessica has $4$ cards, Wolfgang has $5$, and Frank has $6$. I'll assume that each kiddo doesn't have any repeats of one of their own cards.\n", "\n", "To find the probability that, all together, they have $15$ unique cards, we'll represent each's collection as a function, then consider the probability that the images of any two functions overlap.\n", "\n", "So, suppose that \n", "$$\n", "\\begin{align}\n", " j \\colon &\\{1,\\ldots, 4\\} \\to \\{1,\\ldots,20\\}\\\\\n", " w \\colon &\\{5,\\ldots, 9\\} \\to \\{1,\\ldots,20\\}\\\\\n", " f \\colon &\\{10,\\ldots, 15\\} \\to \\{1,\\ldots,20\\}\n", "\\end{align}\n", "$$\n", "are one-to-one functions.\n", "\n", "Notice that there are \n", "$$\n", "\\begin{align}\n", " {20 \\choose 4}& \\text{ possible images of } j,\\\\\n", " {20 \\choose 5}& \\text{ possible images of } w, \\text{ and}\\\\\n", " {20 \\choose 6}& \\text{ possible images of } f.\\\\\n", "\\end{align}\n", "$$\n", "\n", "What's the probability that the function $g:\\{1,\\ldots,15\\}\\to\\{1,\\ldots,20\\}$, defined\n", "$$\n", " g(x) =\n", " \\begin{cases}\n", " j(x), & \\text{if } x \\in \\{1,\\ldots, 4\\} \\\\\n", " w(x), & \\text{if } x \\in \\{5,\\ldots, 9\\} \\\\\n", " f(x), & \\text{if } x \\in \\{10,\\ldots, 15\\}\n", " \\end{cases}\n", "$$\n", "is also one-to-one? That is, what's the probability the kids, all together, have $15$ unique cards?\n", "\n", "(It can be shown $g$ is one-to-one if and only if the images of $j$, $w$, and $f$ are pairwise disjoint. We will focus our effort here once we define the sample space.)\n", "\n", "First, notice that there are \n", "$$\n", " {20 \\choose 4}\\cdot{20 \\choose 5}\\cdot{20 \\choose 6} \n", " \\approx 2.95115\\times 10^{12}\n", "$$ \n", "different outcomes when we randomly determine the images of $j$, $w$, and $f$ (by the fundamental rule of counting). Let $\\Omega$ be the sample space of all such outcomes.\n", "\n", "Now, for how many simple events in $\\Omega$ are the images of $j$, $w$, and $f$ pairwise disjoint? Well, as many as there are partitions of $20$ elements into sets of size $4$ (Jessica's), $5$ (Wolfgang's), $6$ (Frank's), and $5$ (nobody's).\n", "\n", "We can use the multinomial coefficient. There are\n", "$$\n", " {20 \\choose 4,5,6,5} \\approx 9.777 \\times 10^9\n", "$$ \n", "such partitions. \n", "\n", "So, given that the images of $j$, $w$, and $f$ are randomly chosen, the probability that no two images overlap is the ratio \n", "$$\n", " \\frac{{20 \\choose 4,5,6,5}}{{20 \\choose 4}{20 \\choose 5}{20 \\choose 6}} = \\frac{7007}{2086580} \\approx 0.003358.\n", "$$\n", "\n", "We have shown that the probability Jessica, Wolfgang and Frank have $15$ unique cards is about a third of a percent." ] } ], "metadata": { "kernelspec": { "display_name": "SageMath 8.0", "language": "", "name": "sagemath" } }, "nbformat": 4, "nbformat_minor": 2 }