Day 4: Four Calling Birds

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.


The answer is 8400.

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.

5 solutions

Michael Ng
Dec 3, 2014

First we decide how many of each note we want in each melody. There are ( 6 3 ) = 20 \binom{6}{3} = 20 ways of doing this, that is; 12 12 ways with 3 , 2 , 1 , 1 3, 2, 1, 1 and permutations, 4 4 ways with 4 , 1 , 1 , 1 4, 1, 1, 1 and permutations, and 4 4 ways with 2 , 2 , 2 , 1 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 7 ! 3 ! × 2 ! = 420 \frac{7!}{3! \times 2!} = 420 ways, for the second, 210 210 ways and for the third, 630 630 ways.

Therefore the total number of ways is 12 × 420 + 4 × 210 + 4 × 630 = 8400 12 \times 420 + 4 \times 210 + 4 \times 630 = \boxed{8400} .

Another approach which avoids checking cases, and thus easily generalizes, is to use Principle of Inclusion and Exclusion .

4 7 ( 4 1 ) 3 7 + ( 4 2 ) 2 7 ( 4 3 ) 1 7 + ( 4 4 ) 0 7 = 8400 4 ^7 - { 4 \choose 1} 3^7 + { 4 \choose 2 } 2^7 - { 4 \choose 3} 1^7 + { 4 \choose 4} 0^ 7 = 8400

Do you see why?

Calvin Lin Staff - 6 years, 6 months ago

Log in to reply

Let M M represent the set all possible melodies without any restriction. Additionally, let M A M_{A} represent the set of all melodies that don't contain the note A A , M B M_{B} represent the set of all melodies that don't contain the note B B , and in a similar way we define M C M_{C} and M D 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 ) M - ( M_{A} \cup M_{B}\cup M_{C}\cup 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 = \left| M \right| - \left| M_{A} \cup M_{B} \cup M_{C} \cup M_{D}\right| = M M A M B M C M D + M A M B + . . . . \left| M\right| - \left|M_{A}\right|-\left|M_{B}\right|-\left|M_{C}\right|-\left| M_{D}\right| + \left| M_{A}\cap M_{B}\right| +.... Using the facts that M = 4 7 \left|M\right|=4^{7} , M A = M B = M C = M D = 3 7 \left|M_{A}\right| =\left|M_{B}\right|=\left|M_{C}\right|=\left|M_{D}\right|=3^{7} , M A M B = M A M C = . . . = 2 7 \left|M_{A}\cap M_{B}\right| =\left| M_{A}\cap M_{C}\right|=...=2^{7} , M A M B M C = M A M B M D = . . . = 1 7 = 1 \left| M_{A}\cap M_{B} \cap M_{C}\right| = \left|M_{A}\cap M_{B}\cap M_{D}\right| =...=1^{7}=1 and M A M B M C M D = 0 7 = 0 \left|M_{A}\cap M_{B} \cap M_{C}\cap M_{D}\right|=0^{7}=0 we obtain that the answer is going to be 4 7 ( 4 1 ) 3 7 + ( 4 2 ) 2 7 ( 4 3 ) 1 7 + ( 4 4 ) 0 7 = 8400 4^{7}- {4\choose 1} 3^{7} +{4\choose 2 } 2^{7}-{4\choose 3} 1^7 +{4\choose 4} 0^{7} =8400

Arturo Presa - 6 years, 3 months ago

I tried that, but unfortunately I didn't notice that the coefficient of ( 1 ) n n 7 (-1)^{n}n^{7} was the binomial coefficient rather than n + 1 n+1 .

Jake Lai - 6 years, 6 months ago

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.

Michael Ng - 6 years, 6 months ago

Log in to reply

Right. The 'formal' explanation would be to use PIE. Consider the following sets:
W W is the set of melody with 7 notes that do not contain A,
X X is the set of melody with 7 notes that do not contain B,
Y Y is the set of melody with 7 notes that do not contain C,
Z Z is the set of melody with 7 notes that do not contain D.


Then, we want to find W X Y Z | \overline{W} \cap \overline{X} \cap \overline{Y} \cap \overline{Z} | . Applying PIE, it is equal to

S W = S W + W X W X Y + W X Y Z |S - \cup |W| | \\ = |S| - \sum |W| + \sum |W \cap X | - \sum |W \cap X \cap Y| + \sum |W \cap X \cap Y \cap Z |

Calvin Lin Staff - 6 years, 6 months ago

That's precisely the best approach, I can think of!

Priyatam Roy - 6 years, 6 months ago

Why is this wrong ?

( 4 1 ) . ( 7 4 ) . 3 ! + ( 4 2 ) . ( 7 3 ) . ( 4 2 ) . 2 ! + ( 4 3 ) . ( 7 2 ) . ( 5 2 ) . ( 3 2 ) \left( \begin{matrix} 4 \\ 1 \end{matrix} \right). \left( \begin{matrix} 7 \\ 4 \end{matrix} \right) .3! + \left( \begin{matrix} 4 \\ 2 \end{matrix} \right).\left( \begin{matrix} 7 \\ 3 \end{matrix} \right).\left( \begin{matrix} 4 \\ 2 \end{matrix} \right).2! + \left( \begin{matrix} 4 \\ 3 \end{matrix} \right).\left( \begin{matrix} 7 \\ 2 \end{matrix} \right).\left( \begin{matrix} 5 \\ 2 \end{matrix} \right).\left( \begin{matrix} 3 \\ 2 \end{matrix} \right) .1!

You can see how I did it .

Kartik Sharma - 6 years, 6 months ago

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

Kartik Sharma - 6 years, 6 months ago

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 ( 4 2 ) \ \binom {4}{2} possibilities because for each AAB there is an ABB which we have not counted. You will find that multiplying the middle term by 2 2 gives you the correct answer.

The method works for 6 6 because then we do not have a case that works like that. Hope this helps! :)

