You are on page 1of 10

Subham Subhasish Panda - 19BIT0093

DIGITAL ASSIGNMENT - 2

BINOMIAL DISTRIBUTION

23% of all the IT servers in India crash everyday. If 200 servers from
India are selected at random, calculate the following :
a. Sketch the probability mass function.
b. Sketch the cumulative distribution function.
c. Probability that exactly two of them will crash today.
d. Probability that at most 10 of them will crash today.
e. Probability that between 5 to 8 servers (inclusive) will crash
today.
f. Probability that at least 100 servers will crash.
g. Probability that all servers will crash.
h. Probability that no server will crash.
i. Give the Mean of X
j. Give the variance of X.

Solution:

We have n = 200 and p=0.23

Let X be the number of servers crashing everyday.

a.
plot(0:200,dbinom(0:200,200,0.23),type='o',xlab='Number of
Servers(X)',ylab='Probability of X servers crashing')
Subham Subhasish Panda - 19BIT0093
DIGITAL ASSIGNMENT - 2

b.
plot(0:200,pbinom(0:200,200,0.23),type='o',xlab='Number of
Servers(X)',ylab='Probability of at most X servers crashing')
Subham Subhasish Panda - 19BIT0093
DIGITAL ASSIGNMENT - 2

c.
#P(X=2)
dbinom(2,200,0.23)

d.
#P(X<=10)
pbinom(q=10,size=200,prob=0.23,lower.tail=T)

e.
#P(5<=X<=8)
sum(dbinom(5:8,200,0.23))
Subham Subhasish Panda - 19BIT0093
DIGITAL ASSIGNMENT - 2

f.
#P(X>=100)
1 - pbinom(q=100,size=200,prob=0.23,lower.tail=F)

g.
#P(X=0)
dbinom(0,200,0.23)

h.
#P(X=200)
dbinom(200,200,0.23)

i.
x=dbinom(0:200,200,0.23)
p=0.23
Subham Subhasish Panda - 19BIT0093
DIGITAL ASSIGNMENT - 2

IEx=sum(x*p)

j.
sum((x-IEx)^2*x)
Subham Subhasish Panda - 19BIT0093
DIGITAL ASSIGNMENT - 2

POISSON DISTRIBUTION

2% of the total websites on the internet are viable to XSS(cross


scripting attack). If 300 websites are chosen at random from the
internet, then calculate the following:
a. Plot the Poisson distribution curve for probability mass
function.
b. Plot the Poisson distribution curve for cumulative distribution
function.
c. Probability that at least 3 websites can be attacked.
d. Probability that exactly 20 of the websites are viable to attack.
e. Probability that at most 10 websites are viable.
f. Probability that none of the websites are viable to attack.
g. Probability that all websites are viable to attack.
h. The mean on the distribution.
i. The variance of the distribution.

Solution:

We have n = 300 and p=0.02.

Since the probability of success is very low and close to 0, we can apply
poisson distribution.

We have 𝜆 = np = 300*0.02 = 6

Let X be the number of websites viable to XSS attack.


Subham Subhasish Panda - 19BIT0093
DIGITAL ASSIGNMENT - 2

a.
plot(0:300,dpois(0:300,6),type='o')

b.
plot(0:300,ppois(0:300,6),type='o')
Subham Subhasish Panda - 19BIT0093
DIGITAL ASSIGNMENT - 2

c.
sum(dpois(3:300,6))

d.
dpois(20,6)

e.
ppois(10,6,lower.tail=T)
Subham Subhasish Panda - 19BIT0093
DIGITAL ASSIGNMENT - 2

f.
dpois(0,6)

g.
dpois(300,6)

h.
x=0:300
p=dpois(x,6)
Ex = sum(x*p)
Subham Subhasish Panda - 19BIT0093
DIGITAL ASSIGNMENT - 2

j.
var = sum((x-Ex)^2*p)

You might also like