Basics of Counting
Sum Rule
If sets A and B are disjoint sets(the sets which have no common element in them), then
|A⋃B|=|A| + |B|
For example:
a class has 43 girls and 54 boys total of the class=43+54=97
Product Rule
If set A and set B the cartesian product is :
A*B={(a,b)| a ∈ A and b ∈ B}
if |A| =n and |B| = m then |A*B|=n*m
for example:
A={a,b} and B={c,d}
A*B={(a,c),(a,d),(b,c),(b,d)}
Examples on counting:
1. how many password satisfy the following requirements:
- it should be 6 to 8 characters long.
- starts with a letter.
- case sensitive.
- other characters: digits or letters.
first we will find the six character password as:
=52*62*62*62*62*62 { here first 52 is for 26 small letters and 26 for capital letters, other 5 times 62 are for digits(10) and letters(52=26+26)}
=52*62⁵
second for seven characters password as:
=52*62*62*62*62*62*62{ here one extra 62 is multiplied according to the 1st case it is for the seventh characters}
=52*62⁶
last for eight characters password as:
=52*62*62*62*62*62*62*62 { here one extra 62 is multiplied according to the 2nd case it is for the eighth characters}
=52*62⁷
in total the three cases are added to get total number of passwords:
=52*62⁵+52*62⁶+52*62⁷
=19*10¹⁴
2. how many 4 digit numbers with first 5 digits?
solution:
here, for the first place we have all 5 choices and for 2nd also 5 choices and so on...
=5*5*5*5=625
Comments
Post a Comment