Table of contents
1.
Introduction
2.
Characteristics of Bernoulli trials
3.
Bernoulli Distribution
3.1.
Probability mass function
3.2.
Mean
3.3.
Variance and Standard Deviation
4.
 
5.
 
6.
Plotting Bernoulli Distribution
7.
Solved Examples
8.
FAQs
9.
Key Takeaways
Last Updated: Mar 27, 2024

Bernoulli Trials

Author soham Medewar
0 upvote
Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

Introduction

Bernoulli's trial is an experiment in the theory of statistics and probability where the outcome of each trial is either 1 or 0. Here 1 can be termed as success and 0 as a failure. Bernoulli's trial was named after the scientist Jacob Bernoulli. As the outcome of the Bernoulli trial has two possibilities, it can be used to frame yes or no questions. For example:

  • Will it rain today?
  • Will India win today’s match?

Characteristics of Bernoulli trials

There are four important characteristics of Bernoulli’s trial.

  • They are finite in number.
  • Every trial is independent.
  • The outcome of each trial is either success or failure.
  • The probability of success or failure for each trial remains the same.

Bernoulli Distribution

Bernoulli distribution is a discrete probability distribution of a random variable. It takes the value 1 with probability p and value 0 with probability q (q = 1-p). In simple words, it can be thought of as a model where a set of the possible outcomes of a single experiment asks yes or no questions. Bernoulli Distribution is a special case of a binomial distribution.

It can be used to represent while tossing a coin. 1 represents getting head with probability p, and 0 represents getting tail with probability q (q = 1 - p).

Probability mass function

IF X is the random variable of the Bernoulli distribution, then the probability mass function of X will be:

P(x) = p (if x = 1)
        = 1 - p (if x = 0)

Together we write:
P(x) = px(1 - p)1-x where x = 0, 1.

Python Code for Bernoulli probability mass function:

def probability_mass_function(x, p):
return p**x*(1-p)**(1-x)

Mean

The expected value E(x) or mean of the Bernoulli random variable X is:

Mean(𝞵) = ∑xP(x)
               = 0.P(0) + 1.P(1)
               = p

Python Code for Mean of Bernoulli distribution.

def mean(p):
return p

Variance and Standard Deviation

The variance of the Bernoulli random variable X is:
𝞼2 = Var(X) = E(X2) - |E(X)|2

Python code for variance and standard deviation of Bernoulli random variable.

def variance(p):
      return p*(1 - p)

def standard_deviation(var):
return var**(1/2)

 

 

Plotting Bernoulli Distribution

In the above plot, we have taken three examples.

The first example(red line), probability of x=0 is 0.2 and probability of x=1 is 0.8.
We can write P(x = 0) = 0.2 and P(x = 1) = 0.8.

Similarly, for the blue line, we can write:
P(x = 0) = 0.8 and P(x = 1) = 0.2.

For the green line, we can write:
P(x = 0) = 0.5 and P(x = 1) = 0.5.

Solved Examples

  1. The probability of the scooter may start in a single kick is 0.3. Find the probability where the scooter may not start in a single kick.
    Here let us denote p = 0.3
    Therefore q = 1 - p
                     q = 1 - 0.3
                     q = 0.7
    Hence, the probability of the scooter not starting with a single kick is 0.7.
     
  2. If the value of p for Bernoulli's distribution is 0.56, find the value of the variance of the distribution.
    Variance = pq
                   = p*(1-p)
                   = 0.56 * (1 - 0.56)
    Therefore, the variance is 0.2464.

FAQs

  1. How many outcomes a Bernoulli trial can have?
    A Bernoulli trial has exactly two outcomes.
     
  2. How do you know if it is a Bernoulli trial?
    We can consider this as an example of an experiment where the results might be termed as either success or failure, one result being the complement of the other. If the probability of succeeding is p, then the probability of failing is 1 − p. Such a form of an experiment is termed a Bernoulli trial.
     
  3. Is Bernoulli discrete or continuous?
    A Bernoulli distribution is a discrete distribution with only two possible values for the random variable.
     
  4. What is another name for the Bernoulli trial?
    Another name for the Bernoulli trial is the Dichotomous experiment.

Key Takeaways

In this article, we have discussed:

  • Bernoulli trials
  • Bernoulli distribution
  • Plotting Bernoulli distribution
  • Mean, Variance, Standard Deviation of Bernoulli distribution

Hello readers, here's a perfect course that will guide you to dive deep into Machine learning.
Happy Coding!

Live masterclass