The four calling birds are singing a melody with 7 notes. Each of the four calling birds can sing one unique note; A, B, C and D respectively. In the melody every bird must sing at least one note. One possible melody for example is ABCDABC.
Find the total number of different melodies that they can sing.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Another approach which avoids checking cases, and thus easily generalizes, is to use Principle of Inclusion and Exclusion .
4 7 − ( 1 4 ) 3 7 + ( 2 4 ) 2 7 − ( 3 4 ) 1 7 + ( 4 4 ) 0 7 = 8 4 0 0
Do you see why?
Log in to reply
Let M represent the set all possible melodies without any restriction. Additionally, let M A represent the set of all melodies that don't contain the note A , M B represent the set of all melodies that don't contain the note B , and in a similar way we define M C and M D . According to the question we have to find the cardinality of the set of all melodies where none of the 4 notes is missing. Therefore, we should find the cardinality of the set M − ( M A ∪ M B ∪ M C ∪ M D ) . Now using the Principle of Inclusion and Exclusion we get that the cardinality of the last set is ∣ M ∣ − ∣ M A ∪ M B ∪ M C ∪ M D ∣ = ∣ M ∣ − ∣ M A ∣ − ∣ M B ∣ − ∣ M C ∣ − ∣ M D ∣ + ∣ M A ∩ M B ∣ + . . . . Using the facts that ∣ M ∣ = 4 7 , ∣ M A ∣ = ∣ M B ∣ = ∣ M C ∣ = ∣ M D ∣ = 3 7 , ∣ M A ∩ M B ∣ = ∣ M A ∩ M C ∣ = . . . = 2 7 , ∣ M A ∩ M B ∩ M C ∣ = ∣ M A ∩ M B ∩ M D ∣ = . . . = 1 7 = 1 and ∣ M A ∩ M B ∩ M C ∩ M D ∣ = 0 7 = 0 we obtain that the answer is going to be 4 7 − ( 1 4 ) 3 7 + ( 2 4 ) 2 7 − ( 3 4 ) 1 7 + ( 4 4 ) 0 7 = 8 4 0 0
I tried that, but unfortunately I didn't notice that the coefficient of ( − 1 ) n n 7 was the binomial coefficient rather than n + 1 .
That is a very elegant approach! It generalises very nicely; I did not think of applying the Principle of Inclusion and Exclusion in this way. I'm not too sure how to explain it formally but here is my alternative (outlined) attempt:
We want to find the number of ways of using all four notes. We can do this by taking the total number of possible melodies with at most four notes, then we take away the number of possible melodies with at most three notes, then we add back the ones with at most two notes and so on. This gives the required result.
Please may you show me how to explain it formally? I'm not sure what meaning to assign the sets with in order to use PIE.
Log in to reply
Right. The 'formal' explanation would be to use PIE. Consider the following sets:
W
is the set of melody with 7 notes that do not contain A,
X
is the set of melody with 7 notes that do not contain B,
Y
is the set of melody with 7 notes that do not contain C,
Z
is the set of melody with 7 notes that do not contain D.
Then, we want to find ∣ W ∩ X ∩ Y ∩ Z ∣ . Applying PIE, it is equal to
∣ S − ∪ ∣ W ∣ ∣ = ∣ S ∣ − ∑ ∣ W ∣ + ∑ ∣ W ∩ X ∣ − ∑ ∣ W ∩ X ∩ Y ∣ + ∑ ∣ W ∩ X ∩ Y ∩ Z ∣
That's precisely the best approach, I can think of!
Why is this wrong ?
( 4 1 ) . ( 7 4 ) . 3 ! + ( 4 2 ) . ( 7 3 ) . ( 4 2 ) . 2 ! + ( 4 3 ) . ( 7 2 ) . ( 5 2 ) . ( 3 2 ) .1!
You can see how I did it .
Log in to reply
This method works for 6 and 4 but not for 7 and 4. Can you tell me why?
*Well, this is not a specific method but just that how many same note one can have and i can elaborate this if you want but please clear my doubt. @Michael Ng
Log in to reply
This is an interesting method! The only place where you are incorrect is in the middle term. When we have fixed ABCD and we want to choose the rest as AAB, we do not just have ( 2 4 ) possibilities because for each AAB there is an ABB which we have not counted. You will find that multiplying the middle term by 2 gives you the correct answer.
The method works for 6 because then we do not have a case that works like that. Hope this helps! :)
Log in to reply
@Michael Ng – Oh ! Yes! Damn! Well, thanks! Oh, how foolish am I?!
In the question we can assume the 7 notes as seven places and A,B,C,D as objects to fill the places ( Repetition allowed).As every each object has to be filled once we can select 4 places in 7c4 ways then arrange the notes in 4! Ways. And rest places can be filled in 4^3 ways. So total number of ways is. 7c4 * 4! 4^3=35 24*64=53760 .
Can you tell me where I am wrong @Michael Ng
Log in to reply
You have a good idea however you have counted melodies more than once. For example you can choose A-B-C-D first then add the rest with As say. But then you can also choose -AB-C-D and add As to get the same melody, so you have over-counted. Hope this helps! :)
Relevant wiki.- Principle of Inclusion and exclusion
Look at the last example in that wiki...
There are 4 7 − ( 1 4 ) ⋅ 3 7 + ( 2 4 ) ⋅ 2 7 − ( 3 4 ) 1 7 = 4 7 − 4 ⋅ 3 7 + 6 ⋅ 2 7 − 4 = 8 4 0 0 possible different melodies.
You can also use generating functions. The answer is the coefficient of x^7/7! in the expansion of (x+ x^2 / 2! + x^3 / 3! + x^4 / 4!)^4. Since each bird must sing at least one note, we start the series with x instead of 1. The factorials in the denominator of x^n / n! account for the permutations. No bird sings more than four notes, so the partial series terminates at x^4 / 4!. And since there are four birds, we need four partial series, or one for each bird. That's why we take the fourth power. Finally, since we want 7 notes for a melody, we expand the generating function and read off the coefficient of x^7 / 7!, which is 8400.
First select how the places are going to be partitioned into the four groups in { 4 7 } = 3 5 0 ways after this there are 4 ! ways to actually assign the groups to each note. The curly brackets denote a stirling coefficient of the second kind.
We need to arrange A, B, C, D, X1, X2, X3 where an X can take any of A, B, C, D
CASE 1:
X1, X2, X3 all are same (say X). So we get something like ABCD AAA to be permuted, which can be done in 4 ! 7 ! ∗ 4 ways = 6 5 0 4 0
[because we have 4 options for X]
CASE 2:
X1, X2, X3 all are different. So we get something like ABCD ABC .
ABCDABC can be permuted in 2 ! 2 ! 2 ! 7 ! ways.
Since we have 4 letters (A, B, C, D) to chose from for 3 letters (X1, X2, X3), it can be done in 4 C 3 ways.
So total no. of arrangements 2 ! 2 ! 2 ! 7 ! ∗ 4 ways = 2 5 0 4 0
CASE 3:
We have to select 2 alphabets now for 3 places (such as ABB, BCC, ADD, AAB, BBD, .....)
We get something like ABCD ABB to be permuted which can be done in 2 ! 3 ! 7 ! ways. But the selection above can be done in 4 C 2 ∗ 2 ways.
[Multiplied by 2 because ABB is different from AAB].
So total arrangements are 2 ! 3 ! 7 ! ∗ 1 2 = 5040
Total from all 3 cases above =
5 0 4 0 ( 6 1 + 2 1 + 1 ) = 8 4 0 0
Problem Loading...
Note Loading...
Set Loading...
First we decide how many of each note we want in each melody. There are ( 3 6 ) = 2 0 ways of doing this, that is; 1 2 ways with 3 , 2 , 1 , 1 and permutations, 4 ways with 4 , 1 , 1 , 1 and permutations, and 4 ways with 2 , 2 , 2 , 1 and permutations.
Now for each melody type we find the number of ways to order the notes. For the first type we have 3 ! × 2 ! 7 ! = 4 2 0 ways, for the second, 2 1 0 ways and for the third, 6 3 0 ways.
Therefore the total number of ways is 1 2 × 4 2 0 + 4 × 2 1 0 + 4 × 6 3 0 = 8 4 0 0 .