I'm working on a simple discrete math question that should be pretty easy but I'm doing something wrong in my method.
I have a question where I'm supposed to count the number of strings of length 6 that contain the letters A and B. My professor showed us the correct way to do it, but I'm not sure what I'm overcounting by doing it my way.
Process 1 :
S = total number of strings of length 6 with letters and repitition allowed
|S| = 26^6
A = number of strings of length 6 without A
|A| = 25^6
B = number of strings without B
|B| = 25^6
A intersect B = The number of strings without A and without B
|A intersect B| = 24^6
What I'm looking for is S - ( A union B ) since that would be :
Total strings = Strings that have A and B + Strings without a and without b
S = answer + (A union B )
answer = S - (A union B)
answer = 26^6 - ( |A| + |B| - |A intersect B| )
answer = 26^6 - ( 2(25^6) - 24^6 )
answer = 26^6 - 2( 25^6 ) + 24^6 = 11,737,502
My process of though :
My string has to have at least 1 and b. So why don't I just choose 2 spots for a and b and then choose the rest of the letters. P(6,2) = 6! / 4! ways to place "a" and "b" in the string of length 6 = 30 ways. I then have 4 empty spaces where I can put any letters I want so P(26,4) = 26! / 4!
My answer = 30 * 26! / 4! = 10,764,000
11737502 - 10764000 = 973502
¿Que? If anybody can see what I'm not counting I would greatly appreciate it. I'm going to try and study the rest of this junk.
Thanks for checking it out.
-silver
I have a question where I'm supposed to count the number of strings of length 6 that contain the letters A and B. My professor showed us the correct way to do it, but I'm not sure what I'm overcounting by doing it my way.
Process 1 :
S = total number of strings of length 6 with letters and repitition allowed
|S| = 26^6
A = number of strings of length 6 without A
|A| = 25^6
B = number of strings without B
|B| = 25^6
A intersect B = The number of strings without A and without B
|A intersect B| = 24^6
What I'm looking for is S - ( A union B ) since that would be :
Total strings = Strings that have A and B + Strings without a and without b
S = answer + (A union B )
answer = S - (A union B)
answer = 26^6 - ( |A| + |B| - |A intersect B| )
answer = 26^6 - ( 2(25^6) - 24^6 )
answer = 26^6 - 2( 25^6 ) + 24^6 = 11,737,502
My process of though :
My string has to have at least 1 and b. So why don't I just choose 2 spots for a and b and then choose the rest of the letters. P(6,2) = 6! / 4! ways to place "a" and "b" in the string of length 6 = 30 ways. I then have 4 empty spaces where I can put any letters I want so P(26,4) = 26! / 4!
My answer = 30 * 26! / 4! = 10,764,000
11737502 - 10764000 = 973502
¿Que? If anybody can see what I'm not counting I would greatly appreciate it. I'm going to try and study the rest of this junk.
Thanks for checking it out.
-silver