Michael Ng - 6 years, 6 months ago

Log in to reply

@Michael Ng Oh ! Yes! Damn! Well, thanks! Oh, how foolish am I?!

Kartik Sharma - 6 years, 6 months ago

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

A Former Brilliant Member - 6 years, 2 months ago

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! :)

Michael Ng - 6 years, 2 months ago

Relevant wiki.- Principle of Inclusion and exclusion

Look at the last example in that wiki...

There are 4 7 ( 4 1 ) 3 7 + ( 4 2 ) 2 7 ( 4 3 ) 1 7 = 4 7 4 3 7 + 6 2 7 4 = 8400 4^7 - {4 \choose 1}\cdot 3^7 + {4 \choose 2}\cdot 2^7 - {4 \choose 3} 1^7 = 4^7 - 4\cdot 3^7 + 6\cdot 2^7 - 4 = 8400 possible different melodies.

Igmut Schnoll
Nov 27, 2015

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.

Jorge Fernández
Aug 27, 2015

First select how the places are going to be partitioned into the four groups in { 7 4 } = 350 {7 \brace 4}=350 ways after this there are 4 ! 4! ways to actually assign the groups to each note. The curly brackets denote a stirling coefficient of the second kind.

Rohit Sachdeva
Jun 12, 2016

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 7 ! 4 ! 4 \frac{7!}{4!}*4 ways = 5040 6 \frac{5040}{6}

[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 7 ! 2 ! 2 ! 2 ! \frac{7!}{2! 2! 2!} 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 ^4C_{3} ways.

So total no. of arrangements 7 ! 2 ! 2 ! 2 ! 4 \frac{7!}{2!2!2!}*4 ways = 5040 2 \frac{5040}{2}

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 7 ! 2 ! 3 ! \frac{7!}{2!3!} ways. But the selection above can be done in 4 C 2 2 ^4C_{2} * 2 ways.

[Multiplied by 2 because ABB is different from AAB].

So total arrangements are 7 ! 2 ! 3 ! 12 \frac{7!}{2!3!}* 12 = 5040

Total from all 3 cases above =

5040 ( 1 6 + 1 2 + 1 ) = 8400 5040(\frac{1}{6}+\frac{1}{2}+1) = 8400

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...