[SOLVED] AI5002-Assignment 4

24.99 $

Programming resource
Digital learning resource
Category:
Practical programming resource
Suitable for guided study and reference
Tutor guidance available when needed

Description

Rate this product

. Problem

Find the probability distribution of

(i) number of heads in two tosses of a coin. (ii) number of tails in the simultaneous tosses of three coins.

(iii) number of heads in four tosses of a coin.

  1. Solution

Let Y denote the event of tossing a coin. Considering a fair coin, the probability of getting a Head

or Tail P(Y) = 0.5

We have i coin tosses, with probability p of Heads and (1-p) of Tails. We conduct the trials independently.

In general , the probability of getting of j Head/Tail is given as:

n!         j                    (nj)

P(Y = j) = p (1 − p) (1) j!(n j)!

Consider a random variable X where X = Number of successes.Suppose we have n trials. We write X

˜B(n, p)

(i) Let X denote the random variable of number of Heads. The probability distribution of getting exactly j Heads in 2 tosses of coin is given as:

X ˜B(2, 0.5)

Using equation

2!         .5j(1 − 0.5)(2−j)             (2)

P(X = j) = 0 j!(2 − j)!

We get the pdf as below:

P(X = 0) = .50(1 − 0.5)(2−0) = 0.25 (3)

P(X = 1) = 0.51(1 − 0.5)(2−1) = 0.5 (4)

P(X = 2) = .52(1 − 0.5)(2−2) = 0.25 (5)

The distribution table is given as:

j 0 1 2
P(X=j) 0.25 0.5 0.25

(ii)Let X denote the random variable of number of Tails. The probability distribution of getting exactly j Tails in 3 tosses of coin is given as:

X ˜B(3, 0.5)

Using equation

3!         .5j(1 − 0.5)(3−j)             (6)

P(X = j) = 0 j!(3 − j)!

We get the pdf as below:

P(X = 0) = 0.50(1 − 0.5)(3−0) = 0.125

(7)

P(X = 1) = 0.51(1 − 0.5)(3−1) = 0.375

(8)

P(X = 2) = 0.52(1 − 0.5)(3−2) = 0.375

(9)

P(X = 3) = 0.53(1 − 0.5)(3−3) = 0.125

(10)

The probability distribution of X is:

j 0 1 2 3
P(X=j) 0.125 0.375 0.375 0.125

(iii)Let X denote the random variable of number of Heads. The probability distribution of getting exactly j Heads in 4 tosses of coin is given as:

X ˜B(4, 0.5)

Using equation

4!            j                        (4−j)

P(X = j) = 0.5 (1 − 0.5) (11) j!(4 − j)!

 

2

We get the pdf as below:

P(Y3 = 0) = 0.50(1 − 0.5)(4−0) = 0.0625

(12)

P(X = 1) = 0.51(1 − 0.5)(4−1) = 0.25

(13)

P(X = 2) = 0.52(1 − 0.5)(4−2) = 0.375

(14)

P(X = 3) = 0.53(1 − 0.5)(4−4) = 0.25

(15)

P(X = 4) = 0.54(1 − 0.5)(4−4) = 0.0625

(16)

The probability distribution of X is:

j 0 1 2 3 4
P(X=j) 0.0625 0.25 0.375 0.25 0.0625

The probabilities were simulated using the python code.

Figure 1: Simulation for tossing a fair coin

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.