ExplorationsThe Thue-Morse sequence connects substitution with binary parity
A Pattern Built by Flipping Its Copy
Begin with 0 and make a copy in which every 0 becomes 1 and every 1 becomes 0, then append that changed copy. Repeating this gives 0, then 01, then 0110, then 01101001. This is the Thue-Morse sequenceDefinition: The Thue-Morse sequence starts at 0 and grows by repeatedly appending a copy with every bit flipped.: its infinite continuation repeats many smaller blocks but never settles into one endlessly repeated block.
Current view: Copy and flip
See the appended copy before and after each bit changes.
Begin with one zero
Round 0 is complete with 1 bit. The construction starts with one zero.
Positions start at zero. Read across each line before continuing on the next; wrapping does not change the sequence.
Complete construction transcript
Every completed row for the selected rule is recorded here, independent of playback.
- Round 0:
0 - Round 1:
01 - Round 2:
0110 - Round 3:
01101001 - Round 4:
0110100110010110
- 0
- an outlined tile containing zero
- 1
- a filled tile containing one
- new half
- a vermilion outline marks the appended copy during a step
Tiles are read left to right and then onto the next line. Outlined zeroes and filled ones carry printed values as well as colour. During a step, the new half is first copied unchanged, then complemented; only the complemented row is a completed Thue-Morse stage.
Round 0 is complete with 1 bit. The construction starts with one zero.
- Completed rounds
- 0
- Committed bits
- 1
- Zeroes / ones
- 1 / 0
Cases worth seeing
Try this
If a row contains five zeroes and three ones, how many of each would remain after appending its complement?
What is going on
Each explanation begins with a worked example and follows the same operation through intuition, formal statements and proofs. Later sections distinguish what is established from questions that remain open, so you can follow the level of detail useful to you.
- 00 followed by 101The copy of zero is flipped to one.
- 0101 followed by 100110Each bitDefinition: A bit is a binary digit, either 0 or 1. of the appended copy changes to its opposite.
- 01100110 followed by 100101101001The old row stays intact as its complement is appended.
- 0110100101101001 followed by 100101100110100110010110The completed row has eight zeroes and eight ones.
What you are seeing
The old half stays while the new half changes
Start with a tile marked zero. Make a second tile, change its zero to one, and place it after the first. You now have 01. Copy those two tiles, flip both copied values to obtain 10, and append that pair. The row is now 0110. Repeating the same construction gives the rows above.
Tiles wrap onto another line when the screen is narrow, but the string still reads left to right, then from the end of one line to the start of the next. The line breaks are a drawing choice, not another mathematical operation. Reset returns to the single starting zero.
Why it starts to make sense
A complement pairs every zero with a one
Every zero in the old half has a one at the corresponding position in the new half, and every one has a zero. Consequently each completed doubling contains exactly as many zeroes as ones. This statement concerns complete power-of-two rows. A shorter prefixDefinition: A prefix is an initial segment of a string or sequence, beginning at its first position. such as 011 need not be balanced.
Turning off the flip produces 0, then 00, then 0000, so the control is a different sequenceDefinition: A sequence is an ordered list of values, usually indexed by whole numbers.. Its simplicity helps isolate which operation creates the structure. The Thue-Morse claims on this page do not apply to that altered rule.
The key idea
A bitDefinition: A bit is a binary digit, either 0 or 1. can be determined without building the previous bits
Number the positions from zero. Write a position in binaryDefinition: Binary is a way to write numbers using only 0 and 1, with place values that double to the left., count its ones and keep the parityDefinition: Parity records whether an integer is even or odd. of that count: an even count gives zero and an odd count gives one. Position six is 110 in binary, with two ones, so the bitDefinition: A bit is a binary digit, either 0 or 1. there is zero. Position seven is 111, with three ones, so its bit is one.
The binaryDefinition: Binary is a way to write numbers using only 0 and 1, with place values that double to the left.-parityDefinition: Parity records whether an integer is even or odd. table compares this direct calculation with the copied construction. These are two descriptions of one sequenceDefinition: A sequence is an ordered list of values, usually indexed by whole numbers., rather than two unrelated patterns that happen to look alike. The proofDefinition: A proof is a finite argument showing that a conclusion follows from stated assumptions. below explains why their agreement continues beyond the displayed rows.
Formal statement
Finite construction rows define an infinite sequenceDefinition: A sequence is an ordered list of values, usually indexed by whole numbers.
Let and , where the bar exchanges zero and one in every position and juxtaposition means concatenationDefinition: Concatenation joins strings end to end without adding their numerical values.. Each row starts with the previous row, so every position eventually has a fixed value. Those values define the infinite sequenceDefinition: A sequence is an ordered list of values, usually indexed by whole numbers. .
If counts the ones in the binary expansionDefinition: A binary expansion expresses a number as a sum of powers of two. of , then
The recurrenceDefinition: A recurrence defines later terms from earlier terms together with initial conditions. is equivalent to the substitutionDefinition: Substitution replaces specified symbols or expressions according to a stated rule. and . The finite construction stops at 256 bitsDefinition: A bit is a binary digit, either 0 or 1. here for readability, not because the mathematical rule ends.
Proof
A new leading binary digitDefinition: A bit is a binary digit, either 0 or 1. explains the complemented half
The first row agrees with the parityDefinition: Parity records whether an integer is even or odd. rule at position zero. Suppose a row of length agrees at all its positions. Every new position is , with . Its binary expansionDefinition: A binary expansion expresses a number as a sum of powers of two. is that of , padded to places, with an additional leading one. Its digit-sum parity is therefore the opposite of the parity at . Appending the complement produces exactly those opposite bitsDefinition: A bit is a binary digit, either 0 or 1.. InductionDefinition: Mathematical induction proves a claim for all successive integers by proving a starting case and a step from each case to the next. proves the parity description at all positions.
Balance has a shorter argument: if the old row has zeroes and ones, its complement has zeroes and ones. Their concatenationDefinition: Concatenation joins strings end to end without adding their numerical values. has of each. Neither proofDefinition: A proof is a finite argument showing that a conclusion follows from stated assumptions. depends on how the tiles are coloured or how many fit on a screen.
Limits and further questions
Local repetition and global periodicity are different
The sequenceDefinition: A sequence is an ordered list of values, usually indexed by whole numbers. certainly repeats short pieces: 01 and 10 occur many times. A periodic sequenceDefinition: A periodic sequence repeats after a fixed positive number of positions, from its beginning onward. requires one fixed positive shift to work at every position, or at every sufficiently late position for eventual periodicityDefinition: A sequence is eventually periodic if, after some finite beginning, it repeats with a fixed positive period forever.. Testing a chosen shift can find a mismatch, but passing a finite test does not establish that the shift works forever.
For example, 0110 has only one comparison at shift three, and it agrees. In 01101001, positions two and five disagree, ruling out periodDefinition: For a sequence, a period is a positive shift that leaves every comparable entry unchanged. three from the beginning. The period view states both the tested range and any witness rather than calling a short agreement a repeating infinite sequenceDefinition: A sequence is an ordered list of values, usually indexed by whole numbers..
The infinite Thue-Morse sequenceDefinition: The Thue-Morse sequence starts at 0 and grows by repeatedly appending a copy with every bit flipped. is known to be overlap-freeDefinition: A string is overlap-free when it contains no consecutive block of the form aXaXa, where a is one symbol and X may be empty., a stronger theoremDefinition: A theorem is a mathematical statement established by a proof from accepted definitions and earlier results. stated in the linked Allouche-Shallit survey. It follows that it has no three consecutive identical non-empty blocks, whereas any eventually periodicDefinition: A sequence is eventually periodic if, after some finite beginning, it repeats with a fixed positive period forever. tail contains such a triple. That proves non-periodicity using a published theorem, not using this page's finite periodDefinition: For a sequence, a period is a positive shift that leaves every comparable entry unchanged. checks. The deeper result is cited rather than presented as something established by the animation.
What is actually established
Every statement on this page, with its status, its exact scope, and the date that status was last checked.
At position n, the Thue-Morse bit is the parity of the number of ones in n’s binary representation.
- Scope
- Every non-negative integer position, for the copy-and-complement rule starting at 0.
- Why
- Positions in the next half have the form 2^m + j. Their binary representation adds one leading 1 to j, so their parity is the complement of the earlier bit. Induction proves agreement at every constructed length.
- Status checked
Every completed construction row after the first doubling has equal numbers of zeroes and ones.
- Scope
- The power-of-two prefix after any positive number of copy-and-complement rounds. This does not say every arbitrary prefix is exactly balanced.
- Why
- A bit and its complemented copy contribute one zero and one one. Pairing the two halves proves the count without sampling.
- Status checked
The infinite Thue-Morse sequence is not eventually periodic.
- Scope
- The infinite complemented construction, not the finite displayed prefix or the unflipped control.
- Why
- The cited overlap-free theorem implies cube-freeness, whereas an eventually periodic tail contains three consecutive copies of its period block. The page proves the elementary parity and balance results, not the overlap-free theorem.
- Status checked
Sources
Review notes show which bibliographic details Mathomaly has checked and which remain unresolved. Checking a publication record does not independently verify its proof.
- Jean-Paul Allouche, Jeffrey Shallit, The ubiquitous Prouhet-Thue-Morse sequence. Link
Author-hosted survey. Section 2 gives the binary digit-sum definition; section 3 states the overlap-free theorem and the substitution rule. The elementary parity and balance arguments are supplied on this page.
Bibliographic record checked. This is not an independent verification of the proof.
Bibliographic review:
AI-assisted bibliographic audit. Evidence type: source text.
Author-hosted survey confirms title, authors and the sequence definitions.
Related by mechanism
Connected by how they work, not by sharing a topic label.