2

The letters in the word GUMTREE and KOALA are rearranged to form a 12-letter word where KOALA appears precisely in order but not necessarily together. How many ways can this happen?

So I attmepted it via this method:

Firstly arrange like this since KOALA must be in order but not necessarily together: (let the fullstops (.) be spots for the letters in GUMTREE. There are $7$ letters in GUMTREE and $6$ full stops so $6^7$.

.K.O.A.L.A.

Butthere are two E's so $\frac{6^7}{2!}$. The letters in KOALA are fixed so they have $1$ way each, except for A (there are two so the first A has two choices and the second A has one choice)

Therefore, $$2\cdot\frac{6^7}{2!}=279936$$

But the answer is 1995840 arrangements

I belive my method is very close but I am forgetting to multiply by something. Can someone point out my logical flaw? Otherwise the worked solutions propose $\frac{12!}{5!2!}$, but I don't get why you divide by 5! for the KOALA, since they are not identical letters... regardless it would be great to understand both ways!

Thanks

ryang
  • 38,879
  • 14
  • 81
  • 179
user71207
  • 1,543

6 Answers6

3

You are assuming that the letters for the two words are interleaved, when they do not need to be. For example, "KOALAGUMTREE" is a permissible arrangement, as is "GUMTREEKOALA" or "GUMKOALATREE." The problem only stipulates that the letters in "KOALA" appear in sequence.

So, count the number of ways to order the letters in "GUMTREE." There are $7$ letters, two of which are identical; therefore, there are $7!/2!$ such arrangements of the letters. For "KOALA," there is only one permissible arrangement. So now all that is left is to figure out how many combined arrangements exist; to do this, note there are a total of $7 + 5 = 12$ letters in total, hence there are $\binom{12}{5}$ ways to select the positions of the letters in "KOALA" among the $12$ total letters.

Hence the correct number of arrangements is $$\frac{7!}{2} \binom{12}{5} = 1995840,$$ as claimed.

heropup
  • 135,869
  • AHhh yes that way makes sense as well. However, I believe I do NOT assume that the words must be interleaved - for my way the letters in GUMTREE have 6 ways each WITH repetition (hence the $6^7) so there could be a possibility where all GUMTREE letters end up on the very left dot or very right dot. Help me understand? – user71207 Jan 02 '21 at 04:55
  • 1
    @user71207 If all GUMTREE letters end up on the very left dot, that's not one arrangement, that's $7!/2$ arrangements, because the GUMTREE letters can come in different orders. – bof Jan 02 '21 at 05:00
  • 1
    @user71207 So, how does your counting scheme distinguish between the cases I mentioned at the beginning of my answer? Counting with repetition does not work here because there are more than six positions for the $7$ letters in "GUMTREE," since the final arrangement has twelve letters and therefore twelve possible choices for each of the letters in "GUMTREE." – heropup Jan 02 '21 at 05:00
  • 1
    A slightly different way of counting: there are $\frac{5!}{2!}$ ways to arrange the KOALA letters, $\frac{12!}{2!2!}$ ways to arrange all $12$ letters. If the $12$ letters are arranged randomly, the probability of the KOALA letters being in the right order is $\frac{2!}{5!}$, so the final answer is $\frac{2!}{5!}\cdot\frac{12!}{2!2!}$. – bof Jan 02 '21 at 05:06
  • Hi @bof I like that probability approach. But why is the probability $\frac{2}{5!}$? Why can you just take the reciprocal like that? – user71207 Jan 02 '21 at 11:30
  • @bof nevermind sorry I realise it is just $\frac{1}{\frac{5!}{2}} = \frac{2}{5!}$ – user71207 Jan 02 '21 at 12:24
3

Probably simplest to frame the problem as arranging 12 letters, in which 2 are identical of one kind (EE in GUMTREE), and 5 are identical of another kind (XXXXX substituting for KOALA, which is treated as a black box since its letters have already been pre-arranged). So, $$\frac{12!}{2!5!},$$ as suggested.

ryang
  • 38,879
  • 14
  • 81
  • 179
  • Yes but I dont understand the logic behind why KOALA is "identical" and can be substituted for XXXXX – user71207 Jan 02 '21 at 06:00
  • 2
    @user71207 Does the problem change if KOALA was instead KOBLA (all 5 letters distinct)? How about if it was KKKKK (all 5 letters identical)?

    Requiring KOALA to appear in the specified / pre-determined order is equivalent to pre-arranging this 5-character sequence; i.e., KOALA has been pre-arranged in exactly one way, so it might as well be KKKKK ; the fact that 'A' repeats is just a red herring!

    – ryang Jan 02 '21 at 07:11
  • Thank you for getting back. Ok it's starting to make sense, but isn't there only ONE rearrangement? As you project, the problem would not change if the letters were all distinct or the same. Buts there's only ONE way to arrange KOALA! "It might as well be KKKKK": Yes, and KKKKK has only one arrangement as well. Why is it 5! ? I just don't understand. Perhaps could you try explaining what we are doing by dividing by 5! ? – user71207 Jan 02 '21 at 11:23
  • If there is only one way to prearrange, why is it considered to be KKKKK? I don't understand that either. – user71207 Jan 02 '21 at 11:34
  • 1
    @user71207 No worries. The numerator in $\displaystyle\frac{12!}{2!5!}$ corresponds to the number of ways to arrange 12 distinct characters, while the denominator compensates for how this has overcounted the ways that EE and KKKKK can be arranged. (Incidentally, $(\displaystyle\frac{(n_1+n_2+\ldots+n_m)!}{n_1!n_2!\ldots n_m!}$ is called a multinomial coefficient, which is a generalisation of the binomial coefficient.) – ryang Jan 03 '21 at 04:41
3

This might appeal to you as a simple way

First arrange $-K-O-A-L-A-$ with gaps between letters.

All we need to do is to count how many ways GUMTREE can be interleaved.

$G$ can be inserted in $6$ ways, but then $U$ can now be inserted in $7$ ways,$M$ can be inserted in $8$ ways, and so on, and finally divide by $2!$ for the repeated $E$

Thus, $\dfrac{6\cdot 7\cdot 8\cdot 9\cdot {10}\cdot{11}\cdot{12}}{2!} = 1995840$

  • OHHHH THIS WAS WHAT I WAS MISSING. Yes thank you so much, this was what I was aiming for. I didn't not account for the NEW AVAILABLE spots after initial 6 ways, Hence it should've been 6,7,8,9,10,11 then 12! Thank you! – user71207 Jan 02 '21 at 06:04
  • Glad you liked this approach. You're welcome ! – true blue anil Jan 02 '21 at 06:26
2

Here is the problem with your method of counting -

You are giving each letter of GUMTREE a choice of being in any of the $6$ places. So far so good.

But $6^7$ does not include permutations of "GUMTREE". For example, in the arrangements of all letters of GUMTREE being in the last place as KOALA {GUMTREE}, where are you considering permutations of GUMTREE?

So you may say we can multiply by $\frac{7!}{2!}$ but that brings in a different problem then. You overcount and to use P.I.E or to find multiplication factor for each type of arrangement separately is going to be a lot more work. Why does it overcount? Take an example,

K (G) O (UM) A (TR) L (EE) A

Now if you multiply as we mentioned above, it will also count cases,

K (U) O (GM) A (TR) L (EE) A but those have already been counted in $6^7$.

So it is easier to consider KOALA as letters that are same in total $12$ letters so we have $2$ $E$ and $5$ $X$ giving an answer of $\frac{12!}{5! \, 2!}$.

Math Lover
  • 51,819
  • Thanks, I see my flaw – user71207 Jan 02 '21 at 06:02
  • Wait why do we consider KOALA letters to be the same? If they are predetermined in exactly ONE way, why do still divide by $5!$ ? – user71207 Jan 02 '21 at 12:27
  • 1
    @user71207 that is because the way you are treating them is just like you treat the same letter appearing $5$ times. For example, if you have $X X X X X$, you can arrange them just in one way. So if I have X X X X X G U M T R E E, I have $12$ letters but while I can place $X$ in different places I cannot permute them within. $\frac {12!}{5!}$ is the same as saying I fix KOALA and now start putting letters of GUMTREE one by one. So the first one gets $6$ choices, next gets $7$ and so on... – Math Lover Jan 02 '21 at 12:34
  • Thanks for getting back. It seems I am having immense trouble internalizing this method. So. You can indeed place the X in X X X X X G U M T R E E in different places, but in this, how do you ensure they are in the correct order? – user71207 Jan 02 '21 at 12:39
  • KOALA also has one order (stipulated by the case). Why do you divide by $5!$ :(( Yes perhaps a smaller example will give me intuition – user71207 Jan 02 '21 at 12:43
  • OK before the example, given you asked :), if it was not KOALA and just arrangements of XXXXXGUMTREE, would you have divided by $5!$ just like you divide by $2$ to find all arrangements? Same thing for KOALA. – Math Lover Jan 02 '21 at 12:45
  • Take a simple example with just $3$ letters. Say you have KO which is fixed in order and you have G (not the GUMTREE). We have following arrangements - GKO, KGO, KOG which is $3! / 2!$. Now instead if you have XXG, again what arrangements do we have? G X X, X G X, X X G - again $3!/2!$. – Math Lover Jan 02 '21 at 12:49
  • Yes I would divide by 5! for XXXXX. I don't see why you would do the same for KOALA given then are not the same. People keep saying "consider them the same, treat them the same" but I don't know why!! – user71207 Jan 02 '21 at 12:49
  • Perhaps I should accept it as a rule: when letters are fixed in order, treat them as repeating letters? – user71207 Jan 02 '21 at 12:51
  • Well why can't XX not represent OK instead of KO?? – user71207 Jan 02 '21 at 12:52
  • 1
    Now take the first example again - KO and G. Let's not fix the order. What happens then? We have GKO, KGO, KOG and GOK, OGK, OKG . That is $3!$. Now we divide by $2!$ as we are only interested in one of the orders. – Math Lover Jan 02 '21 at 12:52
  • Well why can't XX not represent OK instead of KO?? – user71207 Jan 02 '21 at 12:52
  • 1
    It can but if you fix it as KO, again the number of arrangements will be same as when you fixed them as OK. The point is that it cannot represent both KO and OK as you cannot permute XX within. – Math Lover Jan 02 '21 at 12:56
  • "The point is that it cannot represent both KO and OK as you cannot permute XX within" Excellent. This I understand. Thanks a bunch, @Math Lover. I bet others think its obvious; I don't know why my stupid brain cant comprehend this – user71207 Jan 02 '21 at 12:58
  • 1
    Listen whether one accepts it or not, most of us have gone through such confusion at some point. It may of course sound trivial later one but when you are going through the phase, it is not. So I prefer this level of curiosity to understand and get it right than just accept answers as is. – Math Lover Jan 02 '21 at 13:03
2

As you said, we have to fill $6$ gaps in $\text{_K_O_A_L_A_}$ with $7$ letters, so if $a$ letters go in the first gap, $b$ letters go in the second gap and so on and $f$ letters go in the sixth gap, we have the equation $a+b+c+d+e+f=7$ whose solution by stars and bars is given by $\displaystyle \binom{7+6-1}{6-1}=\binom{12}{5}$. The number of ways of arranging those $7$ letters as shown by other answers is $\dfrac{7!}{2!}$. Hence, the number of total combinations is $\displaystyle \dfrac{7!}{2!}\binom{12}{5}$.

V.G
  • 4,196
  • Interesting. I know of the stars and bars method but I never seem to know when to use it. How do you get the solution to$ +++++=7$??? There's nothing about that on the wikipedia – user71207 Jan 02 '21 at 11:38
  • Nevermind, the brilliant wiki gave me the intuition :) – user71207 Jan 02 '21 at 11:43
  • @user71207, Good to know that you understood it. But, If you want to look at another application of stars and bars method, I wrote an answer to a question here – V.G Jan 02 '21 at 14:48
1

As I understand it, you are doing $7$ trials, one for each letter of GUMTREE. In the first trial, you decide which of the six slots, indicated by full stops, to use for G, in the second you decide which to use for U, and so on.

Here's the problem with that approach: let's say all seven letters of GUMTREE get put in the first slot. You still haven't said how the letters in that slot are to be ordered. There are $7!/2!$ orders, so you might think to multiply by that factor. But let's say that G got put in the first slot, U in the second, and so on up to R in the fifth slot, with both Es put in the sixth slot. Now there is no rearrangement possible, so the appropriate multiplicative factor is $1$, not $7!/2$.

Because of this issue I don't see any simple fix for your approach.

Will Orrick
  • 18,220