VOOZH about

URL: https://www.geeksforgeeks.org/dsa/binomial-random-variables/

⇱ Binomial Random Variables - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Binomial Random Variables

Last Updated : 3 Oct, 2025

In this post, we'll discuss Binomial Random Variables.
Prerequisite : Random Variables 
A specific type of discrete random variable that counts how often a particular event occurs in a fixed number of tries or trials. 
For a variable to be a binomial random variable, ALL of the following conditions must be met: 

  1. There are a fixed number of trials (a fixed sample size).
  2. On each trial, the event of interest either occurs or does not.
  3. The probability of occurrence (or not) is the same on each trial.
  4. Trials are independent of one another.


Mathematical Notations 

n = number of trials
p = probability of success in each trial
k = number of success in n trials


Now we try to find out the probability of k success in n trials.
Here the probability of success in each trial is p independent of other trials. 
So we first choose k trials in which there will be a success and in rest n-k trials there will be a failure. Number of ways to do so is 

👁 Image


Since all n events are independent, hence the probability of k success in n trials is equivalent to multiplication of probability for each trial.
Here its k success and n-k failures, So probability for each way to achieve k success and n-k failure is 

👁 Image


Hence final probability is 

(number of ways to achieve k success
and n-k failures)
*
(probability for each way to achieve k
success and n-k failure)


Then Binomial Random Variable Probability is given by: 

👁 Image


Let X be a binomial random variable with the number of trials n and probability of success in each trial be p. 
Expected number of success is given by 

E[X] = np


Variance of number of success is given by 

Var[X] = np(1-p)


Example 1 : Consider a random experiment in which a biased coin (probability of head = 1/3) is thrown for 10 times. Find the probability that the number of heads appearing will be 5.
Solution : 

Let X be binomial random variable 
with n = 10 and p = 1/3
P(X=5) = ?
👁 Image
👁 Image

Here is the implementation for the same 

Output:

Probability of 5 heads when a coin is tossed 10 times where probability of each head is 0.333333
is = 0.136565


Comment
Article Tags: