Table of contents
1.
Introduction
2.
Why do we need Elementary probability theory?
3.
What is Elementary probability theory?
3.1.
Addition Rule
3.2.
Multiplication Rule
3.3.
Bayes’ Theorem
4.
Frequently Asked Questions
4.1.
What is sample space?
4.2.
What do you mean by mutually exclusive events?
4.3.
How do you calculate the probability of an event?
4.4.
When does Bayes’ theorem fail?
5.
Conclusion
Last Updated: Mar 27, 2024

Introduction to Elementary probability theory

Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

Introduction

Hello ninjas, this blog will help you understand Elementary probability theory, which will help you better understand Shannon’s Theory and cryptography.
Probability theory defines the likelihood of an event to occur between 1 and 0 (1 being definite and 0 is unlikely). The probability of an event A is defined as P(A) ranging between 0 to 1. 

For example, while choosing a random card out of a deck of 52 cards, the probability of it being red colour is 1/2. In this case, the likely events are 26 in the sample space of 52 events. Hence, the probability is 52/26 or 1/2.

Introduction to elementary probability

Why do we need Elementary probability theory?

We require probability theory to calculate the chance of occurrence of an event. 

In Cryptography, we use Elementary probability theory to study the absolute security of a cryptosystem. This is because it is practically unfeasible to define the time complexities of a cryptosystem's safety, and we use probability to figure out the complexities closely.

What is Elementary probability theory?

An elementary event results from random experiments and is the single element of the probability sample space. The elementary event is defined numerically between numbers 0 to 1. 

The elementary event is calculated as the outcome in the sample space. The higher the times the event occurs in the sample space, the higher probability it has. For example, for an unbiased pair of dice, the sample space can be drawn as follows.

Sample space for pair of dice

Every individual entry in the sample space is an elementary event. The higher times a number appears in the sample space, the higher the likelihood of it occurring.

The elementary theory considers the following rules for two events, A and B, co-occurring:

Addition Rule

For events A and B, we try to find the probability of either, neither or both occurring.

Venn Diagram

To calculate the likelihood of either the two or both occurring,  

We use the formula: 

P(A∪B) = P(A) + P(B) - P(A∩B) 

(where P(AB) is the probability of intersection events if A and B)

Example

If P(A) is the probability of a fruit being an orange and P(B) is the probability of a fruit being a lemon, then the probability of the fruit being citrus is P(A∪B).

For mutually exclusive events, 

P(A∪B) = P(A) + P(B) 

Example

If  P(A) is the probability of a person having an apple phone and P(B) is the probability of a person having a Samsung phone, then both are mutually exclusive events, and the likelihood of a person having both an apple and a Samsung phone is  P(A) + P(B). (Assuming that a person can have only one smartphone)

Multiplication Rule

The multiplication rule helps us to calculate the probability of both events happening together.

Formula:

P(A∩B) = P(A)×P(B/A) = P(B)×P(A/B) 

For mutually exclusive events, the likelihood of B is unaffected by the occurrence of A. Therefore, the formula becomes  

P(A∩B) = P(A)×P(B)

Example

Suppose P(A) is the probability of a plane flying, and P(B) is the probability of the plane not arriving at its destination. Then the probability of the plane crashing is P(A∩B)=P(A) x P(B).

Bayes’ Theorem

From the Multiplication rule,

P(A)×P(B/A) = P(B)×P(A/B) 

Therefore, 

P(B/A)=P(B)×P(A/B) ⁄ P(A)

This is Bayes’ theorem, which calculates the probability of event B's occurrence, given that event A has already occurred.

venn diagram for bayes theorem

Example

Suppose a bag contains 6 Red Balls and 4 blue Balls. Two balls are drawn at random from the bag without any replacement. What will be the probability that both of the balls will be blue?

Let there be two events, A and B. Event A means that the first ball is blue, and Event B means the second ball is blue.
Therefore,
P(A) = P(First Ball is Blue)=4/10
P(B/A) = P(Second ball is Blue / First Ball is Blue) = 3/9
P(AB) = P(A)*P(B/A) = 2/15.

Frequently Asked Questions

What is sample space?

Sample space is the area of random trials of the events. It is the set of all possible outcomes.

What do you mean by mutually exclusive events?

Two events are called mutually exclusive if the occurrence of one event does not influence the probability of other events

How do you calculate the probability of an event?

The formula to calculate the probability of an event is: 

P(A) = number of times the event occurs in the sample space/ total events in the sample space

When does Bayes’ theorem fail?

Bayes’ theorem fails when P(A)=0, i.e. the probability of occurrence of A is null.

Conclusion

We hope this blog successfully helped you understand the concept of probability and its applications.

Refer to the Basics of C++ with Data StructureDBMS, and Operating System by Coding Ninjas, and keep practising on our platform Coding Ninjas Studio. You can check out the mock test series on code studio.

Check out the Samsung Interview Experience to learn about Samsung’s hiring process.

You can also refer to our Guided Path on Coding Ninjas Studio to upskill yourself in domains like Data Structures and AlgorithmsCompetitive ProgrammingAptitude, and many more! Refer to the interview bundle if you want to prepare for placement interviews. Check out interview experiences to understand various companies' interview questions.

Give your career an edge over others by considering our premium courses!

Happy Learning!

Thankyou image

Live masterclass