Homework 1

CHE 116: Numerical Methods and Statistics

Version 1.0 (1/17/2019)


1. Probability

The probability of an event or element in a sample space is written as $P(A)$, where $A$ is the event or element in the sample space. Answer the following problems symbolically and simplified. Each problem is worth 1 point.

  1. [2 points] Our sample space contains three elements: $Q = \{A, B, C, D\}$. What is the probability of observing $P(A \,\textrm{OR} \,\textrm{B}\, \textrm{OR}\, C, \textrm{OR} D)$

  2. [2 points] What has to be true of the two elements that are part of an OR statement?

  3. [2 points] Consider the sample space of months in a year and assume each month has equal probability. If event $E$ is elements $\{\textrm{September}, \textrm{October}, \textrm{December}\}$, then what is the probability of the event $E$, $P(E)$?

  4. [2 points] What is the probability of observing September and then November?

  5. [2 points] What is the probability of not event $E$ from the previous question?

  6. [4 points] State the number of observations/samples for the probabilities specified in questions 1.1-1.5.

1.1

$$ P(A \,\textrm{OR} \,\textrm{B}\, \textrm{OR}\, C\,\textrm{OR}\, D) = P(A) + P(B) + P(C) + P(D) = 1 $$

1.2

Same sample space

1.3

$$ \frac{1}{12} + \frac{1}{12} + \frac{1}{12} = \frac{3}{12} = \frac{1}{4} $$

1.4

$$ \frac{1}{144} $$

1.5

$$ P(~E) = 1 - P(E) = \frac{3}{4} $$

1.6

  1. 1
  2. 1
  3. 1
  4. 2
  5. 1

Die Probability

You are rolling a die with 8 sides. Event $A$ is that you roll a number less than 4. Event $B$ is that you roll a $6$. Event $C$ is rolling a number greater than 2. Answer these problems using python code. Each problem is worth 1 point.

  1. [1 point] What is the probability of event $A$?
  2. [1 point] If you roll a 4, what is then the probability of rolling event $A$ or $C$ on your next roll?
  3. [2 points] What is the probability of rolling event $A$ and event $C$ in the course of two rolls?
  4. [2 point] If you roll event $A$, on your next roll what is the probability of event $B$?
  5. [2 points] What is the probability of rolling event $A$ followed by event $C$?

2.1

The markdown answers are only for clarity and not required for credit

$$ A = \{1, 2, 3\} $$

In [1]:
3 / 8


Out[1]:
0.375

2.2

The first roll has no impact

$$ P(A\,\textrm{OR}\, C) = P(A) + P(C) - P(A \cap C) $$

In [2]:
3 / 8  + 6 / 8 - 1/8


Out[2]:
1.0

2.4

The wording means we could roll A then C or C then A. A combination.


In [3]:
(3 / 8) * (6 / 8) + (6 / 8) * (3 / 8)


Out[3]:
0.5625

If you are careful about this, you'll notice that we are overcounting. Take $AC$ to mean the permutation of rolling $A$ and then $C$. We are asked about $P(AC\,\textrm{OR}\,CA)$. That is:

$$ P(AC\,\textrm{OR}\,CA) = P(AC) + P(CA) - P(AC\cap CA) $$

What does $P(AC\cap CA)$ mean? It means is there a set of rolls that results in both $AC$ and $CA$? There is such a roll, it is $3,3$ which makes both A/C happen simultaneously.


In [7]:
3/8*6/8 + 6/8 * 3/8 - 1/8 * 1/8


Out[7]:
0.546875

2.3

Again, the roll has no impact


In [5]:
1/8


Out[5]:
0.125

2.5

The wording means only one permutation: A then C


In [6]:
(3 /  8) * ( 6 / 8)


Out[6]:
0.28125

3. Sample Spaces

Answers these problems symbolically

Each problem is worth 4 points

  1. [2 points] Each morning you grab one of your two necklaces randomly and then pick one of your three hats randomly. Both of these actions make up an observation. What is the single "joined" sample space?
  2. [1 point] What is the sample space for number of students attending lecture if there are 38 students enrolled? Do not report just the size.
  3. [1 point] You are trying to guess a 4 digit PIN. What's the sample space size?
  4. [1 point] You have an 8 character password which can contain lowercase letters, uppercase letters and numbers. What's the size of the sample space size?
  5. [1 point] You double the length of your password. What's the size of the sample size now?
  6. [4 points] Based on the previous problem, would a password that is a complete sentence (35 characters) with only lowercase letters be more or less secure than the previous problem? Justify your answer.

3.1

$$ \{ (N1, H1), (N1, H2), (N1, H3), (N2, H1), (N2, H2), (N2, H3)\} $$

3.2

$$ \{0, 1, 2, \ldots, 38\} $$

3.3

$$ 10^4 $$

3.4

$$ (26 + 26 + 10)^8 \approx 2\times10^{14} $$

3.5

$$ (26 + 26 + 10)^{16} \approx 5\times10^{28} $$

3.6

The length of the password raises the power which increases the number of possible passwords much more than changing the base of the exponent. Even if we ignore the fact that we are limited in the characters we can use, a complete sentence with 35 characters is a much better password.