# Lecture_7
Author: Zheyuan Wu
Date: 2023-02-01

#### Zheyuan Wu

#### 2023-02-01

### Continuing on Counting

We can generalize the idea of combinations: the number of arrangements of n units into r groups of sizes \(n_1,n_2,n_3...n_r\) is \[ n=n_1+n_2+n_3...+n_r\\ \begin{pmatrix}n\\n_1,n_2..n_r\end{pmatrix}={n!\over{n_1!n_2!n_3!..n_r!}} \]

Example, ways to build group of 2,3,3 from 8 students:

\[ \begin{pmatrix}8\\2,3,3\end{pmatrix}={8!\over{2!3!3!}}=560 \]

Example, a communication system consist of 13 antennas work as long as no two of them arrange next to each other. suppose 5 of them stop functioning.

1. number of arrangement for non functioning antennas

8 functioning, 5 non functioning 9 possible locations for non functioning antennas

\[ \begin{pmatrix}9\\5\end{pmatrix}={9!\over{5!4!}}=126 \]

(b)probability for the system still functional

total arrangement for the antenna \[ \begin{pmatrix}13\\5\end{pmatrix}={13!\over{5!8!}}=1287\\ P(funcitonal)=126/1287 \]

### Probability Mass Function

The probability mass function of a discrete random variable X is a list of the probabilities p(x) for each value x in the sample pace \(S_x\) of X.

Rolling two dies. \[ P(x=2)={1\over{36}}...P(x=12)={1\over{36}} \]

Example: random sample of size n =3 from 10 sample, where 4 of them are defective.

## x | 1 | 2 | 3 |

p(x)|

for x=0, we select 3 non-defective from 6 non-defective sample, divided by the general chance of selecting 3 item from 10.

\[ P(x=0)={\begin{pmatrix}6\\3\end{pmatrix}\over{\begin{pmatrix}10\\3\end{pmatrix}}}=0.167 \]

for x=1, we select 2 non-defective from 6 non-defective sample, 1 defective from 4 defective, then divided by the general chance of selecting 3 item from 10

\[ P(x=1)={\begin{pmatrix}6\\2\end{pmatrix}\begin{pmatrix}4\\1\end{pmatrix}\over{\begin{pmatrix}10\\3\end{pmatrix}}}=0.5 \]

for x=2,… \[ P(x=2)={\begin{pmatrix}6\\1\end{pmatrix}\begin{pmatrix}4\\2\end{pmatrix}\over{\begin{pmatrix}10\\3\end{pmatrix}}}=0.3 \]

for x=3,… \[ P(x=3)={\begin{pmatrix}4\\3\end{pmatrix}\over{\begin{pmatrix}10\\3\end{pmatrix}}}=0.033 \]

\[ P(x=0)+P(x=1)+P(x=2)+P(x=3)=1 \]

Simulation of experiment in R

    # replace = TRUE means we take sample with replacement (no put back operation)
    x = sample(0:3, size = 10000, replace = TRUE, prob = c(0.167,0.5,0.3,0.033))
    table(x)/10000

    ## x
    ##      0      1      2      3
    ## 0.1648 0.5012 0.3015 0.0325

## Conditional probability and dependent event

Conditional probability: the relative frequency we can expect an event to occur under the condition that additional, preexisting information is known about some other event. Denoted by \(P(A|B)\) (probability of A given B)

During the process, Event B becomes the new sample space.

\[ P(A|B)=P(A\cap B)/P(B) \]