Here’s one of my favorite problems: How many ways are there to arrange 3 red marbles and 2 blue marbles into a circle?
Let’s start with something simpler: Arranging the same marbles into a sequence.
Imagine 5 empty boxes with numbers from 1 to 5 written on them. The ways of arranging the 3 red and 2 blue marbles into a sequence correspond one-to-one to the ways to put them (one each) into these boxes.
We’ll do that by first placing all the red ones and then the blue ones. For the first one, we have 5 possible boxes to put it into; For the second one, there are only 4 left and for the third one there are 3 choices. After that, the rest of the boxes has to be filled with blue marbles.
You might be inclined to say that the answer must thus be , but that’s not quite right because the red marbles are indistinguishable from each other. For example, placing the first red marble into box 1 and the second one into box 2 results in the same thing as placing the first one into box 2 and the second one into box 1.
But what if they were distinguishable? Say we write numbers onto the red marbles. The exact numbers don’t really matter (only that no two red marbles have the same number), but let’s just go with 1, 2, and 3. Simple and easy.
Now that we’ve numbered them, the number of ways to place these three marbles into 5 boxes is actually .
But consider such a placement with the numbered marbles already in the boxes. We could also have got there by placing our original, indistinguishable marbles into the boxes first and then writing the numbers onto them.
Let’s do that in order: For each possible placement of the indistinguishable marbles, there are 3 possible choices for the number 1, then 2 possible choices for the number 2, then the final number 3 has to be the remaining one.
Thus, the total number of ways to write the numbers 1, 2, 3 onto the three marbles is .
So, if we call the number of ways to place 3 indistinguishable marbles into 5 numbered boxes , we know that the number of ways to place 3 distinguishable marbles into the same boxes is .
But from before, we also know that this number must be equal to , so we can deduce thatLet’s clean this up a bit with some notation:
An expression like is called a falling power and written as . Other examples would be or .
In general, .
A special case of the falling power is the factorial . We encountered this for the number of ways to write numbers onto the red marbles, .
So, using this, we can writeThis number is also called a binomial coefficient, or “5 choose 3”. There are varying notations for it, but I’ll go withNote that nothing in this argument actually relied on any properties of the numbers 3 and 5, so, in general, the number of ways to put red and blue marbles into a sequence is
By the way, here’s the list of possible sequences: RRRBB, RRBRB, RRBBR, RBRRB, RBRBR, RBBRR, BRRRB, BRRBR, BRBRR, BBRRR.
We can be sure that that’s all of them by just confirming that there’re no duplicates and that there’s really 10 of them.
That was for a sequence of marbles, but what about a row of them?
You might say “that’s the same”, but the difference is that a row has reflection symmetry.
In particular, imagine a row of marbles lying on the ground. You can just look at them from the opposite side and thus swap what you see as the left and right end, but the row is still the same.
So, in general, there are up to two sequences corresponding to any given row. For example, the sequences RRBBR and RBBRR are the same row because they’re just mirror images of each other.
But it gets more complicated when you consider RBRBR. This row is a palindrome, meaning it is its own mirror image. The existence of rows like that means we can’t just divide by two to go from the number of sequences to the number of rows.
But we can split the sequences into palindromes and non-palindromes. Then, each palindrome counts as one row and each non-palindrome counts as half a row. So, being the number of palindromes and being the number of non-palindromes, we’d havewhere is the number of sequences.
So how many palindromes are there?
Since we have an even number of blue and an odd number of red marbles, the marble in the middle must be red.
The remaining four marbles are split into a left and right half and the right half must be the mirror image of the left half. So we are free to choose the left half, but that’s it. In other words, our freedom of choice corresponds to placing one blue and one red marble into a sequence:
So the total comes out toHere’s the list:
Palindromes: RBRBR, BRRRB
Non-palindromes: RRRBB/BBRRR, RRBRB/BRBRR, RRBBR/RBBRR, RBRRB/BRRBR
Generalizing this is somewhat easy, but depends on the parity of and .
I’ll use the Iverson Bracket to unify these three cases. Its definition is that if is true and if is false.
So the general formula for is
Thus, the general formula for the number of ways to place red marbles and blue marbles into a row is
The general study of symmetries as part of abstract algebra is called group theory.
I’ll introduce the parts of it we will need in a sort-of unconventional way.
To start with, consider the idea of a symmetry transformation. The most well-known symmetry transformations are reflections and rotations.
Something is symmetric if it stays the same after performing some symmetry transformation.
To get to a general definition of symmetry transformations, one can think long and hard about what reflections and rotations have in common, but I’ll cut it short here and just tell you that the deciding property is invertibility.
Reflections are their own inverses: Perform the same reflection twice and you always end up with what you started with.
Rotations always have an inverse. For example, rotating the minute hand of a clock 20° clockwise is undone by rotating it 20° counterclockwise.
You might be a bit confused since, if something is symmetric, you already end up with what you started with after performing one symmetry transformation, but the important thing is that the description of invertibility also holds for non-symmetric things.
For example, reversing the letters in a palindrome like “wow” results in the same word, but for a non-palindrome like “word”, you get “drow”, and only after performing the inverse transformation (in this case “reversing again”), you end up back where you started.
Now let’s think about formalizing this using the example of the minute hand on a special clock. The clock isn’t really useful for telling the time; It is basically a circular image with a singular hand on top of it.
The reason for this example over just a regular clock is that it gives us a reason to call rotating the hand a symmetry operation. Namely, if the image behind the hand has some rotational symmetry, for example if it’s the image of a playing card with 180° rotational symmetry, then rotating the hand by that amount is basically the same as rotating the entire clock by that amount, which means that the clock hasn’t really changed. 2
In math, basically everything we deal with is a set, so we need a set to perform symmetry operations on. In particular, the elements of will be the input/output states of the symmetry operations, so that we can model the operations themselves as functions .
In our example, the symmetry operations are rotations of the hand, so the input/output states of that can be taken to just be the position of the hand on the clock, which can be modeled as an angle measured in degrees, so a real number in the interval .
Then, as stated before, symmetry transformations need to be invertible, so we’re looking at the invertible functions (aka. “bijections”) from to .
The set of those bijections will be denoted here; It underlies what’s called the symmetric group of .
I won’t define the term “group” in general, since it’s more abstract than we need. Instead, we’ll be working with subgroups of , which are defined as a subset of such that
For any functions , the composition is also in .
For any function , the inverse is also in .
Note that a combination of the two requirements implies , so a subgroup of always contains the identity function.
These conditions basically mean that is a “self-contained” set of symmetry operations. For example:
Condition 1 means that, if I can rotate by 20° (), I should also be able to rotate by 40° ().
Condition 2 means that, if I can rotate by 20° clockwise (), I should also be able to rotate by 20° counterclockwise ().
Now we can recontextualize the previous section: We had a set of sequences of 3 red and 2 blue marbles and a subgroup of , where is the function that reverses a sequence. The conditions are easily confirmed:
For any , and . Additionally, .
and .
We’re close to the payoff of all that group theory.
First, we need another definition: Given a set and a subgroup of ,
In Section 2, the orbits corresponded to the rows of marbles: For a sequence of marbles, we had . For non-palindromes, this set has two elements; For palindromes, by definition.
In general, our problem becomes finding the number of orbits, i.e. .
This is solved by something called Burnside’s Lemma, which states that
For a small example, recall from Section 2. For this, the formula becomeswhere and is the set of palindromes. Setting and , we can see that this is exactly the formula we had arrived at:
The following is a proof of Burnside’s Lemma, adapted from Wikipedia. 3
Start with the right-hand side and notice thatwhere we have definedfor any .
Note that this partitions , which is proven as follows: Consider the setEither and , or and .
Next, for any , consider the precomposition map defined by . It is a bijection with inverse . This implies that, for any set ,
In particular, let , then we have proven that, for any ,Now note thatwhich impliesRecall that this holds for all .
Now we want to find the number of distinct sets . This is easily done by noticing that there is a bijection between and : Each uniquely defines and each uniquely defines .
Thus, the number of distinct sets is equal to the number of distinct values , i.e.
Since is partitioned into the , which all have the same size , and there are of them, it follows that the cardinality of satisfies
Now recall the sum from the start and apply this:Split the sum over along the orbits , noting that implies ,This immediately impliesQ.E.D.
Now we’re technically ready to answer the original question of arranging 3 red and 2 blue marbles into a circle, but let’s warm up with a slightly easier one: “How many ways are there to arrange 5 marbles, any of which may be red or blue, into a circle?”
Restating this question into more formal language, we’re asking about the number of orbits, , where is the set of 5-long sequences of red and blue marbles, and is one of two subgroups of :
The symmetry transformations that correspond to rotations of the circle. Since we encode the “circle” as a sequence, this means that these are functions that split the sequence into two contiguous subsequences and put those back together in the opposite order. For example, “ABCDE → CDEAB” or “ABCDE → EABCD”.
In the jargon, this is called the cyclic group of order 5.
All of the previous transformations, together with reflections across either an element or a gap between elements. The number of these reflections is also equal to 5. (And in general equal to the number of elements in the sequence).
In the jargon, this is called the dihedral group of order 10.
Call these and .
All of these symmetry transformations can be generated from two basic elements:
The simple rotation by one place: “ABCDE → BCDEA”, denoted .
Formally, it is defined as for and .
Alternatively, we can use the remainder operation: is the non-negative remainder from dividing by .4
Using that, we can see that for all . For this, zero-based indexing is more convenient; With sequence index , we get .
The simple reflection across a standard axis, again denoted .
For simplicity, this is the exact same operation as was used in Section 2.
Formally, it can be defined as . With zero-based indexing, this becomes .
In the first case, we can reach each of the possible transformations by applying some number of times: . Applying 5 times always leaves the input untouched (), so .
In the second case, we have the same thing with , and the reflections are all of the form , which should make intuitive sense: To reflect across some arbitrary axis, first rotate such that that axis moves to a standard position, then perform the standard reflection, then rotate back.
The first answer is thenWe still need to find , but since , and , we only need to find this for , , and .
For , this is easy: .
For , moves each element of the sequence by one: for and . Thus, decomposes into for and , which results in for all , so there are only two choices: RRRRR and BBBBB, i.e. .
For , moves each element of the sequence by two: . Concretely, we decompose this into , which again results in for all , so .
This implies that
The second answer is found similarly, by also considering for .
This is even easier because all of those reflections are just rotations of each other, so their fixpoint sets have to be rotations of each other and in particular have to be the same size. Thus, we only need to find .
This implies thatmeaning that the -orbits of are already reflection-symmetric.
We can now find a general formula that gives the number of ways to arrange marbles, each red or blue, into a circle.
First of all, some caution is highly necessary with the definition of . To rotate the axis of mirror symmetry by , you use the formula , but for even , this only reaches half of the possible symmetry axes: Since mirrors across an axis that doesn’t touch any marbles, all of its rotations by will also only mirror across such an axis.
In this case, we also need rotations of by , which are the missing reflections across axes that each go through two marbles. Strictly speaking, isn’t defined in , but we can save ourselves by noting thatfor all , so if we set , we get that these reflections are given byThis means that we should work with the definition for the set of reflections, which always works, including when is even.
Now let be the set of sequences of marbles, each red or blue. We now index these sequences starting at zero to keep the logic a bit simpler.
We first find for . Note that is defined asso the equation decomposes intofor all . Substitute and note that to further findwhich impliesWe can repeat this process indefinitely to arrive atfor all .
Since there are only finitely many indices, but is an infinite sequence in , there must be a first for which with some .
This equation of remainders can also be written as .
It must then be the case that , because otherwise we would have , which would contradict the assumption that was the first number with the desired property.
This means that there is an such that, for some ,Subtract on both sides and divide by to getWe want the smallest for which this equation holds; In other words, we need to be the smallest multiple of that is divisible by .
This is, by definition, the least common multiple of and , sowhere the second equality follows from .
With this, we have shown that each chain of equalities contains entries, and since they form a partition of the elements of the sequence, there are of them.
Each of these chains leaves one choice of red or blue, so we get
Now we find , but since we redefined , it’s better to not appeal to the previous argument here. (And it would also be wrong to do that, as we will shortly see.)
There are three cases to consider:
If is even, we have and thusNote that is a bijection, which immediately impliesand the same logic from before gives uswhere is the smallest integer greater than or equal to . This comes from the fact that we can freely choose the middle element for odd .
If is odd and is odd, we have that is even and , so this just reduces to the previous case for .
If is odd and is even, we have and thusNote that is a bijection, which immediately impliesThen note that is defined bywhich is equal to for and to for .
This means that decomposes into for all , which leaves and completely free and arranges the other elements into pairs.
Thus, there are places where we can choose either red or blue, so we get
We can summarize all these cases by saying that
For the answers, this gives usThere’s a special case to look out for: If , then , so the formula breaks down, but that’s fine, since the formula already respects all the wanted symmetries included in this case.
Thus, let the second formula require .5
The formula can be simplified a bit further:
We find by first noting that the set being measured is a subset of . Then note that is a given, so , so the second set is just , i.e. the set of multiples of below .
All of these take the form and the condition on can be read off fromThus, we find thatwhere is Euler’s totient function and the last equality is by its definition.
This gives us
More concretely, we havewhere the product is over primes dividing .
We thus use the prime factorization , where is some finite sequence of prime numbers and some finite sequence of positive integers.
Then, the sum over the divisors of splits into sums over the exponents of the :
As a nice example with applications to music theory, let’s take . In western music theory, it’s typical to work with 12-tone equal temperament, which is a tuning system with 12 notes per octave. Notes an octave apart are considered the same note, so we’re effectively working with a circle with 12 elements.
A scale can then be defined as any subset of these 12 notes. It corresponds to an arrangement of 12 marbles, each red or blue, into a circle: Just take a red marble for all notes that aren’t in the subset and a blue one for those that are.
Different scales related to each other by rotation of the circle are called modes of each other, and the reflection of a scale across a certain axis is called its inversion.
This means that counting the number of different scales, considering modes and/or inversions to be the same scale, can be done with our two formulae. Concretely, , so there arescales when considering different modes as the same scale.
Further, when also considering inversions as the same scale, the number drops to
Let’s directly start with the general form of the original question: How many ways are there to arrange red and blue marbles into a circle?
Again, we have , the set of sequences of red and blue marbles and and like before.
For the fixpoint set sizes, we can reuse some of the logic from the previous section:
For , we still have chains of equalities, each involving sequence elements. To be able to assign the marbles to these, both and need to be multiples of . This condition is actually equivalent to only being a multiple of (or alternatively to only being one), 6
If this is satisfied, we can assign red to of the chains and blue to the rest. This gives a factor of . If the condition isn’t satisfied, it’s impossible to satisfy the equality chains created from , so .
Thus, we get
For , the same logic about rotations applies, so we only need to look at and .
For even , we need to consider . There, like in the last section, we have two single slots and pairs to fill.
In total, we therefore get
These can be consolidated as follows:The sum of this over all is therefore
Thus, we get
Concretely, for the introductory example (), this givesConcretely, these orbits are {RRRBB, RRBBR, RBBRR, BBRRR, BRRRB} and {RRBRB, RBRBR, BRBRR, RBRRB, BRRBR}.
Finally, this problem also has an application in music theory, when considering a more conservative definition of a scale: Here, a scale is defined by an arrangement of 5 whole steps and 2 half steps into a circle. This lets us apply the formula with and , which givesConcretely, these orbits are
{WWWWWHH, WWWWHHW, WWWHHWW, WWHHWWW, WHHWWWW, HHWWWWW, HWWWWWH},
{WWWWHWH, WWWHWHW, WWHWHWW, WHWHWWW, HWHWWWW, WHWWWWH, HWWWWHW}, and
{WWWHWWH, WWHWWHW, WHWWHWW, HWWHWWW, WWHWWWH, WHWWWHW, HWWWHWW}.
The last of them corresponds to the well-known modes of the major/minor scale:
The second-to-last of them corresponds to the modes of the also somewhat well-known melodic minor scale, WHWWWWH. The mode HWHWWWW is also known as the superlocrian scale.
Alternatively, we can also use the formula to find the size of specific subsets of the set of scales (now using the previous 12-based definition again). For example, the numbers of 7-tone scales areThat’s already way more than the measly 3 we got above.
This has been a journey from a simple-sounding question to combinatorics, group theory, back to combinatorics with Burnside’s Lemma, and finally to the answer of that question.
There are lots of related questions I didn’t bring up here, such as considering more than two colors for the marbles, or asking about the size of more specific subsets, but if you followed along well, you’re probably equipped to answer those on your own now.
Most of all, I hope you had fun with this. I certainly did.