Aptitude

ShareWe are dealing with probability every day. For instance when you say that it going to turn heads even before your friend has tossed the coin or when you look up at the sky and say that it’s going to rain. Or when you are watching a tennis match at Wimbledon and you say that there is a higher chance that Roger Federer will win, you are actually taking about probability. In this post we will be discussing about probability in detail. To under the topic of probability it is assumed that you know about permutation and combination. If you don’t know what permutation and combination is then I would recommend you to go through these two topics before starting probability.

Click here to read about Permutations.

Click here to read about Combinations.

Probability is all about predicting the chance of occurrence of an event before it actually occurs. For example Sachin Tendulkar will hit a six in the next ball is probability. Though the bowler, Bret Lee has not yet delivered the next ball but by seeing Sachin score in previous balls of the over you are predicting the future. So you are estimating the probability.

So probability is all about predicting, estimating and guessing the outcome before the actual occurrence of the event.

Mathematically, we measure probability from 0 to 1.

If the occurrence of an event is certain then its probability is 1. For example, Sunday will come after Saturday. This will always occur with full certainty so its probability is 1. On the other hand if it is certain that an event cannot occur at all then its probability is 0. For example, the probability of getting head and tail both simultaneously when a coin is tossed is 0. Hence if the probability of occurrence of an event is closer to 1 then the chance of its occurrence is higher and if the probability of occurrence of an event is closer to 0 then the chance of its occurrence is lower.

Remember probability talks about chance. It never tells with certainty that an event will occur because sometimes an event with higher probability fails to occur while on the other hand an event with negligible chance succeeds.

An experiment for which we know the set of all different outcomes (results) but it is not possible to predict with certainty which one of the set will occur at any particular execution of the experiment is called a random experiment or chance experiment.

For example, we know that on tossing a coin we will either get head or tail (set of all the result) but we cannot tell with certainty which one of the two will occur at any particular tossing of a coin. So tossing of a coin is a random experiment or chance experiment.

The set of all possible outcomes (results) of a random experiment is called the sample space of that random experiment.

We denote sample space by S.

For instance,

If a coin is tossed then all possible outcomes are head (H) and tail (T). So the sample space in this case is

S = {H, T}

If a die is cast, then all possible outcomes are 1, 2, 3, 4, 5 and 6. So the sample space in this case is

S = {1, 2, 3, 4, 5, 6}

If two coins are tossed together then all the possible outcome i.e., sample space is

S = {(H, H), (H, T), (T, H), (T, T)}

Similarly, if two die is thrown together then the sample space is

S = {(1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6), (2, 1), (2, 2), …, (6, 1), (6, 2), (6, 3), (6, 4), (6, 5), (6, 6)}

Total 36 outcomes.

Each element of the sample space associated with a random experiment is called a simple (elementary) event of the experiment. A simple event cannot be further broken down into simpler events.

An event which can be further decomposed into simpler event is called a complex event.

If we consider a die then the sample space is S = {1, 2, 3, 4, 5, 6}. Now a statement “An even number appears on top” is an event say A. So A will occur if the 2, 4 or 6 appear on top when a die is thrown. And we will say event A has not occurred when 1, 3 or 5 appears in top.

Thus we denote the event A as A = {2, 4, 6}

Note A is a proper subset of S.

Similarly if two coins are tossed together then the sample space is S = {(H, H), (H, T), (T, H), (T, T)}. Now if we consider an event “One Head and One Tail” and denote it as A, then in this case we say event A has occurred only if the outcome is (H, T) or (T, H) and we say that event A has not occurred when the outcome is (H, H) or (T, T).

Thus we denote the event “One Head and One Tail” as A = {(H, T), (T, H)}

If A and B be any two events associated with a random experiment, then we say that an event A or B has occurred only when either A or B or both occurs.

This is denoted as A∪B

Example

If we consider a die and define an event “All even number” say A = {2, 4, 6} and another event “All odd number” say B = {1, 3, 5} then we say event A∪B has occurred if the outcome is either an even number or an odd number.

So A∪B = {2, 4, 6} ∪ {1, 3, 5} = {1, 2, 3, 4, 5, 6}

If A and B be any two events associated with a random experiment, then we say that an event A and B has occurred only when both events A and B occurs together.

It is denoted as A∩B

If we consider 10 numbers from 1 to 10 and define an event “All even numbers” say A = {2, 4, 6, 8, 10} and another event “All number greater than 5” say B = {6, 7, 8, 9, 10} then we say event A∩B has occurred only when then outcome of the random experiment is an even number and greater than 5 both.

So A∩B = {2, 4, 6, 8} ∩ {6, 7, 8, 9, 10} = {6, 8, 10}

Two events are said to be equally like events if we have no reason to except any one of the event in preference to the other event.

Example: Tossing a perfect coin it is equally likely to get head and tail.

Two events are said to be mutually exclusive if both the events cannot occur simultaneously. That is if one event occurs then the other event will not occur at all.

Example: Getting Head and Tail both simultaneously on tossing a single coin is a mutually exclusive event.

A set of events A1, A2, A3, …, Ak are said to be mutually exclusive and exhaustive set of events if A1. A2. A3, …, Ak are the subset of a sample space S such that

i. Ai∩Aj=∅ where i ≠j

ii. A1∪A2∪A3∪…∪Ak=S

That is, any two events taken together are mutually exclusive and the union of all the events taken together will give the sample space.

Let S be a sample space associated with a random experiment and let A and B be two events and subset of S such that A is a proper subset of B.

If w is an outcome of the random experiment and belongs to A then we can say that event A has occurred. And as A is a proper subset of B then w also belongs to B so we can say that B has also occurred. Thus event B is implied by the event A as A is a proper subset of B.

Example: If we consider the sample space of a die S = {1, 2, 3, 4, 5, 6} and the two events “All even number” say A = {2, 4, 6} and another event “All number greater than or equal to 1” say B = {1, 2, 3, 4, 5, 6} and if 6 occurs when the die is cast then we can say that event A has occurred as 6 belongs to A and as A is a proper subset of B thus we can also say that event B has also occurred as 6 belongs to B.

If an event is going to occur with absolute certainty then it is called a sure event and it has a probability of 1.

Example: Falling of apple from the tree is absolutely certain. Newton’s gravity law!

If an event is absolutely impossible to occur then it is called an impossible event and it has a probability of 0.

Example: Swimming across the globe from Indian Ocean to Pacific Ocean, Atlantic Ocean and back to Indian Ocean is absolutely impossible.

Let a random experiment has n outcomes. Then the sample space has n elements. Let A be a subset of S such that A contains m outcomes. Then A is an event consisting of m elements. Then the probability of the occurrence of A is m/n i.e.,

P(A) = m/n

P(A) = No. of outcomes favorable to A / Total no. of outcomes

**Q. If a bag contains 12 red and 8 blue balls, then what is the probability of drawing at random a red ball. And what is the probability of drawing a blue ball at random.**

A. Let A be the event of drawing a red ball and B be the event of drawing a blue ball from the bag.

Total number of balls in the bag = 12 + 8 = 20

So the size of sample space is n(S) = 20

First part of the question:

Event A will occur only if a red ball is drawn from the bag and there are 12 red balls in the bag so,

No. of outcomes favorable to A is n(A) = 12

Therefore, probability of drawing a red ball is P(A) = n(A)/n(S) = 12/20

Second part of the question:

Event B will occur only if a blue ball is drawn from the bag and there are 8 blue balls in the bag so,

1 blue ball can be selected out of 8 blue balls in 8C1= 8 ways.

So, n(B) = No. outcomes favorable to B = 8

And 1 ball can be selected out of 20 in 20C1 = 20 ways.

So, n(S) = total number of outcomes = 20

Therefore, probability of drawing a blue ball is P(B) = n(B)/n(S) = 8/20

If A and B be two mutually exclusive events connected with a random experiment then the probability of occurrence of the event A or B is the sum of the probability of the event A and B

P(A or B) = P(A) + P(B)

Or,

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

If A1, A2, A3, …, Ak be k mutually exclusive events then

P(A1 ∪ A2 ∪ A3 ∪ … ∪ Ak) = P(A1) + P(A2) + P(A3) + … + P(Ak)

If A and B be two events connected with a random experiment and they are not mutually exclusive then in that case probability of occurrence of A or B is as follows

P(A or B) = P(A) + P(B) – P(A and B)

Or,

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

In the above picture S is the sample space, A and B are two events not mutually exclusive.

For three events

For three events A, B and C not mutually exclusive and associated with a random experiment then,

P(A or B or C) = P(A) + P(B) + P(C) – P(A and B) – P(B and C) – P(C and A) + P(A and B and C)

Or,

P(A∪B∪C) = P(A) + P(B) +P(C) – P(A∩B) – P(B∩C) – P(C∩A) + P(A∩B∩C)

