# Student Project for MA375: Mysteries of Probability

Probability is ordinarily used to describe an attitude of mind towards some proposition of whose truth we are not certain. The proposition of interest is usually of the form "Will a specific event occur?" The attitude of mind is of the form "How certain are we that the event will occur?" The certainty we adopt can be described in terms of a numerical measure and this number, between 0 and 1, we call probability. The higher the probability of an event, the more certain we are that the event will occur. Thus, probability in an applied sense is a measure of the confidence a person has that a (random) event will occur.

**Discrete Probability**

Discrete probability restricts one to experiments that have finitely many, equally likely, outcomes. There are several terms one must familiarize themselves with before talking about discrete probability, which are listed below:

__Experiment__- A procedure that yields one of a given set of possible outcomes

__Sample Space__- The set of possible outcomes

__Event__-A subset of the sample space__The complementary event of E-__(__E__)- if E is an event in the sample space S is the subtraction of E from S:__E__= S-E

__Union of two events A and B (A u B)-__The union of two events A and B is the set of outcomes that belong to A or B or both.

**Figure 1**: A Pictoral Representation of A Union B

__Intersection of two events A and B (A n B)__-The intersection of two events A and B is the set of outcomes that belong to both A and B.

**Figure 2**: A pictoral Representation of A intersect B

Now that there is an understanding of some fundamental definitions, the definition of Probability now can be defined:

The __probability__ of E (if E is an event and S is a finite nonempty sample space of equally likely outcomes), p(E), is equal to |E| / |S|

p(E) = |E| / |S| **Eq. 1**

**Example 1:**

*Question**: *

*A bucket has 4 blue balls and 6 red balls. What is the probability that a ball chosen at random from the bucket will be blue?*

*Solution**: *

*There are 10 possibile outcomes (4 blue + 6 red), which is the sample space. 4 of these outcomes will result in a blue ball (event); so the probability of choosing a blue ball, using Equation 1, is 4/10*

- The
__probability of the complementary event__(__E__) is given by the following equaiton:

p(__E__) = 1-P(E) **Eq. 2**

**Example 2:**

*Question**:*

*A sequence of 9 bits is randomly generated. What is the probability that at least one of these bits is a 1?*

*Solution**:*

*E is the event that at least one of the 9 bits is 1. The sample space, S, is the set of all bit strings length 9.*

*Using Eq. 2: p(E) = 1 - p( E) = 1 - ( |E| / |S| ) = 1 - (1 / 2^9) = 1 - (1 / 512) = 511/512*

- The
__probability of A union B__is given by the below formula:

p(A u B)= p(A)+p(B)-P(A n B) **Eq. 3**

**Example 3:**

*Question:*

*What is the probabilit that a positive integer selected at random from the set of positive integers is divisible by either 2 or 5?*

*Solution**: *

*E1 is the event that the integer selected at random is divisible by 2 and E2 is the event that an integer selected at random is divisible by 5.*

*E1 u E2 is the event that the number is divisible by either 2 or 5. *

*E1 n E2 is the event that it is divisible by both 2 and 5, which is the same as saying the number is divisible by 10. *

*because |E1| = 50 and |E2| = 20 and |E1 n E2| = 10, using Equation 3:*

*p(E1 u E2) = p(E1) + p(E2) - p(E1 n E2)*

*p(E1 u E2) = 50/100 + 20/100 - 10/100*

*p(Eq u E2) = 3/5*

**Probability Theory**

In this section, every outcome might not have the same probability, so assigning probabilities might be necessary. One example of all outcomes not having identical probabilities is in the example of a loaded dice (One number on the die has a larger probability than others).

**Assigning Probabilities**

If S is the sample space of an experiment wih a finite number of outcomes, then p(s) is assigned to each outcome s.

2 conditions must be met when assigning probabilities:

- 0
__<__p(s)__<__1 for each s that exists in S - the sum of all probabilities of s that exist in S must equal 1

**Example 4:**

__Question__:

*a. What are the probabilities that should be assigned to the outcomes of H (heads) and T (tails) if a fair coin is flipped?*

*b. What are the probabilities that should be assigned to the outcomes of H (heads) and T (tails) if the coin is biased so tails comes up twice as many times as heads?*

__Solution__:

*a. for a fair coin the probability that heads comes up is equal to the probability that heads will come up when a fair coin is flipped. This means that the probabilities are equally likely, so p(H) = p(T) = 1/2.*

*b. For the biased coin, p(T) = 2p(H). *

*From the second condition for assigning probabilities, p(H) + p(T) =1*

*p(H) + 2p(H) = 1*

*3p(H) = 1*

*p(H) = 1/3, and p(T) = 2/3*

__Uniform Distribution__- Assigns the probability 1/n to each element of S, if S is a set with n elements__The probability of an event (A)__- The sum of the probability of all the outcomes of A

**Probabilities of Complements and Unions of Events**

__Conditional Probability of A and B p(A | B)-__ the probability of the union of A and B divided by the probability of B

p(A | B) = p( A u B) / p(B) **Eq. 4**

**Example** **5:**

__Question__:

*A bit string length 4 is randomly generated so each of the 16 bit strings length 4 are equally likely of occuring. What is the probability that the bit string will contain at least two consecutive 0's, given the first bit is a 0?*

__Solution:__

*If A is the event that a bit string length four has 2 consecutive 0's, and B is the event that the first number in the bit string starts with a 0. The probability that a bit string contains two consecutive 0's and the bit begins with a 0 is given by Eq. 4:*

*p(A | B) = p( A u B)/ p(B) *

*(A u B)= 5, {0000, 0001, 0010, 0011, 0100}*

*p(A u B) is 5/16 using Eq. 1*

*B = The number of bit strings length 4 that begin with 0 = 8*

*p(B) = 8/16 = 1/2*

*Using Eq. 4: p(A | B) = (5/16) / (1/2) = 5/8*

__Independent__- Events A and B are independent if and only if the probability of the union of A and B is equal to the probability of A multiplied by the probability of B.

p(A n B)= p(A)p(B) **Eq. 5**

**Example 6:**

__Question:__

*Assume each of the four ways a family can have two children is equally likely. Are the events that a family with two children will have 2 boys (A), and the event that a family with two children will have at least one boy (B) independent?*

*Solution:*

*A = {BB}*

From Equation 1, p(A) = 1/4

B = {GB, BG, BB}

From Equation 1, p(B) = 3/4

(A n B) = {BB}

From Equation 1, p(A n B) = 1/4

p(A)*p(B) = 1/4 * 3/4 = 3/16

Due to the fact that p(A n B) does not equal p(A)p(B), Eq. 5 is false. Therefore A and B are not independent.

**Bernoullu Trials**

__Bernoulli Trial__- Each performance of an experiment where there are only 2 possibilities (usually called a success of failure).

__The probability of exactly k successes in n independent Bernoulli Trials__- C(n,k)p^{k} q^{n-k} , where the probability of success=p and probability of failure= q =1-p

**Example 7:**

__Question:__

*Assume the probability of generating a 0 bit is 0.9, the probability of generating a 1 bit is 0.1, and the bits are generated independently. What is the probability that exactly 7 0 bits are generated when 10 bits are generated?*

__Solution__

Using C(n,k)p^{k} q^{n-k} as mentioned above, where n=10, k= 7, p=0.9, and q=0.1

*= C(10,7) * (0.9) ^{7} * (0.1)^{3}*

*The probability that exactly seven 0 bits are generated when 10 bits are generated = 0.057396*