Homework 1

CHE 116: Numerical Methods and Statistics

Version 1.0 (1/17/2020)


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 = \{1, 2, 3\}$. What is the probability of observing $P(1 \,\textrm{OR} \,2\, \textrm{OR}\, 3)$?

  2. [2 points] What is the key differnce between $B_1$ and $B_2$ in these two expressions: $P( A \,\textrm{OR} \,B_1)$ and $P(A \,\textrm{AND}\, B_2)$ aside from the fact that OR is in the first expression and AND in the second.

  3. [2 points] Consider the sample space of days in 2020 and assume each day has equal probability. If event $E$ is elements $\{\textrm{September 3rd}, \textrm{October 24th}, \textrm{December 13th}\}$, then what is the probability of the event $E$, $P(E)$?

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

  5. [2 points] What is the probability of observing September 3rd and then September 4th?

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

1.1

$$ P(1 \,\textrm{OR} \,2\, \textrm{OR}\, 3\,\textrm{OR}) = P(1) + P(2) + P(3) = 1 $$

1.2

$B_1$ is another possible element from the same observation as $A$ in the OR expression. $B_2$ is for a second sequential independent sample. Another possible answer is stating that A and $B_1$ must be in the same sample space, where $B_2$ could be a different sample space than $A$.

1.3

$$ \frac{1}{366} + \frac{1}{366} + \frac{1}{366} = \frac{3}{366} $$

1.4

$$ 1 - \frac{3}{366} = \frac{363}{366} $$

1.5

$$ \frac{1}{366} \times \frac{1}{366} = \frac{1}{133956} $$

1.6

  • 1.3: 1
  • 1.4: 1
  • 1.5: 2

Die Probability

You are rolling a die with 6 sides. Event $A$ is that you roll a 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 points] If you roll event $A$, on your next roll what is the probability of event $A$?
  5. [2 points] What is the probability of rolling event $A$ followed by event $B$?
  6. [4 points] What is the probability of having event $A$ occur within 10 rolls?

2.1

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

$$ A = \{4\} $$

In [1]:
1 / 6


Out[1]:
0.16666666666666666

2.2

The first roll has no impact

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

In [2]:
1 / 6  + 4 / 6 - 1/6


Out[2]:
0.6666666666666666

2.3

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


In [9]:
(1 / 6) * (4 / 6) + (4 / 6) * (1 / 6)


Out[9]:
0.2222222222222222

2.3

Again, the roll has no impact


In [4]:
1/6


Out[4]:
0.16666666666666666

2.5

The wording means only one permutation: A then C


In [5]:
(1 /  6) * ( 1 / 6)


Out[5]:
0.027777777777777776

2.6

We can compute $P(\sim A)$ and compute probability of that occuring 10 times in a row and negate that. Put another way, we know NOT (NOT A AND NOT A AND NOT A AND NOT A AND NOT A...) is the same thing as A occuring at least once.


In [8]:
1 - (5 / 6)**10


Out[8]:
0.8384944171101543

3. Sample Spaces

Answers these problems symbolically

Each problem is worth 4 points

  1. [1 point] What could the sample space be for number of foxes on campus?
  2. [2 points] Each day I come to lecture with at most three whiteboard markers and each marker has ink or is out of ink. What is the sample space?
  3. [1 point] You are trying to guess a 10 digit phone numebr. What's the sample space size?
  4. [1 point] You have an 8 character password which can contain lowercase letters, uppercase letters, numbers, and 6 symbols (e.g., %, \$, !). 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] Many websites require having each of these characters (lowercase, uppercase, number). What is more effective, a 12 character password with only lowercase or an 8 character password requiring each of the extra classes?

3.1

Can use anything reasonable instead of $\infty$ $$ \{0, 1, 2, \ldots, \infty\} $$

3.2

W - working, B - broken. It's ok if they assume markers are distinguishable, but they should have a much bigger sample space, $2^3 + 2^2 + 2^1 + 2^0 = 15$

$$ \{ (), (W), (B), (WW), (WB), (BB), (WWW), (WWB), (WBB), (BBB)\} $$

3.3

$$ 10^{10} $$

3.4

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

3.5

$$ (26 + 26 + 10 + 6)^{16} \approx 2.1\times10^{29} $$

3.5

$$ (26)^{12} \approx 9.5\times10^{16} $$

The length of the password raises the power which increases the number of possible passwords much more than changing the base of the exponent. So it is better to have longer passwords than silly rules.

4. Data Collection

Choose two random things to observe over the course of the semester. Record your data youself and you should end up with at least 10 observations per month. Examples could be: screen time per day, time it takes to get to class, number of people you eat lunch with, colors in your outfit, number of birds in a particular tree, temperature at 9am.

[8points] Write out the sample space of your two data and give an example of them.