**Theorem 3**

For every event A associated with a random experiment

If the probability of occurrence of A is P(A)

Then the probability of not occurrence of A is

P(not A) = 1 – P(A)

Or,

P(A^{C}) = 1 – P(A)

So P(A) and P(A^{C}) are mutually exclusive and P(A) + P(A^{C}) = 1

Let S be a sample space of a random experiment and let A be a subset of S representing event A. Then AC is also a subset of S and A, AC are mutually exclusive and exhaustive set of events.

Therefore, A∪A^{C} = S

Or, P(A∪A^{C}) = P(S)

Or, P(A) + P(A^{C}) = 1 [Since P(S) = 1]

Or, P(A) = 1 – P(A^{C})

**Important Result**

P(A) = P(A∩B) + P(A∩BC)

P(B) = P(A∩B) + P(AC∩B)

In the above picture S is the sample space, A and B are two events not mutually exclusive.

**Q. In a single throw of two dice, find the probability of getting a total of 9 or 11?**

A. Let A be the event “Total of 9” and let B be the event “Total of 11”.

A = {(3,6), (4,5), (5,4), (6,3)}

B = {(5,6), (6,5)}

No. of elementary events in A = n(A) = 4

And no. of elementary events in B = n(B) = 2

Total no. of elementary event in the sample space S = n(S) = 36

P(A) = n(A)/n(S) = 4/36

P(B) = n(B)/n(S) = 2/36

So P(A∪B) = P(A) + P(B) = 4/36 + 2/36 = 1/6

Therefore probability of getting a total of 9 or 11 is 1/6

**Q. Find the probability of drawing an ace or a spade or both from a deck of cards?**

A. Let A be the event “Draw a Ace” and let B be the event “Draw a Spade”.

There are 4 ace in a deck of cards so number of elementary events in A = n(A) = 4.

There are 13 spades in a deck of cards so number of elementary events in B = n(B) = 13.

And there are 52 cards in deck so size of sample space is = n(S) = 52.

So probability of drawing an ace = P(A) = n(A)/n(S) = 4/52

And probability of drawing a space = P(B) = n(B)/n(S) = 13/52

Now there is only a single card that is both an ace and spade.

So number of elementary event favorable to Ace and Space = n(A∩B) = 1

So probability of drawing both ace and spade = P(A∩B) = n(A∩B)/n(S) = 1/52

Since event A and event B are mutually exclusive so the probability of getting an ace or spade or both is

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

= 4/52 + 13/52 – 1/52

= 4/13

Therefore the required probability is 4/13

**Q. An urn contains 2 red, 3 white and 4 blue balls. 3 balls are drawn at random from the urn. What is the chance that**

**i. The three balls will be of different color**

**ii. 2 balls of same color and the third a different color.**

A. Total number of balls in the urn = 2+3+4 = 9

3 balls can be drawn out from 9 in 9C3 = 84 ways.

First part of the question:

All the 3 balls will be different if we draw 1 red, 1 white and 1 blue ball.

1 red ball can be drawn out of 2 in 2C1 = 2 ways.

1 white ball can be drawn out of 3 in 3C1 = 3 ways.

1 blue ball can be drawn out of 4 in 4C1 = 4 ways.

So number of ways in which 3 different balls can be drawn = 2x3x4 = 24

Therefore the required probability of drawing 3 different balls = 24/84 = 2/7

Second part of the question:

2 balls will be same and the third one different if we draw balls from the urn in the follows ways:

2 red 1 white

2 red 1 blue

2 white 1 red

2 white 1 blue

2 blue 1 red

2 blue 1 white

Therefore total number of favorable cases is

= (2C2 x 3C1) + (2C2 x 4C1) + (3C2 x 2C1) + (3C2 x 4C1) + (4C2 x 2C1) + (4C2 x 3C1)

= 55

Hence the required probability = 55/84

- Design Patterns - Strategy Pattern Design Patterns
- PostgreSQL - SELECT FROM Table PostgreSQL
- PostgreSQL - INSERT INTO Table PostgreSQL
- PostgreSQL - CREATE Table PostgreSQL
- Node.js - URL module Node.js
- Node.js - Create web server using http module Node.js
- Node.js - Event Emitter Node.js
- Node.js - How to write file in Node.js using fs module Node.js
- Node.js - How to read file in Node.js using fs module Node.js
- ES6 - Arrow Function ES6 JavaScript