Let's suppose we have 9 cloth strips each of a distinct color and we need to sew them in a combination of 3 to form a new flag. The strips can be sewn one over the other and we need to find the total number of combinations possible for such a case wherein all the colors of the strips sewn must be different.

Few other conditions:

The order of the top and bottom flags does not matter. The 9 strips needn't necessarily be used. For any of the color bands of the flag it's color is represented by the strip sewn on top. For any color band the number of cloth strips sewn must lie between 1 and 6(both included).

The upper limit of the sum of cloth strips sewn must be 9 and lower limit is 3.

I've tried the problem for a long time, but I'm stuck as any way that I think of sums out to be too long of a solution. Would highly appreciate it if anyone could pour their valuable insight or suggest any lead towards this problem.

  • $\begingroup$ Do you mean eg a flag could have red top, green middle, and blue bottom, which would differ from green top, blue middle, red bottom? Also do you allow all three parts to be the same, or two of the three same, or do all three parts have to be different? $\endgroup$
    – coffeemath
    Oct 30, 2023 at 16:45
  • $\begingroup$ To be clear... can you tell the top of the flag apart from the bottom of the flag? Or is a white red blue flag considered "the same" as a blue red white flag noting that you could just hang the flag upsidedown to get the other? Can you repeat colors? $\endgroup$
    – JMoravitz
    Oct 30, 2023 at 16:46
  • $\begingroup$ The punchline will typically be that you choose the "first" color, choose the middle color, and then choose the last color. Apply rule of product by multiplying the number of options for each step. If you need to, then adjust the count as per "not" burnside's lemma... but I am expecting that you don't need to adjust anything based on the way you asked the question. $\endgroup$
    – JMoravitz
    Oct 30, 2023 at 16:48
  • $\begingroup$ oh I'm sorry i'll be more precise... all the colors of the flag have to be distinct but a white red blue flag is the same as a blue red white flag. $\endgroup$ Oct 30, 2023 at 16:48
  • $\begingroup$ Then all the adjustment that needs to happen is to divide by two. Count how many there are if you can tell the difference between top and bottom and then divide by two at the end to fix the count. $\endgroup$
    – JMoravitz
    Oct 30, 2023 at 16:49

3 Answers 3


To find no. of possible flags that can be formed, firstly out of 9 distinct colors, we will select 3 that are going to be there in our flag, to do so, you can do it in ${9 \choose 3}$ ways.

Then these 3 colors can be arranged in 3! ways. But since (white red blue) is same as (blue red white), we divide by 2.

Let the 3 colors be A, B, C. Then 3!(6) arrangements are: ABC, CBA, BCA, ACB, CAB, BAC

So, final answer to your question would be (${9 \choose 3} × 3! ){1\over2}=252$

  • $\begingroup$ For some basic information about writing mathematics at this site see, e.g., here, here, here and here. $\endgroup$
    – cpiegore
    Oct 30, 2023 at 17:50
  • $\begingroup$ It is worth also mentioning how $\binom{9}{3}3! = 9\times 8\times 7$ is the falling factorial, sometimes notated $P(9,3)$ or $9^{\underline{3}}$ or just written $\frac{9!}{(9-3)!}$ making the final answer $9\times 8\times 7\times \frac{1}{2}$, same as yours $\endgroup$
    – JMoravitz
    Oct 30, 2023 at 18:06
  • $\begingroup$ Isn't this the same approach for when we have 9 cloth strips and want to sew them into a flag? But my question here was when two cloth strips can be sewn on top of each other. $\endgroup$ Oct 31, 2023 at 3:38
  • $\begingroup$ I don't get what do you mean by 'sewing on top of each other', do you mean the colors can overlap, if yes, then can any number of colors overlap?...should all 9 colors necessarily be used? Please state the context clearly. $\endgroup$
    – Maths
    Oct 31, 2023 at 12:51
  • $\begingroup$ my bad, the colors can overlap and yes any number of colors can but all 9 are not necessarily to be used. $\endgroup$ Oct 31, 2023 at 15:03

Besides @Maths’ approach, another is to begin by picking the outer pair of colors. This can be done in ${9\choose 2} = 36$ ways. And for each of them there are 7 colors remaining for the inner color. So the answer is $36 \cdot 7 = 252$.

  • $\begingroup$ I am a little confused, how does this account for the possibility when we are sewing 2 flags on top of each other? For eg let's say I want a green white red flag, I can directly get that (without any cloth strip overlapping ) or another possibility is I take 3 colored strips green white and yellow and sew red over the third one. I am sorry if I am missing something in your answer! $\endgroup$ Oct 31, 2023 at 3:23
  • $\begingroup$ What does “sewing two flags on top of each other” mean? You mean some of the stripes are more than one layer thick? So the resulting flag’s obverse and reverse are different? How many actual individual strips of fabric can go into one of your flags? Three? Six? Something in between? I’d suggest you clarify your post. $\endgroup$ Oct 31, 2023 at 4:12
  • $\begingroup$ Your question reads “a combination of three.” $\endgroup$ Oct 31, 2023 at 4:18
  • $\begingroup$ I am sorry if i wasn't clear enoguh, by combination of three I meant the three that should be displayed on the top. The obverse and reverse are the same. The actual individual fabrics that can be sewn on top of each other must be between 1 to 6 (both included). However the total strips that we have still remain 9. $\endgroup$ Oct 31, 2023 at 15:04

Solution final answer

So, let us consider the 252 possible flags we obtained by using only 3 colored strips, now we will add layers to them. Firstly, the no. of individual strips we chose can be {3,4...9}. In the solution image, I have given the no. of permutations possible for each separate case, then we can take union of these separate cases.

Kindly note:

  • The 252 possible flags will form the side facing us, so we are adding layers behind 1 or 2 or 3 of the three colors.
  • Concentric circles denote thickness of a layer(no. of circles denotes no. of individual strips)
  • The 1st row {3,4,5..9} indicates what happens if totally we chose those many strips for our flag.
  • Places where arrowheads split denote 'or' scenario. For eg. If we chose to have 5 strips, then apart from the 3 already selected, we need to select 2 more from the remaining 6. Now these 2 can be separately sewed or they both can form a layer and be sewed below any two of the three strips.
  • I have considered the intra-permutations between strips in the layers. So imagine, a pile of blue-white-red will be a different layer than a pile of white-red-blue.
  • The only case I have ignored is two flags being identical if the top and bottom layers have equal no. Of strips with identical color arrangement.. I have not accounted for such identical cases.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .