XSCREENSAVER / 3D PIPES

[readonly] markdown buffer

Reed–Solomon Erasure Coding Without the Magic

Jul 29, 2026 · 38 min read

Suppose I split some data across six drives. Any three drives may disappear. I still want every byte back.

Our small Reed–Solomon encoder will take three original numbers and calculate six new stored numbers. Each stored number keeps a label describing how it was calculated. Any three correctly labelled survivors contain enough information to reconstruct the three originals.

We will build a small version from beginning to end. At every step we will ask four questions: what information do we have, what problem blocks us, why does this particular operation solve it, and what does its result enable next?

The assumed maths stops at UK GCSE level: substitution, brackets, multiplication, squares and simple equations. No A-level maths is assumed. Anything beyond that is built here, one small operation at a time, before its formal name appears.

1. Choose the answer we want back

Before building protection, we need an exact success condition. Enter text or a number; the default is 42. Every later visual follows the same value.

traceview://reed-solomon/sourceinteractive
Step 1

Choose the exact value we must recover

character 14character 22
Where we are

No encoding has happened yet. We need an exact result against which the final output can be checked.

Question this step answers

What precise value must survive the complete round trip?

What we did

The value to protect is “42”. It contains 2 characters.

Why this solves the problem

Recording the target first gives recovery a success condition. Producing merely plausible text at the end is not enough; every character must match this value.

What this enables next

Convert each character into the numbers a computer actually stores.

Choose a value. This exact text must survive the complete journey.

Why do this first? Without recording the original value, seeing some text at the end would not prove that recovery worked. Nothing has been encoded yet; we have only fixed the answer every later operation must preserve exactly.

2. Encode the characters as bytes

We currently have characters, but the mixing rule can only add and multiply numbers. We therefore need a reversible bridge from text to numbers. UTF-8 is that bridge: it turns each character into one or more bytes, where a byte is a number from 0 to 255.

For the default input:

  • 4 becomes byte 52;
  • 2 becomes byte 50;
  • the complete byte sequence is [52, 50].
traceview://reed-solomon/bytesinteractive
Step 2

Encode each character as UTF-8 bytes

Following input42
452
250
UTF-8 bytes = [52, 50]
Where we are

The input is text, but the mixer we are about to build can only add and multiply numbers.

Question this step answers

How can we turn characters into numbers without losing the ability to recover the exact characters?

What we did

“42” is now the number list [52, 50].

Why this solves the problem

UTF-8 is an agreed reversible mapping rather than an invented numbering scheme. If recovery returns this complete byte sequence, the same mapping backwards returns the exact input.

What this enables next

Record how many bytes belong to the input before adding any padding.

Show every character and every UTF-8 byte it produces.

Why UTF-8 rather than inventing our own numbering? The mapping must be reversible and must support more than the English alphabet. UTF-8 already defines exactly which byte sequence represents each character. If recovery returns the same bytes [52, 50], running that agreed mapping backwards returns 42.

This is not Reed–Solomon yet. It prepares the kind of input the maths accepts without changing the information we need to protect.

Some characters use more than one byte. That does not change the later maths; the encoder protects the resulting byte sequence three numbers at a time.

3. Record where the real bytes end

We now have the real byte sequence [52, 50]. The next step requires groups of exactly three, so we will add a zero to make [52, 50, 0]. That creates a future ambiguity: zero may be padding, but zero is also a valid piece of real data.

traceview://reed-solomon/lengthinteractive
Step 3

Record where the real bytes end

UTF-8 bytes belonging to the input[52, 50]

Original byte length: 2

Empty block positions to fill1 zero

These zeros are packaging. They are not part of the input.

Where we are

The final three-number block may need zero padding, but zero is also allowed to be real data.

Question this step answers

How will recovery later distinguish padding from genuine zero bytes?

What we did

The decoder must keep the first 2 recovered bytes and discard any later padding.

Why this solves the problem

We record the boundary while it is still known. After padding, a real zero and a padding zero are identical, so the decoder could not infer this information later.

What this enables next

Use zeros to fill the final three-number block without changing the recorded length.

Record the real byte count before calculating how many zeroes will be padding.

Why record the length now? Before padding, we still know which bytes came from the user. After encoding and recovery, the padding zero looks exactly like a real zero. Saving length = 2 now gives the decoder an external boundary it cannot infer later.

For 42, the block will contain [52, 50, 0], but the saved length says only the first two positions belong to the input. Recovery can therefore keep exactly two bytes instead of guessing which zeros to remove.

4. Divide the bytes into blocks of three

The byte sequence could be any length, but one small set of equations can only solve a fixed number of unknown values. We therefore process the input in separate, fixed-size blocks. This article chooses a 3-of-6 code:

  • each working block contains 3 original numbers;
  • the encoder calculates 6 labelled clues about that block;
  • any 3 correctly labelled clues can recover the 3 originals;
  • therefore any 3 of the 6 clues may disappear.
traceview://reed-solomon/blocksinteractive
Step 4

Put the bytes into three-number blocks

byte 152byte 250
block 1[52, 50, 0]
one working block3 original numbers

These are the three values the decoder must eventually recover.

one encoded block6 labelled clues

Each clue will be a different mixture of those same three values.

the recovery promiseany 3 of the 6

Three clues may disappear because three correct survivors remain.

Where we are

The byte sequence may be any length, while one recovery calculation needs a fixed number of unknown positions.

Question this step answers

How do we turn an arbitrary-length input into small recovery problems with a known size?

What we did

The first working block is [52, 50, 0].

Why this solves the problem

Three-number blocks create three unknowns that the same three-equation recovery can solve independently. This teaching size keeps the algebra visible; padding only completes the final block and the saved length removes it later.

What this enables next

First prove, with a two-number example, how labelled clues can reveal hidden values.

Group the UTF-8 bytes into blocks of three and show any zero padding.

Why blocks of three? Each block creates exactly three unknown source values for the decoder to recover. That lets us demonstrate the central rule—three suitable clues recover three unknowns—with equations short enough to solve by hand. A four-slot code would require four surviving equations; an eight-slot code would require eight. Three is a teaching choice, not a limit of Reed–Solomon.

Why split a long input instead of making one enormous rule? Solving and replacing small blocks keeps the amount of work bounded. A damaged shard then removes one clue from every small block, and the same recovery procedure can run independently for each block.

The statement “three originals need three clues” still needs proof. We will build that proof from the simpler case of two originals.

5. Build the smallest rule that can create recoverable clues

We need to understand how several stored answers can preserve values that are no longer stored directly. Start with only two source values, [4, 2], so we can see the complete idea before adding a third.

Merely storing their sum does not work. If every clue were 4 + 2 = 6, making ten clues would only make ten copies of 6. The separate values 4 and 2 would already be lost because many different pairs have the same sum.

We need a clue-making rule with two properties:

  1. changing a label must produce a genuinely different clue;
  2. two differently labelled clues must let us recover both original values.

Call the first value a and the second b, then use:

y = a + bx

traceview://reed-solomon/linejobsinteractive
Step 5 · two-number rehearsal

Build the smallest rule that can make recoverable clues

what we needmore clues than originals

Each new clue must preserve information about both 4 and 2.

why a plain sum fails4 + 2 = 6, every time

Many different pairs make 6, so repeating the sum cannot recover the pair.

design for working backwardssame a · different b weight

Two clues can subtract away a, reveal b, then use b to reveal a.

source value 14 → a

a is multiplied by 1, so it stays fixed as x changes.

source value 22 → b

b is multiplied by x, so its contribution changes with x.

y = a + bx = 4 + 2x
Where we are

We want to store several clues about [4, 2], but repeating 4+2 would only store the same sum again and again.

Question this step answers

How can changing one label make different clues while still preserving both original values?

What we did

The source pair [4, 2] becomes a = 4 and b = 2 in the rule y = a + bx.

Why this solves the problem

Keeping a fixed and changing b with x is designed for recovery: two clues contain the same a but different amounts of b. Subtraction can therefore cancel a and expose b. If both used x, only the merged sum a+b would survive.

What this enables next

Choose two x labels and calculate the two corresponding y answers.

Give 4 the fixed role a and 2 the changing role b.

Here x is a label we are free to change, and y is the answer we store. Why give the values these particular jobs?

  • a is multiplied by 1, so its contribution stays fixed when x changes;
  • b is multiplied by x, so its contribution changes when x changes.

The design is chosen to make one value cancel cleanly during recovery. In two clues, a appears with the same weight 1, while b appears with two different weights. Subtracting the equations will therefore remove a and leave a multiple of b. Once b is known, either clue reveals a.

If both values changed together, ax + bx = (a+b)x, and every clue would reveal only a+b. If neither changed, every clue would be identical. One fixed job plus one changing job is the simplest arrangement that keeps the two values separable.

6. Make two labelled clues

We now have a recipe, but no stored clues. To create clues, choose two different settings for x. We use 1 and 2 because they keep the arithmetic small and their difference is 1; no special Reed–Solomon property belongs to those particular numbers.

Choose x = 1:

y = 4 + 2×1 = 6

Choose x = 2:

y = 4 + 2×2 = 8

traceview://reed-solomon/linecluesinteractive
Step 6 · two-number rehearsal

Make two labelled clues

x = 14 + 2×1 = 6store (1, 6)
x = 24 + 2×2 = 8store (2, 8)
Where we are

The rule can make clues, but none have been calculated or stored yet.

Question this step answers

Which two calculations give us different information, and what must be stored so they remain understandable?

What we did

x = 1 makes y = 6, and x = 2 makes y = 8. We store the labelled clues (1, 6) and (2, 8).

Why this solves the problem

Different x settings give b different weights, creating two distinct equations. Keeping each x tells the decoder which weights—[1, 1] or [1, 2]—made its y answer; repeating or discarding x would lose that distinction.

What this enables next

Turn the two clues into equations and subtract them.

Calculate y at x=1 and x=2, then keep each x beside its answer.

Store (1, 6) and (2, 8). From here onwards, labelled clue means exactly this pair (x, y):

  • x records which weights were used;
  • y records the answer those weights produced.

Why must the settings differ? Using x = 1 twice would recreate the same equation twice. It would look like two stored items but contain only one piece of information. Different settings make b carry a different weight in each equation.

Why store x as well as y? The number 8 alone does not say which weights produced it. The label tells recovery how to turn the stored answer back into an equation. Discarding x would discard the instructions needed to interpret y.

7. Subtract the two equations to recover b

The original pair is now treated as lost. All we have are (1,6) and (2,8). Their labels recreate these equations:

a + b = 6

a + 2b = 8

Subtract the first equation from the second:

(a + 2b) − (a + b) = 8 − 6

traceview://reed-solomon/linefindbinteractive
Step 7 · two-number rehearsal

Subtract the equations to recover b

(a + 2b) − (a + b) = 8 − 6
a − abecomes0
2b − bbecomesb
8 − 6becomes2
b = 2
Where we are

The originals are treated as lost. The two stored clues recreate a+b=6 and a+2b=8.

Question this step answers

How can we remove one unknown without guessing either value?

What we did

(a + 2b) − (a + b) = 8 − 6 simplifies to b = 2.

Why this solves the problem

Step 5 deliberately gave a the same weight in both clues. Subtracting matching sides makes a−a equal zero while 2b−b leaves b. Adding or dividing the equations would not exploit that designed cancellation.

What this enables next

Put b = 2 into either original equation to recover a.

Subtract matching terms and watch a cancel.

Term by term:

  • a − a = 0;
  • 2b − b = b;
  • 8 − 6 = 2.

The result is b = 2.

Why subtract rather than add, divide or guess? Our Step 5 design deliberately put the same amount of a in both clues. Subtraction turns that shared part into a−a=0. Adding would keep both unknowns; dividing whole equations would mix them into fractions; guessing would provide no guarantee. Subtraction exploits the structure we intentionally created.

Because the two x labels differ by 1, the remaining b terms are 2b−b=b. This is the payoff from choosing one fixed job and one changing job.

8. Substitute b to recover a

After Step 7, b is known but a is still missing. The reduced equation no longer contains a, so it cannot recover it. We must return to one of the original clues, which still relates a to b.

Use a + b = 6 and replace b with the recovered value 2:

a + 2 = 6

Subtract 2 from both sides:

a + 2 − 2 = 6 − 2

a = 4

traceview://reed-solomon/linefindainteractive
Step 8 · two-number rehearsal

Substitute b to recover a

a + b = 6
a + 2 = 6
a + 2 − 2 = 6 − 2
a = 4
Where we are

Subtraction recovered b=2, but the reduced equation no longer contains a.

Question this step answers

How can the known b value turn an original two-unknown clue into an equation for a alone?

What we did

a + b = 6 becomes a + 2 = 6. Subtracting 2 from both sides gives a = 4.

Why this solves the problem

Returning to an original clue restores the relationship containing a. Replacing b with its known value removes the ambiguity, and subtracting 2 from both sides isolates a without changing the equality.

What this enables next

Give a third source value a third pattern that cannot merge with a or b.

Put b=2 into the first equation and subtract 2 from both sides.

Why substitute? An equation with two unknowns could not identify either value by itself. Replacing the now-known b removes that ambiguity and leaves an ordinary one-unknown equation. Either original clue would work and must give the same a.

Two differently labelled clues have now recovered both source values. This miniature round trip is why the later three-value mixer is plausible rather than magic.

9. Give a third source value a third job

Our real block contains three values, but the rehearsal rule has only two distinguishable jobs. Simply inserting c somewhere in those existing jobs would destroy information:

  • adding c to the fixed slot produces (a+c) + bx, so only the sum a+c can be recovered;
  • giving c the same changing slot produces a + (b+c)x, so only the sum b+c can be recovered.

Give c a new weight pattern, :

p(x) = a + bx + cx²

traceview://reed-solomon/lineaddcinteractive
Step 9 · two-number rehearsal

Add a separate slot for the third value

wrong: reuse the fixed slot(a + c) + bx

a and c merge. The clues can recover only their sum.

wrong: reuse the x slota + (b + c)x

b and c merge. The clues can recover only their sum.

separate third patterna + bx + cx²

1, x and x² change differently, so all three slots stay distinguishable.

Where we are

The real code protects three values, but a+bx provides only two distinguishable patterns: fixed and changing with x.

Question this step answers

Where can c go without being absorbed into a or b?

What we did

The third value becomes c in a + bx + cx². Its weight is x², which changes differently from both 1 and x.

Why this solves the problem

Any third pattern made from a fixed part plus an x part folds into the existing a and b slots. x² is the simplest new shape that cannot be folded into them, so c leaves a separately recoverable trace.

What this enables next

Follow one complete three-number block through the resulting mixer.

Compare two rules that merge c with another value against the separate x² slot.

Now the three slots change as 1, x, and . Why those three patterns?

We need one recipe that can make as many differently labelled clues as we want. Changing the single label x must produce a new mixture, and any three differently labelled mixtures must contain enough different information to recover the three originals.

The shortest power sequence with three different jobs is:

  • 1: this slot stays fixed;
  • x: this slot changes once with x;
  • : this slot changes twice with x.

Using x twice would fail because bx + cx = (b+c)x: the second and third originals would merge into one unknown sum. Using x and 2x would fail for the same reason: both still follow the same x pattern, with one merely twice the other.

In fact, any third pattern made only from “a fixed number plus a multiple of x” would fail. Call that pattern r + sx. The rule would become:

a + bx + c(r + sx)

Multiply out the brackets:

a + bx + cr + csx

Group the fixed parts and the x parts:

(a + cr) + (b + cs)x

The three originals have collapsed back into only two recoverable combinations: a + cr and b + cs. No number of extra clues could separate a, b, and c again.

We therefore need a third pattern that cannot be rewritten as “fixed number plus a multiple of x”. The simplest next operation is to multiply x by itself, giving . That is the actual reason for choosing it: it creates a third kind of change that cannot be absorbed into the first two jobs.

This does not yet prove that the choice works. Steps 15 and 16 do that by starting with three clues and showing that the arithmetic can always separate all three original slots. The choice is therefore not “because Reed–Solomon says so”; it is the simplest reusable pattern that passes the recovery requirement.

10. See the complete shape before adding bounded arithmetic

We have designed the shape of one recoverable clue, but the next topic—bounded arithmetic—will add unfamiliar wrapping. Before introducing that complication, pause and see where every value will travel.

The encoder does not turn one number into several copies. It turns the whole three-number block into six labelled clues about that block.

traceview://reed-solomon/overviewinteractive
Step 10 · map before maths

Three originals become six labelled clues

First three-number block · ordinary arithmetic rehearsal42[52, 50, 0]
What must survive[a, b, c] = [52, 50, 0]

These three numbers are unknown again if the original block is lost.

What the encoder storessix different weighted totals

Every total keeps an x label that tells recovery which weights made it.

clue x=1[1, 1, 1] → y=102

52×1 + 50×1 + 0×1 = 102

clue x=2[1, 2, 4] → y=152

52×1 + 50×2 + 0×4 = 152

clue x=3[1, 3, 9] → y=202

52×1 + 50×3 + 0×9 = 202

clue x=4[1, 4, 16] → y=252

52×1 + 50×4 + 0×16 = 252

clue x=5[1, 5, 25] → y=302

52×1 + 50×5 + 0×25 = 302

clue x=6[1, 6, 36] → y=352

52×1 + 50×6 + 0×36 = 352

Three clues survive(1, 102) · (3, 202) · (5, 302)

Each pair supplies a different weighted total and the label for its weights.

Only one block fits all three[52, 50, 0]

Recovery finds the three values that make every surviving clue true.

Where we are

We have designed a three-slot clue, but have not yet connected blocks, extra clues, loss and recovery into one picture.

Question this step answers

What information is stored, what may disappear, and what do the survivors still describe?

What we did

The encoder created six labelled clues about the same three original numbers. It did not create six unrelated answers.

Why this solves the problem

Every clue contains a differently weighted trace of the whole block. Any three survivors therefore provide three equations for its three unknowns. This map isolates the storage idea before bounded arithmetic adds another concept.

What this enables next

Choose arithmetic that keeps the repeated calculations bounded without merging possible inputs.

Follow one three-number block into six labelled clues, discard half, and see what the survivors still know.

If the originals disappear, three surviving clues give three different weighted totals about the same three unknown numbers. The x labels reveal the weights used for each total. Recovery can therefore find the one three-number block that makes all three clues true.

Why show an overview now? It separates the storage design from the number system used to implement it. If we introduced mixing, modular arithmetic, shards and recovery simultaneously, it would be unclear which idea solved which problem.

This overview deliberately uses ordinary arithmetic. It answers what is stored and what survives. Some totals grow beyond a byte; Step 11 separately answers how those totals remain a fixed size without destroying reversibility.

That is the whole shape. The remaining sections make every calculation and its reversal explicit.

11. Keep answers inside one fixed range

The storage shape now works in ordinary arithmetic, but repeatedly multiplying byte values produces ever-larger numbers: 200 × 200 = 40,000. A code whose stored symbols grow without limit is not a usable fixed-size storage format. We need every operation to return to one known set of values.

Why not simply discard high digits or wrap into 0–255? Size is only half the requirement. Recovery must also undo multiplication. Ordinary mod 256 keeps answers small, but some multiplication merges different inputs:

0 × 2 mod 256 = 0

128 × 2 mod 256 = 0

Two possible inputs have become the same answer. Keeping the result byte-sized is not enough; recovery also needs every non-zero multiplication to have an undo. The decoder will eventually undo numbers that multiply the unknown letters. If multiplication merged two inputs, that undo operation would have no single correct answer.

First use a tiny set, 0 to 16, so the safe version of the idea fits on screen.

14 × 8 = 112, but 112 is outside that set. Count around the loop and it lands on 10. This is what 112 mod 17 = 10 means: keep the remainder after dividing by 17.

traceview://reed-solomon/fieldinteractive
Step 11 · small rehearsal

Keep every answer inside a fixed set of numbers

Answer10
14 × 8 = 112; 112 mod 17 = 10
Without wrapping112

The result can leave the 0–16 space and keep growing after every operation.

After mod 1710

The result is always one of the same 17 values, so it still fits one toy symbol.

ordinary arithmeticreversible, but grows

200 × 200 becomes 40,000, so stored answers no longer have a fixed size.

ordinary mod 256bounded, but can collide

0 × 2 and 128 × 2 both become 0. Recovery cannot know which input was used.

this prime-sized loopbounded and reversible

Every non-zero multiplication rearranges the values without merging them.

012345678910111213141516

Why 17? It is a small prime that still gives the visual room to show useful arithmetic. Three is too cramped; 97 is too crowded. Both would work, but neither would teach this example as clearly.

Where we are

The mixer works in ordinary arithmetic, where repeated multiplication can create values much larger than a byte.

Question this step answers

How can stored answers remain a fixed size without making multiplication impossible to reverse?

What we did

14 × 8 became 10 after wrapping around at 17.

Why this solves the problem

Prime-sized wrapping keeps every answer in one finite set while allowing every non-zero multiplication to be undone. Ordinary mod 256 supplies the size bound but can merge distinct inputs, which would destroy recovery information.

What this enables next

Compare a composite-sized loop with a prime-sized loop to see why the prime matters.

Use a clock-like loop to see a large answer wrap back into the allowed range.

Why 17? It is only a teaching choice. We need a prime that is small enough to draw but large enough to show interesting results. A loop of 3 positions would work mathematically but is too cramped to teach much. A loop of 97 would also work but would be absurd to put on a clock. Seventeen is a convenient middle ground, not a magic Reed–Solomon number.

Our educational encoder uses a larger loop from 0 to 256. We use 257 positions because every byte value from 0 to 255 fits, and 257 is the smallest prime larger than 255. The trade-off is that an encoded answer can be 256, so this toy needs 9 binary digits per stored value; a simple implementation would usually place that value in two bytes.

Production Reed–Solomon code usually uses a 256-value arithmetic table called GF(256). Every non-zero multiplication row in that table contains each non-zero byte exactly once, so every result points back to one input and the multiplication can be undone. Building that table uses bit operations rather than ordinary remainders. This article does not use those operations: every calculation below stays in the fully shown 257-position system.

12. Check that the mixing can be undone

Step 11 proposed prime-sized wrapping, but saying it is reversible is not enough. Before entrusting data to it, test the exact failure that would make decoding impossible: two different inputs landing on the same answer.

traceview://reed-solomon/reversibleinteractive
Step 12 · small rehearsal

Make sure the mixing has an undo button

All possible inputsDo any two inputs land on the same answer?
17/17 unique answers
001821637415566147581394101211312111321410151169
16 positions · composite2/16 unique after ×8

0 and 2 both land on 0. Once they collide, recovery cannot tell them apart.

17 positions · prime17/17 unique after ×8

Every input lands somewhere different, so multiplying can be undone.

Where we are

We have proposed prime-sized wrapping, but the decoder will later depend on reversing multiplications inside it.

Question this step answers

Does multiplying by a non-zero weight keep every possible input distinguishable?

What we did

Every input has a different answer. Multiplying by 15 reverses ×8.

Why this solves the problem

A prime has no smaller factors that can collapse different inputs together. For example, 14 × 8 mod 17 = 10, then 10 × 15 mod 17 = 14.

What this enables next

Use 257—the smallest prime above 255—so every possible byte value fits.

Multiply every possible input and look for two inputs that collide.

Why must the loop size be prime? Compare loops of 16 and 17 positions while multiplying by 8:

  • with 16 positions, 0 × 8 and 2 × 8 both land on 0, so two possible inputs collide;
  • with 17 positions, multiplying by 8 visits every position exactly once.

A composite number such as 16 can be split into smaller whole-number factors. Those shared factors allow different inputs to collapse onto the same remainder:

  • the inputs 0 and 2 differ by 2;
  • multiplying that difference by 8 gives 2 × 8 = 16;
  • 16 is exactly one complete lap of the 16-position loop;
  • the two products therefore land on the same position.

Why can that not happen in the 17-position loop? A collision after multiplying inputs u and v by 8 would mean their raw products differ by a whole number of 17-position laps. Their difference is 8 × (u−v). Seventeen is prime and shares no factor with 8, so a complete factor of 17 would have to come from u−v. But u and v are both between 0 and 16; the only way their difference can be a whole multiple of 17 is for the difference to be 0. That means u and v were the same input, not a collision.

Why test multiplication rather than only addition? Adding a known amount can always be undone by subtracting it. Multiplication is the risky operation used throughout the mixer: if multiplying by a non-zero weight creates collisions, the later “divide this weight away” step has no unique answer.

This is why we do not merely pick any range that looks convenient. Once two possibilities have merged, no decoder can separate them again. The formal name for the safe prime-sized number system is a finite field; remembering “fixed range, no collisions, operations can be reversed” is enough.

13. Give the three source numbers short names

We are about to use the same mixer for every three-number block. Writing the current values—such as 52, 50 and 0—directly into the rule would describe only this one block and would make the recovery algebra hard to follow. We need names for the three positions, independent of whichever numbers occupy them.

Call the first position a, the second b, and the third c.

traceview://reed-solomon/namesinteractive
Step 13

Give the three source numbers short names

Following input42[52, 50, 0]
source number 152a = 52
source number 250b = 50
source number 30c = 0
Where we are

The current block contains three concrete numbers, but the same equations must work for every block and later treat these values as unknown.

Question this step answers

How can we name the three positions without baking one block's values into the rule?

What we did

52, 50, 0 are now called a, b and c.

Why this solves the problem

The letters name positions, not new values. During recovery the numbers are unknown, so a, b and c let us write and solve equations for the first, second and third positions before putting their recovered numbers back.

What this enables next

Give each named value a separate slot in that rule.

Give each source number a letter without changing its value.

For 42, this says a = 52, b = 50, and c = 0. The letters are labels, not extra maths.

Why letters? During decoding the values themselves are unknown. The letters let us write statements about those missing positions and solve for them. Once solved, they map straight back to the first, second and third byte positions.

14. Build the mixer that makes replacement clues

We have three original numbers but want six stored numbers. Two complete copies would also occupy six positions, but they would not survive every possible set of three losses. If the a position vanished from both copies, plus any third position, neither remaining copy would contain a complete [a,b,c] block.

Reed–Solomon instead makes every stored clue a different mixture of all three originals. No clue belongs only to a, b, or c; any three survivors describe the whole block.

What problem does the mixer solve? It spreads knowledge of every original across every stored position. We are deliberately replacing the original layout—where one lost position means one completely lost value—with a set of overlapping equations. A surviving clue does not reveal one byte directly; it preserves some information about all three.

This rule is the mixing recipe:

p(x) = a + bx + cx²

It says:

  • p is merely the name of this mixer;
  • p(x) means “the answer from the mixer when its setting is x”;
  • bx is shorthand for b × x;
  • cx² is shorthand for c × x × x;
  • choose a value for x;
  • multiply a by 1, b by x, and c by ;
  • add those three contributions;
  • call the answer y and store the pair (x, y).
traceview://reed-solomon/ruleinteractive
Step 14

Use one mixer to make different labelled clues

Following input42[52, 50, 0]
source 152

becomes the plain number

source 250

becomes the amount of x

source 30

becomes the amount of x²

p(x) = 52 + 50x + 0x² (mod 257)
mixer setting x=1weights [1, 1, 1]

52×1 + 50×1 + 0×1 = 102 → store (1, 102)

mixer setting x=2weights [1, 2, 4]

52×1 + 50×2 + 0×4 = 152 → store (2, 152)

mixer setting x=3weights [1, 3, 9]

52×1 + 50×3 + 0×9 = 202 → store (3, 202)

the requirementany three labels must undo the mix

Changing one label x must make a new clue without introducing a new recipe.

failed choice: [1, x, x]bx + cx = (b+c)x

The two values collapse into one sum and cannot be separated.

every linear third choice failsc(r+sx) folds into a and b

a+bx+c(r+sx) = (a+cr)+(b+cs)x, so three originals collapse into two combined values.

chosen: [1, x, x²]a×1 + b×x + c×x²

x² is the simplest new shape that cannot be folded into a fixed part plus an x part. The next two steps prove it can be undone.

Where we are

Three named source positions must become more than three stored clues, with every clue preserving information about the whole block.

Question this step answers

Which repeatable recipe creates new mixtures while guaranteeing that any three labels can be undone?

What we did

p(x) is a recipe, not another stored value. Each x setting applies different weights to the same three originals and produces one new y answer.

Why this solves the problem

We need one label x to generate many mixtures while guaranteeing that any three can be undone. Any third pattern r+sx can be absorbed into the existing fixed and x slots, leaving only two combined values. x² is the simplest new pattern that cannot be absorbed that way. Steps 15 and 16 prove that it can be reversed.

What this enables next

Prove first with x=1, 2 and 3, then with any three different labels.

Turn the same three source numbers into several differently weighted mixtures.

Think of x as the mixer's setting. At x = 1, the weights are [1, 1, 1]. At x = 2, they are [1, 2, 4]. Changing x changes the mixture without changing the original numbers. This is how one fixed block can produce more clues without merely copying itself.

Why choose 1, x and ?

Start from the job the mixer must perform:

  1. it must accept one simple label, x;
  2. each new x must make a different mixture;
  3. any three different labels must let the decoder separate a, b, and c;
  4. the same recipe must keep working when we make a fourth, fifth, or sixth clue.

The powers 1, x, and meet those requirements:

  • a gets the fixed weight 1, so it contributes the same baseline to every mixture;
  • b gets x, so its contribution changes in direct proportion to the label;
  • c gets , so its contribution follows a different curve rather than a resized copy of x.

For example, compare the weights made by x = 1, 2, and 3:

3 / 3 rows

x = 1111
x = 2124
x = 3139

No column is just a fixed multiple or copy of another column. That difference is what allows subtraction to remove one unknown at a time.

Now compare two tempting alternatives:

  • [1, x, x] fails because bx + cx = (b+c)x; only the sum b+c survives;
  • [1, x, 2x] also fails because bx + 2cx = (b+2c)x; again, only one combined value survives.

Why not choose some other third formula? Anything shaped like r + sx is still only a fixed part plus an x part:

a + bx + c(r + sx) = (a + cr) + (b + cs)x

That would hide three originals inside only two combined values. We choose because it is the simplest expression that cannot be folded into the existing 1 and x slots.

Other mixing recipes could work if they gave the same “any three labels can be undone” guarantee. Powers are useful because they extend the same construction without inventing a new rule: with three originals, use 1, x, ; with four originals, add the next new shape ; with five, add x⁴. Steps 15 and 16 now prove, rather than merely claim, that the three-slot version can be undone.

15. Prove that three clues identify only one block

The mixer looks plausible, but storage reliability cannot depend on plausibility. We need to rule out the dangerous case: two different source blocks producing the same three surviving clues. If that could happen, the decoder would have no way to choose the original.

Suppose two different blocks somehow produced the same clues at x = 1, 2, and 3. Subtract one block’s slots from the other block’s slots and call the differences A, B, and C.

Because the clue answers supposedly match, the differences must produce zero:

A + B + C = 0

A + 2B + 4C = 0

A + 3B + 9C = 0

traceview://reed-solomon/uniqueinteractive
Step 15

Prove that three clues cannot describe two different blocks

assume two blocks fitsubtract one block from the other

Call the three slot differences A, B and C. Matching clues mean every difference answer is 0.

at x = 1, 2 and 3A+B+C=0 · A+2B+4C=0 · A+3B+9C=0

These are the same three equations the decoder would receive, but all answers are zero.

eliminate A, then BB+3C=0 · B+5C=0 · 2C=0

The same subtraction used later leaves C=0, then B=0, then A=0.

undo ×22C = 0 → C = 0

The reversible field multiplication leaves no other value for C.

substitute CB + 3×0 = 0 → B = 0

The first reduced equation now contains only B.

substitute B and CA + 0 + 0 = 0 → A = 0

All three slot differences are zero, so only one block fits.

Where we are

The mixer looks reversible for x=1, 2 and 3, but reliability requires proof that two source blocks cannot share those clues.

Question this step answers

Could two genuinely different blocks produce the same three stored answers?

What we did

We assumed two blocks fitted, subtracted their slots, and found that every slot difference had to be zero.

Why this solves the problem

The three distinct weight patterns let equation elimination remove A and B in turn. The prime-sized number system guarantees that the remaining non-zero multipliers have an undo, so C cannot hide behind an irreversible multiplication.

What this enables next

Choose one x label and calculate one clue without skipping any arithmetic.

Assume two blocks fit, subtract them, and eliminate the three slot differences.

Subtracting the first equation from the second gives B + 3C = 0. Subtracting the second from the third gives B + 5C = 0. Subtract those reduced equations and the B terms cancel:

2C = 0

In our reversible number system, multiplication by 2 has an undo, so 2C = 0 forces C = 0.

Put C = 0 into B + 3C = 0:

B + 3×0 = 0

B = 0

Put B = 0 and C = 0 into A + B + C = 0:

A + 0 + 0 = 0

A = 0

Why compare the difference between two possible blocks? Proving uniqueness directly would require listing every possible block. The difference turns the question into a simpler one: can any non-zero change to [a,b,c] leave all three clues unchanged? The calculation shows the only invisible change is [0,0,0], meaning no change at all.

The supposed blocks are therefore the same block. This is the guarantee we need: three correctly labelled clues made with these distinct x values leave one possible answer.

16. Show why any three different labels work

The previous proof only covered the first three labels. That is not yet enough for erasure protection: after arbitrary losses, the survivors might be x = 2, 4, and 6. The code promises any three different labels, so the proof must not depend on receiving 1, 2 and 3.

Call the three surviving labels r, s, and t. Suppose two blocks again produce the same three answers. Their slot differences A, B, and C must satisfy:

A + rB + r²C = 0

A + sB + s²C = 0

A + tB + t²C = 0

traceview://reed-solomon/anythreeinteractive
Step 16

Extend the proof to any three different labels

name the labelsr · s · t

They may be any three values, provided no two are equal.

subtract the r equation from the s equation(s−r)B + (s²−r²)C = 0

A−A disappears exactly as it did in the numbered example.

factor the square difference(s−r)[B + (s+r)C] = 0

s²−r² equals (s−r)(s+r), so the common factor s−r can be shown.

check the factorisations² + sr − rs − r² = s² − r²

Multiplication makes sr and rs equal, so the middle terms cancel.

s and r are differentB + (s+r)C = 0

The inverse changes (s−r)⁻¹(s−r) into 1 and leaves the right side at 0.

repeat with t and rB + (t+r)C = 0

The same subtraction creates a second reduced equation.

subtract the reduced equations(t−s)C = 0 → C = 0

t−s is also non-zero and reversible. Substitution then gives B=0 and A=0.

Where we are

The previous proof covered labels 1, 2 and 3, while arbitrary shard loss may leave any three labels.

Question this step answers

Does the uniqueness proof still work for three different labels that are not consecutive?

What we did

The labels were represented by r, s and t instead of the particular values 1, 2 and 3.

Why this solves the problem

Every cancellation depends only on the labels being different. Their non-zero differences have inverses in the prime field, so the same elimination works for any three distinct labels.

What this enables next

Choose one concrete x label and calculate a stored clue.

Use r, s and t to repeat the cancellation without assuming particular label values.

Subtract the r equation from the s equation:

(s−r)B + (s²−r²)C = 0

The difference of two squares can be factored:

s²−r² = (s−r)(s+r)

Expand the right-hand side to check it:

(s−r)(s+r) = s² + sr − rs − r²

sr and rs are the same multiplication, so +sr−rs=0. What remains is s²−r².

so:

(s−r)[B + (s+r)C] = 0

The labels s and r are different, so s−r is not zero. Every non-zero field value has an inverse. The notation (s−r)⁻¹ means “the field value that multiplies (s−r) to make 1”. Multiply both sides by it:

(s−r)⁻¹(s−r)[B + (s+r)C] = (s−r)⁻¹×0

The inverse pair on the left becomes 1, and any value multiplied by 0 remains 0:

B + (s+r)C = 0

Repeat the same work with the t and r equations:

B + (t+r)C = 0

Subtract the two reduced equations:

(t−s)C = 0

The labels t and s are also different, so t−s is non-zero and has an inverse. Therefore C = 0. Substitution then gives B = 0 and A = 0, exactly as in Step 15.

Why replace numbers with r, s, and t? They stand for whichever labels happened to survive. If the cancellation works without assigning them particular values, it proves the property for every permitted set rather than one convenient example.

Nothing in that reasoning required the labels to be consecutive. It required only that they were different, so their differences were non-zero and reversible. That proves any three correctly labelled survivors work.

17. Choose one x label

The rule is still only a recipe. To create an actual stored clue, we must select one concrete mixer setting. Use x = 2 for the first detailed calculation.

traceview://reed-solomon/choosexinteractive
Step 17

Choose an unused x label

Following input42[52, 50, 0]
x = 2
Where we are

The mixer is a general recipe, but no concrete clue exists until one setting chooses its weights.

Question this step answers

Which label will identify this clue and make its equation different from the others?

What we did

x = 2

Why this solves the problem

A concrete x chooses all three weights and becomes the clue’s identity. Using a new label produces a new equation; reusing one would only store the same information twice and would not replace a different lost clue.

What this enables next

Put this x value into every x position in the recipe.

Choose x=2 and explain why every stored clue needs a different label.

Why is choosing a label an operation at all? The label determines all three weights [1,x,x²] and is therefore part of the clue's meaning. There is nothing special about 2. We use the small labels 1 through 6 because they are distinct and make the arithmetic readable. Reusing an x within the same block would repeat the same weights and therefore repeat information instead of adding a replacement clue.

18. Substitute the chosen x value

We know which setting this clue will use, but the rule still contains the placeholder x. Replace every x in the rule with 2.

traceview://reed-solomon/substituteinteractive
Step 18

Replace every x with the chosen number

Following input42[52, 50, 0]
p(2) = 52 + 50×2 + 0×2²
Where we are

This clue has label x=2, while its calculation still contains the placeholder x.

Question this step answers

How do we turn the general mixer into the one calculation belonging to this label?

What we did

p(2) = 52 + 50×2 + 0×2²

Why this solves the problem

The general recipe describes every possible clue. Substitution creates the one calculation belonging to this label. Every occurrence must receive the same number; mixing settings inside one expression would no longer describe any valid clue.

What this enables next

Calculate x squared.

Replace every x with 2 and leave the later arithmetic untouched.

Why substitute before calculating? It converts the general recipe—which can describe many clues—into the one concrete calculation for this clue. Every x in the formula refers to the same setting, so replacing only one occurrence would mix two settings and produce a meaningless answer.

19. Calculate

After substitution, the c weight still contains an unfinished operation, . Calculate that weight before multiplying it by c:

x² = 2² = 2 × 2 = 4

traceview://reed-solomon/squareinteractive
Step 19

Calculate x²

Following input42[52, 50, 0]
2² = 2 × 2 = 4
Where we are

After substitution, c's weight is still written as 2² rather than a concrete number.

Question this step answers

What numerical weight does the c slot receive at this mixer setting?

What we did

2² = 2 × 2 = 4

Why this solves the problem

c’s deliberately separate pattern needs a concrete numerical weight before c can be multiplied. Squaring x gives that weight; keeping this operation visible distinguishes the label, the weight and the source value.

What this enables next

Multiply b by x.

Calculate 2 squared without performing either source-value multiplication.

Why calculate this separately? is not a new source value; it is the weight assigned to c at this label. Making the weight explicit as 4 lets the next step show exactly how much of c enters the clue. A computer could evaluate the expression in one line, but separating it prevents the source value, its weight and their product from being confused.

20. Calculate b’s contribution

For the default block, b = 50 and x = 2:

b × x = 50 × 2 = 100

traceview://reed-solomon/multiplybinteractive
Step 20

Calculate b’s contribution

Following input42[52, 50, 0]
b × x = 50 × 2 = 100
Where we are

The b slot contains 50, and this clue's chosen x weight is 2.

Question this step answers

How much does b contribute to this particular stored total?

What we did

b × x = 50 × 2 = 100

Why this solves the problem

Multiplying by x makes the same b leave a different-sized trace in each clue. If b were added unchanged every time, it would behave like the fixed a slot and the decoder could recover only their merged sum.

What this enables next

Multiply c by x squared.

Calculate only the contribution from the b slot.

Why multiply b by x? The changing weight is what makes the same b leave a different trace in each clue. If we added the plain value 50 every time, b would behave like the fixed a slot and the two could merge. At x = 2, the rule deliberately puts two copies of b into this total, so b contributes 100.

21. Calculate c’s contribution

For 42, the padded first block is [52, 50, 0], so c = 0. The c weight is x² = 4:

c × x² = 0 × 4 = 0

traceview://reed-solomon/multiplycinteractive
Step 21

Calculate c’s contribution

Following input42[52, 50, 0]
c × x² = 0 × 4 = 0
Where we are

The c slot contains 0, and Step 19 made its x² weight 4.

Question this step answers

How much does c contribute under its deliberately different weight pattern?

What we did

c × x² = 0 × 4 = 0

Why this solves the problem

The x² multiplication gives c its separately recoverable trace. The encoder must perform it for every block—even when c is zero padding—because the decoder interprets every clue using the same three-slot recipe.

What this enables next

Add the three contributions.

Calculate only the contribution from the c slot.

Why perform a multiplication whose answer is zero? The encoder follows one fixed recipe for every block; it cannot silently omit the third slot merely because this example contains padding. A longer input may put a non-zero byte there, and the decoder interprets every clue as containing all three weighted slots. The result happens to be zero here, but the operation defines what the clue means.

22. Add the three contributions

The a contribution is a × 1 = 52. Add all three:

52 + 100 + 0 = 152

traceview://reed-solomon/addtermsinteractive
Step 22

Add the three contributions

Following input42[52, 50, 0]
52 + 100 + 0 = 152
Where we are

The three separate contributions are 52, 100 and 0, but one clue stores one field value.

Question this step answers

How do we combine partial knowledge of all three source positions into one stored answer?

What we did

52 + 100 + 0 = 152

Why this solves the problem

Each stored position must preserve partial knowledge of the whole block. Addition compresses all three weighted traces into one field value; storing them separately would recreate three individually vulnerable source positions.

What this enables next

Keep the remainder after division by 257.

Add a, b×x and c×x² without wrapping yet.

Why combine the contributions into one number? We want each stored position to carry partial knowledge of the whole block, not a separately stored copy of one source value. Addition compresses the three weighted contributions into one field value. One such sum loses detail; several differently weighted sums restore it by providing several equations. Storing the three contributions separately would simply recreate three vulnerable source positions and would not be the code we are building.

23. Wrap the total into the field

The total 152 is already between 0 and 256:

152 = 0 × 257 + 152

152 mod 257 = 152

traceview://reed-solomon/wrapanswerinteractive
Step 23

Wrap the total into the 257-position field

Following input42[52, 50, 0]
152 = 0×257 + 152, so 152 mod 257 = 152
Where we are

The ordinary total is 152, while every stored symbol must use the agreed 0–256 field.

Question this step answers

Which fixed-size field value represents this possibly large total?

What we did

152 = 0×257 + 152, so 152 mod 257 = 152

Why this solves the problem

Every stored symbol must fit the agreed 0–256 range. The remainder is this total’s in-range representative, and using the same field during recovery keeps subtraction, multiplication and their inverses consistent.

What this enables next

Store the x label beside this y answer.

Show the division by 257 and keep its remainder as y.

Why wrap every clue now? The stored symbol must stay inside the agreed 0–256 range. Letting some clues remain as large ordinary integers would give them a different representation and make later field operations inconsistent. For a larger total, subtracting complete groups of 257 gives the same field position. For example, 409 = 1×257 + 152, so 409 and 152 represent the same field value. Encoding and decoding both use this rule.

24. Store the labelled clue

Call the wrapped answer y. We chose x = 2 and calculated y = 152, so store:

(x, y) = (2, 152)

traceview://reed-solomon/storepointinteractive
Step 24

Store the x label beside the y answer

Following input42[52, 50, 0]
(x, y) = (2, 152)
Store the labelled clue(2, 152)a + 2b + 4c = 152
Where we are

The calculation produced y=152, but that answer alone does not record which weights created it.

Question this step answers

What information must survive so the decoder can recreate this exact equation?

What we did

(x, y) = (2, 152)

Why this solves the problem

y=152 records the total, while x=2 records which weights made it. Recovery needs both pieces to reconstruct the equation; storing the answer alone would preserve a number but discard how to interpret it.

What this enables next

Repeat the same operations at a new x label.

Place the x label beside the completed y answer.

Why store a pair rather than only the answer? Recovery needs both the result and the recipe setting that produced it. The pair means “the mixer produced 152 using the weights belonging to x = 2”. Storing 152 without 2 would preserve a number but lose the information needed to recreate its equation.

25. Repeat until there are three clues

One completed clue gives one equation, but the block contains three unknown source values. Repeat Steps 17–24 with unused x labels until recovery has enough differently weighted equations.

traceview://reed-solomon/factsinteractive
Step 25

Collect one labelled clue for each unknown value

Following input42[52, 50, 0]
Unknown values
a = ?b = ?c = ?
Different labelled clues collected
x=1 gives: a + b + c = 102
1/3 clues
Where we are

The block still contains three unknown positions, while 1 differently labelled equation has been collected.

Question this step answers

How many differently weighted equations are required before only one three-value block can fit?

What we did

1 differently labelled clue now describe a, b and c.

Why this solves the problem

There are still three unknowns but only 1 clue, so more than one answer can fit.

What this enables next

Calculate another differently labelled clue.

Add differently labelled clues one at a time and compare them with the three unknown slots.

Why stop at three for recovery? One clue is one equation containing three unknowns, so many blocks can fit it. Two clues still leave a free choice. Three clues made with different x labels provide exactly the information Steps 15–16 proved sufficient to isolate a, b, and c. Fewer cannot guarantee one answer; more are useful as replacements rather than as a stricter decoding requirement.

26. Watch two clues accept two different blocks

The previous step used the rule of thumb “two equations cannot fix three unknowns”. Rather than asking the reader to accept that count, construct the failure: two genuinely different blocks that produce the same answers at x = 1 and x = 2.

traceview://reed-solomon/whyinteractive
Step 26

See why two clues still leave more than one answer

Following input42[52, 50, 0]
Known(1, 102)(2, 152)
Candidate Ap(x) = 52 + 50x + 0x² (mod 257)
x=1102x=2152x=3202x=4252x=545x=695

Fits both known clues.

Candidate Bp(x) = 54 + 47x + 1x² (mod 257)
x=1102x=2152x=3204x=41x=557x=6115

Fits both known clues.

Where we are

Two labelled equations are being asked to recover three unknown source positions.

Question this step answers

Is the third clue truly necessary, or is three merely a convenient count?

What we did

Candidates A and B produce exactly the same first two stored clues.

Why this solves the problem

The alternative adds 2 to a, subtracts 3 from b and adds 1 to c. At x=1 those changes total 2−3+1=0. At x=2 they total 2−6+4=0. Both rules therefore make the same first two clues even though their stored source values differ.

What this enables next

Adding more points raises the number of erasures we can survive; it does not make the original data larger.

Compare the real block with an alternative that matches two clues, then reveal the third clue.

The alternative changes the slots by [+2, −3, +1]:

  • at x = 1, the change in the answer is 2 − 3×1 + 1×1² = 0;
  • at x = 2, the change is 2 − 3×2 + 1×2² = 2 − 6 + 4 = 0;
  • at x = 3, the change is 2 − 9 + 9 = 2, not zero.

Why show a counterexample? It proves that refusing to decode from two clues is necessary, not conservative programming. The first two clues genuinely cannot distinguish the blocks. The third clue does.

27. Calculate three replacement clues

We now know three clues are enough when all three survive. That alone provides no protection: losing one would leave only two. To tolerate loss, calculate more valid clues than recovery needs, using x = 1 through x = 6.

traceview://reed-solomon/sparesinteractive
Step 27

Store six clues even though recovery needs only three

Following input42[52, 50, 0]
Minimum needed
x=1102stored
x=2152stored
x=3202stored

These three labelled clues are enough to recover a, b and c.

Replacement clues
x=4252stored
x=545stored
x=695stored

These use new x labels, so they can replace any missing clues above.

Where we are

Three valid clues are the minimum for recovery, but storing only the minimum would fail as soon as one disappeared.

Question this step answers

How can the block survive three known losses without changing what recovery needs?

What we did

The same three source values produced six differently labelled clues.

Why this solves the problem

Each extra x label creates another valid equation about the whole block, not a copy tied to one source position. Recovery can use any three, so storing six allows any three known clues to disappear.

What this enables next

Erase shards and watch three survivors rebuild the source values.

Separate the three clues required for recovery from three differently labelled replacements.

The first three are not special. Recovery accepts any three with different labels. Six is a policy choice:

  • 3 originals and 5 clues tolerate 2 missing clues;
  • 3 originals and 6 clues tolerate 3 missing clues;
  • 3 originals and 7 clues tolerate 4 missing clues.

Why are the extras mixtures instead of copies? Because any three differently labelled mixtures can replace any missing three. A copied source position would help only when that particular source value was lost. Each extra clue costs storage but increases the number of known losses the whole block can survive.

28. Arrange matching labels into shards

A longer input contains several separate three-number blocks. Each block produces six answers, but a storage system needs six coherent pieces it can place on separate drives or send along separate routes. We therefore organise answers by their shared x label.

traceview://reed-solomon/shardlayoutinteractive
Step 28

Collect matching x labels into shards

source block 1[52, 50, 0]
shard x=1102block 1
shard x=2152block 1
shard x=3202block 1
shard x=4252block 1
shard x=545block 1
shard x=695block 1
Where we are

Every source block has produced six answers, but those answers still need to be arranged into six independently losable storage pieces.

Question this step answers

How should answers from many blocks be grouped so one lost device removes only one clue from each block?

What we did

Every answer made with x=1 goes into shard x=1, every answer made with x=2 goes into shard x=2, and the same pattern continues through x=6.

Why this solves the problem

Grouping by x spreads every block across all six shards. If each block's six answers stayed together, one loss could erase a whole block; this layout makes one shard loss remove exactly one labelled equation per block.

What this enables next

Erase whole shards and count the clues that remain for each block.

Collect every x=1 answer together, every x=2 answer together, and continue through x=6.

A shard is the collection of answers that share one x label:

  • shard x = 1 contains the x = 1 answer from every block;
  • shard x = 2 contains the x = 2 answer from every block;
  • the same pattern continues through x = 6.

Why group by label rather than keep each block together? If one stored piece contained all six clues for a particular source block, losing it would erase that block completely. Grouping one answer from every block into each shard spreads every block across all six storage pieces. Losing one whole shard then removes exactly one correctly labelled clue from every block, leaving the other labels available everywhere.

29. Erase three shards

The code has been designed to tolerate three known losses. Erase three whole shards now so the recovery walkthrough starts from the exact failure the design claims to survive, rather than quietly keeping the originals nearby.

traceview://reed-solomon/lossinteractive
Step 29

Erase shards without doing any recovery yet

Click a shard to mark it missing. Watch only the survivor count for now.

surviving clues3 / 3 needed
Where we are

Six shards now distribute every block, and the design claims that any three may disappear.

Question this step answers

After realistic whole-shard losses, does every block still retain the minimum three different equations?

What we did

3 shards are missing; 3 remain.

Why this solves the problem

A whole-shard loss removes one label from every block. Three survivors leave the three differently weighted equations proved sufficient earlier; two survivors recreate the ambiguity demonstrated in Step 26.

What this enables next

Turn the surviving labelled clues into equations.

Erase and restore shards while counting the clues left for every block.

Why erase whole shards rather than three isolated numbers? Real storage failures usually remove an entire device or packet, affecting every block it carried. Each block started with six clues; losing three shards leaves three differently labelled clues for each block. Steps 15–16 proved that any three identify only one block. Losing a fourth shard would leave only two clues per block and reintroduce the ambiguity shown in Step 26.

Decode one block by hand

We have finished encoding and deliberately removed three shards. The remaining task is to turn three labelled totals back into the three source positions.

The real byte values make a paper example needlessly awkward without changing the method. Use the small block [4, 2, 3] in the 17-position rehearsal instead. Its rule is:

p(x) = 4 + 2x + 3x² mod 17

Calculate the three surviving clues:

  • at x = 1: 4 + 2×1 + 3×1² = 4 + 2 + 3 = 9, so store (1, 9);
  • at x = 2: 4 + 2×2 + 3×2² = 4 + 4 + 12 = 20, and 20 mod 17 = 3, so store (2, 3);
  • at x = 3: 4 + 2×3 + 3×3² = 4 + 6 + 27 = 37, and 37 mod 17 = 3, so store (3, 3).

The repeated answer y = 3 is safe because its labels differ. (2,3) and (3,3) describe different equations.

Why switch examples? The purpose of this section is to expose every recovery operation, not to practise large multiplication. The smaller field makes negative values, wrapping and inverses visible on paper. The full automatic component later runs the same structure on the user's real bytes in the 257-position field.

Pretend only those three clues survived. We will now recover [4, 2, 3] while treating its values as unknown.

30. Turn each surviving clue into an equation

The pair (1, 9) says “putting x = 1 into the lost rule produced 9”:

a + b + c = 9

The pair (2, 3) says:

a + 2b + 4c = 3

The pair (3, 3) says:

a + 3b + 9c = 3

traceview://reed-solomon/handsetupinteractive
Step 30 · paper rehearsal

Turn three surviving clues into three equations

Small numbers chosen for hand calculation[4, 2, 3]p(x) = 4 + 2x + 3x² mod 17
Three surviving clues(1, 9)(2, 3)(3, 3)
(1, 9)a + b + c = 9
(2, 3)a + 2b + 4c = 3
(3, 3)a + 3b + 9c = 3
Where we are

The original block is unavailable. Only three stored (x, y) pairs remain.

Question this step answers

How do the compact survivor records become statements about the three missing positions?

What we did

The three labelled clues now say exactly which weighted totals the lost values must reproduce.

Why this solves the problem

We are pretending a, b and c are unknown. Each (x, y) pair becomes one true sentence about them by replacing x and p(x) with the stored numbers.

What this enables next

Subtract the first equation from the second so the matching a terms cancel.

Write the three surviving labelled clues as three equations without skipping the substitution.

Why turn pairs into equations? The stored pairs are not the source bytes; each is a combined total plus the label describing how it was made. Substitution expands that compact record back into a true statement about the missing positions. It turns the vague task “recover the data” into a concrete one: find a, b and c that make all three surviving statements true.

Why use all three now? Each equation still contains all three unknowns. No single one identifies the block. Their value comes from being solved together.

31. Subtract Equation 1 from Equation 2

Write Equation 2 minus Equation 1:

(a + 2b + 4c) − (a + b + c) = 3 − 9

traceview://reed-solomon/handfirstdifferenceinteractive
Step 31 · paper rehearsal

Subtract Equation 1 from Equation 2

Small numbers chosen for hand calculation[4, 2, 3]p(x) = 4 + 2x + 3x² mod 17

Equation 2 minus equation 1

(a + 2b + 4c) − (a + b + c) = 39
a − abecomes0
2b − bbecomesb
4c − cbecomes3c
39becomes-6
b + 3c = -6
Where we are

All three recreated equations still contain a, b and c, so none can identify a value alone.

Question this step answers

Which operation removes one unknown by exploiting a term that matches in both equations?

What we did

Matching terms give a−a=0, 2b−b=b, 4c−c=3c and 3−9=-6.

Why this solves the problem

Both equations contain exactly one a. Subtracting the same-position terms gives a − a = 0, so one unknown disappears without guessing its value.

What this enables next

Convert the negative right-hand answer to its equivalent position in the 17-value loop.

Subtract every matching term and stop before wrapping the negative answer.

Term by term:

  • a − a = 0;
  • 2b − b = b;
  • 4c − c = 3c;
  • 3 − 9 = -6.

The raw result is:

b + 3c = -6

Why this pair, in this order? Any two equations could be combined, but Equations 1 and 2 have small weights and both contain exactly one a. Computing Equation 2 minus Equation 1 creates a−a=0 and removes one unknown without guessing. Reversing the order would also work, but it would negate every remaining term.

32. Wrap -6 to 11

The field uses representatives from 0 to 16. Add one complete lap of 17:

-6 + 17 = 11

traceview://reed-solomon/handfirstwrapinteractive
Step 32 · paper rehearsal

Wrap −6 to the equivalent field value 11

Small numbers chosen for hand calculation[4, 2, 3]p(x) = 4 + 2x + 3x² mod 17

Move the negative value one complete lap

-6 + 17 = 11
b + 3c = 11
Where we are

The first subtraction removed a but produced −6, outside the standard 0–16 representatives used by this field.

Question this step answers

Which in-range value represents the same position as −6 without changing the equation?

What we did

-6 + 17 = 11, so b + 3c = 11.

Why this solves the problem

Values that differ by a complete lap of 17 represent the same field value. Adding 17 changes the written representative from −6 to 11 without changing the equation inside this number system.

What this enables next

Make a second equation without a by subtracting Equation 2 from Equation 3.

Add one complete lap and show that the equation now uses 11.

Therefore:

b + 3c = 11

Why wrap at this point? -6 is mathematically usable, but every later lookup and inverse in this toy is written using the standard representatives 0–16. Converting now keeps every equation in the same number system and makes later comparisons direct.

Why is adding 17 allowed? In mod 17, numbers separated by a whole lap represent the same position. -6, 11, and 28 all name the same field value. We changed its written representative, not the information in the equation.

33. Subtract Equation 2 from Equation 3

Write:

(a + 3b + 9c) − (a + 2b + 4c) = 3 − 3

traceview://reed-solomon/handseconddifferenceinteractive
Step 33 · paper rehearsal

Subtract Equation 2 from Equation 3

Small numbers chosen for hand calculation[4, 2, 3]p(x) = 4 + 2x + 3x² mod 17

Equation 3 minus equation 2

(a + 3b + 9c) − (a + 2b + 4c) = 33
a − abecomes0
3b − 2bbecomesb
9c − 4cbecomes5c
33becomes0
b + 5c = 0
Where we are

One equation without a still contains both b and c, so many pairs can satisfy it.

Question this step answers

How do we obtain a second, differently weighted relationship between b and c?

What we did

a−a=0, 3b−2b=b, 9c−4c=5c and 3−3=0, giving b + 5c = 0.

Why this solves the problem

After the first subtraction, b and c were both still unknown. This second subtraction gives another equation containing those same two unknowns, which is necessary before either can be isolated.

What this enables next

Subtract the first reduced equation from the second so b cancels.

Make a second equation without a and show every term subtraction.

Term by term:

  • a − a = 0;
  • 3b − 2b = b;
  • 9c − 4c = 5c;
  • 3 − 3 = 0.

The result is:

b + 5c = 0

Why repeat almost the same subtraction? The first reduced equation still contains two unknowns, b and c; many pairs can satisfy it. We need a second, differently weighted relationship between those same two unknowns. Using adjacent original equations removes a again and keeps the remaining numbers small.

34. Subtract the reduced equations to remove b

We now have:

b + 3c = 11

b + 5c = 0

Subtract the first from the second.

traceview://reed-solomon/handisolatecinteractive
Step 34 · paper rehearsal

Subtract the reduced equations to remove b

Small numbers chosen for hand calculation[4, 2, 3]p(x) = 4 + 2x + 3x² mod 17

Second reduced equation minus the first

(b + 5c) − (b + 3c) = 011
b − bbecomes0
5c − 3cbecomes2c
011becomes-11
2c = -11
Where we are

We now have two equations containing b and c, and both contain exactly one b.

Question this step answers

How can the matching b terms be cancelled so only c remains unknown?

What we did

b−b=0, 5c−3c=2c and 0−11=-11, giving 2c = -11.

Why this solves the problem

Both reduced equations contain exactly one b. Subtracting matching terms deliberately creates b−b=0, leaving c as the only unknown.

What this enables next

Wrap the negative right-hand answer into the 0–16 range.

Subtract the two reduced equations and stop before wrapping.

Term by term:

  • b − b = 0;
  • 5c − 3c = 2c;
  • 0 − 11 = -11.

The raw result is:

2c = -11

Why subtract again? The two reduced equations were deliberately constructed with the same amount of b: one copy each. Subtraction turns b−b into zero. This is not a generic instruction to keep subtracting; it is a targeted operation chosen because the terms we want to remove match exactly.

35. Wrap -11 to 6

Add one complete lap of 17:

-11 + 17 = 6

traceview://reed-solomon/handsecondwrapinteractive
Step 35 · paper rehearsal

Wrap −11 to the equivalent field value 6

Small numbers chosen for hand calculation[4, 2, 3]p(x) = 4 + 2x + 3x² mod 17

Move the negative value one complete lap

-11 + 17 = 6
2c = 6
Where we are

The subtraction isolated c as 2c=−11, but −11 is outside the field’s standard written range.

Question this step answers

Which 0–16 representative preserves the same wrapped value before we undo ×2?

What we did

-11 + 17 = 6, so 2c = 6.

Why this solves the problem

Adding one complete lap of 17 changes −11 into the allowed representative 6. Both numbers occupy the same position in modular arithmetic.

What this enables next

Find the field operation that undoes multiplication by 2.

Move -11 into the 0–16 range without changing its field value.

Therefore:

2c = 6

Why is this another separate step? The subtraction isolated c, but its right-hand side is outside the agreed 0–16 representation. Wrapping restores the standard field value before we search for an operation that undoes the remaining ×2.

36. Find the operation that undoes ×2

In ordinary arithmetic we would divide both sides by 2. Inside the 17-position loop, division means multiplying by the number that undoes ×2.

That number is 9 because:

2 × 9 = 18

18 mod 17 = 1

traceview://reed-solomon/handfindinverseinteractive
Step 36 · paper rehearsal

Find the multiplier that undoes ×2

Small numbers chosen for hand calculation[4, 2, 3]p(x) = 4 + 2x + 3x² mod 17

Find the undo for ×2

1 mod 1722 mod 1743 mod 1764 mod 1785 mod 17106 mod 17127 mod 17148 mod 17169 mod 171
2 × 9 = 18wrap mod 171
×9 is the field version of ÷2
Where we are

Only c remains unknown, but it is still multiplied by 2 inside modular arithmetic.

Question this step answers

What field operation plays the role of dividing both sides by 2?

What we did

2 × 9 = 18, and 18 mod 17 = 1, so ×9 undoes ×2.

Why this solves the problem

Ordinary division is replaced by multiplication by an inverse. We search for a number that turns the unwanted number multiplying c from 2 into 1 after wrapping.

What this enables next

Multiply both sides of 2c = 6 by 9.

Search for the multiplier that turns 2 into 1 after wrapping.

We find it by testing the allowed non-zero values. Multiplying 2 by 1 through 8 gives the remainders 2, 4, 6, 8, 10, 12, 14 and 16. None is 1. Multiplying by 9 gives 18, which wraps to 1.

Why can we not use ordinary 6 ÷ 2 = 3 and move on? That happens to produce the same answer in this example, but ordinary division is not defined for every wrapped intermediate in the way we need. The decoder requires one rule that remains inside the field and works for every non-zero multiplier. Multiplying by the field inverse is that rule.

The number 9 is called the multiplicative inverse of 2. Multiplying by it is the field equivalent of dividing by 2 because it changes the number multiplying c from 2 into 1 after wrapping.

37. Multiply both sides by 9 to recover c

Start with:

2c = 6

Multiply both sides by 9:

2c × 9 = 6 × 9

traceview://reed-solomon/handsolvecinteractive
Step 37 · paper rehearsal

Multiply both sides to recover c

Small numbers chosen for hand calculation[4, 2, 3]p(x) = 4 + 2x + 3x² mod 17

Multiply both sides by 9

2c × 9 = 6 × 9
2 × 9 = 18wraps to1
6 × 9 = 54wraps to3
c = 3
Where we are

We know ×9 turns the multiplier 2 into 1 after wrapping.

Question this step answers

How do we remove ×2 from c without breaking the equality?

What we did

2c×9 = 6×9 gives 18c = 54; wrapping both sides gives c = 3.

Why this solves the problem

Applying the same operation to both sides keeps the equation balanced. The left multiplier wraps to 1 and the right answer wraps to 3, so c is isolated.

What this enables next

Replace c with 3 in the first reduced equation.

Multiply both sides, then wrap the two products separately.

On the left:

2 × 9 = 18

18 mod 17 = 1

so 18c becomes 1c. Another way to see it is 18c = 17c + c: the 17c part is a whole number of 17-position laps, leaving only c.

On the right:

6 × 9 = 54

54 = 3×17 + 3

54 mod 17 = 3

Therefore c = 3.

Why multiply both sides? Our goal is to turn 2c into 1c, but changing only the left side would make the equation false. Applying the inverse to both sides preserves equality while removing the unwanted multiplier from c. This is the same balancing rule used in ordinary school equations, with field multiplication replacing division.

38. Substitute c = 3 into the b equation

Return to:

b + 3c = 11

Replace c with the value we just recovered.

b + 3×3 = 11

traceview://reed-solomon/handsubstitutecinteractive
Step 38 · paper rehearsal

Substitute c into the b equation

Small numbers chosen for hand calculation[4, 2, 3]p(x) = 4 + 2x + 3x² mod 17

Replace c with 3

b + 3c = 11
b + 3×3 = 11
Where we are

c=3 is known, while b remains unknown in the reduced equation b+3c=11.

Question this step answers

Which existing equation becomes a one-unknown equation as soon as c is inserted?

What we did

b + 3c = 11 becomes b + 3×3 = 11.

Why this solves the problem

Substitution replaces the solved letter c with its known value. The equation now has only one unknown, b.

What this enables next

Calculate the known multiplication 3×3.

Replace c with 3 without performing the multiplication yet.

Why return to b + 3c = 11? That reduced equation contains only b and c, so inserting the newly known c leaves one unknown immediately. Returning to an original three-unknown equation would also work, but would do unnecessary work.

This is substitution: a solved letter is replaced by its known value. The equation now contains only b.

39. Calculate the known multiplication

3 × 3 = 9

so:

b + 9 = 11

traceview://reed-solomon/handmultiplycinteractive
Step 39 · paper rehearsal

Calculate c’s known contribution

Small numbers chosen for hand calculation[4, 2, 3]p(x) = 4 + 2x + 3x² mod 17

Calculate 3 × 3

3 × 3 = 9
b + 9 = 11
Where we are

Substitution produced b+3×3=11; every part except b can now be calculated.

Question this step answers

What known amount is being added beside b?

What we did

3 × 3 = 9, so the equation becomes b + 9 = 11.

Why this solves the problem

Evaluating 3×3 turns the equation into b+9=11 and exposes the single operation beside b. Nothing changes sides and no value is guessed; one completed multiplication is merely simplified.

What this enables next

Subtract 9 from both sides to undo the +9 beside b.

Calculate 3×3 and leave the balancing step for the next section.

Why calculate 3×3 before moving anything? The term is now entirely known, so reducing it to 9 makes the remaining equation's structure visible: an unknown b plus a known 9 equals 11. We have not changed sides or guessed; we have only evaluated a completed multiplication.

40. Subtract 9 from both sides to recover b

b + 9 − 9 = 11 − 9

traceview://reed-solomon/handsolvebinteractive
Step 40 · paper rehearsal

Subtract 9 from both sides to recover b

Small numbers chosen for hand calculation[4, 2, 3]p(x) = 4 + 2x + 3x² mod 17

Subtract 9 from both sides

b + 9 − 9 = 11 − 9
+9 − 9cancels to0
11 − 9becomes2
b = 2
Where we are

The equation is b+9=11, so one known addition still prevents b from standing alone.

Question this step answers

Which balanced operation exactly undoes the +9 beside b?

What we did

b + 9 − 9 = 11 − 9, so b = 2.

Why this solves the problem

Subtracting the same value from both sides preserves equality. On the left, +9 and −9 cancel; on the right, 11−9 equals 2.

What this enables next

Replace b and c in the first original equation.

Subtract the same 9 from both sides and show both cancellations.

On the left, +9−9=0. On the right, 11−9=2. Therefore:

b = 2

Why subtract 9? The operation immediately beside b is +9, so its inverse operation is −9. Applying it to both sides preserves equality. Choosing a different number would not cancel the known term; subtracting only on the left would break the equation.

41. Substitute b and c into the first equation

Return to:

a + b + c = 9

Replace b with 2 and c with 3:

a + 2 + 3 = 9

traceview://reed-solomon/handsubstitutebcinteractive
Step 41 · paper rehearsal

Substitute b and c into the a equation

Small numbers chosen for hand calculation[4, 2, 3]p(x) = 4 + 2x + 3x² mod 17

Replace b and c with their recovered values

a + b + c = 9
a + 2 + 3 = 9
Where we are

b=2 and c=3 are known; only the first source position a is still missing.

Question this step answers

Which surviving equation reveals a with the least remaining arithmetic?

What we did

a + b + c = 9 becomes a + 2 + 3 = 9.

Why this solves the problem

Both solved letters are replaced by their recovered values. Only a remains unknown.

What this enables next

Add the two known values beside a.

Replace both solved letters without combining their values yet.

Why go back to the first equation? We have recovered b and c, and any original clue could now reveal a. The first has the smallest weights—one copy of each value—so it requires the least arithmetic. Substitution turns the stored clue back into an equation with only a unknown.

42. Add the known terms beside a

2 + 3 = 5

so:

a + 5 = 9

traceview://reed-solomon/handaddknowninteractive
Step 42 · paper rehearsal

Add the known values beside a

Small numbers chosen for hand calculation[4, 2, 3]p(x) = 4 + 2x + 3x² mod 17

Add the known terms

2 + 3 = 5
a + 5 = 9
Where we are

The first clue now reads a+2+3=9.

Question this step answers

What single known amount must eventually be removed from beside a?

What we did

2 + 3 = 5, so a + 5 = 9.

Why this solves the problem

Both numbers are known contributions on the same side. Replacing them with their sum changes no relationship; it exposes the one +5 operation that must be undone to isolate a.

What this enables next

Subtract 5 from both sides to isolate a.

Combine 2 and 3 while leaving a untouched.

Why combine 2 and 3? Both are now known contributions on the same side. Replacing them with their sum does not move anything or alter the equation; it exposes the single operation, +5, that still needs to be undone to isolate a.

43. Subtract 5 from both sides to recover a

a + 5 − 5 = 9 − 5

traceview://reed-solomon/handsolveainteractive
Step 43 · paper rehearsal

Subtract 5 from both sides to recover a

Small numbers chosen for hand calculation[4, 2, 3]p(x) = 4 + 2x + 3x² mod 17

Subtract 5 from both sides

a + 5 − 5 = 9 − 5
+5 − 5cancels to0
9 − 5becomes4
a = 4
Where we are

The equation is a+5=9, and a is the only unknown left anywhere in the block.

Question this step answers

Which balanced operation removes the final known term beside a?

What we did

a + 5 − 5 = 9 − 5, so a = 4.

Why this solves the problem

The same subtraction keeps both sides equal. +5 and −5 cancel on the left, while 9−5 gives 4 on the right.

What this enables next

Re-encode [4, 2, 3] and compare every answer with the surviving clues.

Subtract the same 5 from both sides and isolate a.

On the left, +5−5=0. On the right, 9−5=4. Therefore:

a = 4

The recovered block is [a,b,c] = [4,2,3].

Why does this finish recovery? a was the only remaining unknown. Subtracting the known +5 from both sides preserves equality and leaves its unique value. We now have values for all three original positions, in their original order.

44. Re-encode the result to check it

Solving several equations by hand creates opportunities for a sign, multiplication or wrapping mistake. Before trusting the candidate block, put [4, 2, 3] through the encoder again at x = 1, 2 and 3. It reproduces 9, 3 and 3, so the recovered block satisfies every clue we received.

traceview://reed-solomon/handcheckinteractive
Step 44 · paper rehearsal

Re-encode the recovered block as a check

Small numbers chosen for hand calculation[4, 2, 3]p(x) = 4 + 2x + 3x² mod 17

Run [4, 2, 3] through all three labels again

check x=14 + 2×1 + 3×1²

= 9; 9 mod 17 = 9 · stored y was 9

check x=24 + 2×2 + 3×2²

= 20; 20 mod 17 = 3 · stored y was 3

check x=34 + 2×3 + 3×3²

= 37; 37 mod 17 = 3 · stored y was 3

Where we are

Equation solving produced the candidate block [4, 2, 3], but hand arithmetic may contain mistakes.

Question this step answers

Does this candidate reproduce every surviving clue under the original mixer?

What we did

The recovered block is [4, 2, 3]. It reproduces y=9, 3 and 3 at x=1, 2 and 3.

Why this solves the problem

Solving the equations produced a candidate block. Running it through the original mixer verifies that it satisfies every clue instead of merely looking plausible.

What this enables next

Apply the same recovery to every block, remove only recorded padding, and decode the UTF-8 bytes.

Calculate all three clue answers again and compare them with the stored values.

Why does matching the clues matter? The decoder's contract is not “produce three plausible numbers”; it is “produce the unique block described by every survivor”. Re-encoding checks that contract. The uniqueness proof in Steps 15–16 tells us that another different block cannot also pass.

This hand method is equation elimination. Software can rearrange and precompute parts of the same algebra for speed, but it is still solving the same problem.

45. Remove padding and decode the bytes as text

The algebra has recovered numbered block positions, not yet the user's text. Recover every three-number block and join their values in the original order. Then keep exactly the recorded number of real bytes from Step 3; do not guess which zeros are padding.

traceview://reed-solomon/decodeblockinteractive
Step 45

Turn the recovered numbers back into text

Recovered three slots[52, 50, 0]

These match the numbers placed in a, b and c earlier.

Remove end padding[52, 50]

Keep the recorded number of real bytes rather than guessing from their values.

UTF-8 lookup backwards42

The same number table from Step 2 returns the original characters.

Where we are

Recovery has rebuilt numbered block positions, but the user supplied text rather than a padded list of numbers.

Question this step answers

In what order must the original packaging steps be reversed to recover the exact text?

What we did

The first block [52, 50, 0] decodes to “42”.

Why this solves the problem

We join recovered blocks in order, keep exactly the saved number of real bytes, then reverse UTF-8. Guessing from zero values could remove real data; decoding before removing padding could introduce an extra character.

What this enables next

The complete input has now made the full round trip.

Use the recorded length to remove packaging positions, then decode the UTF-8 bytes.

Why reverse these preparation steps in this order? Encoding first converted text to bytes, recorded the length, and then added padding and blocks. Decoding must undo that packaging in reverse: rebuild blocks, restore byte order, remove positions beyond the saved length, then reverse UTF-8. Decoding UTF-8 before removing padding could introduce an extra null character; stripping every zero could delete real data.

Finally, run the remaining bytes through the UTF-8 decoder. [52,50] returns 42.

46. Distinguish a missing shard from a wrong shard

Everything so far assumed an erasure: we knew exactly which shard was unavailable. A real system may instead receive an error, where a shard supplies a wrong value and pretends it is valid. These are different recovery problems and consume different spare capacity.

traceview://reed-solomon/capacityinteractive
Step 46

Choose the protection you are paying for

datadatadataextraextraextra
Known missing locations3 erasures

Any 3 of the 6 correct stored values are enough.

Unknown bad locations1 errors

Finding which stored values lied costs roughly twice as much protection.

Where we are

The walkthrough recovered from known missing shards, but a storage system can also receive a wrong value whose location is unknown.

Question this step answers

Why does correcting one hidden error consume more spare information than replacing one known erasure?

What we did

The 3 extra stored clues let any 3 known missing shards disappear while 3 useful clues remain.

Why this solves the problem

A known erasure asks only what value is missing. A hidden error adds a second question—where is the lie?—so the spare clues must identify the bad position before they can reconstruct its value.

What this enables next

Real systems use checksums to identify a bad shard, then treat it as missing.

Change the number of original and extra stored values to compare erasure and error protection.

Why does one hidden error cost roughly as much as two known erasures? With an erasure, the location is already supplied; the decoder solves only for the missing value. With an error, it must solve two unknown facts: which position is wrong and what value belongs there. The extra clues must identify the liar before they can replace it. That is why correcting one unknown error generally costs the same spare capacity as tolerating two known erasures.

The complete automatic run

The separate lessons deliberately froze one question at a time. The final workbench now reconnects them so the reader can see where each intermediate value goes and why the next operation receives it.

It has 38 stages because substitution, multiplication, wrapping, cancellation and balancing remain separate operations. Each stage stays visible for five seconds. Pause it or choose a numbered stage when you want more time.

traceview://reed-solomon/pipelineinteractive
Final workbench

Send your own value through the whole journey

input · step 1 of 38

Choose the exact text to protect

Original input42

Nothing has been encoded yet. This is the value every later step must preserve.

Why this step exists

Recovery needs an exact success condition. This input is recorded before any transformation so the final output can be compared character for character.

Where we are

The detailed lessons have been connected into one automatic encoding-and-recovery run.

Question this step answers

Can every intermediate value be followed from the user's input to the same recovered output?

What we did

Stage 1 is showing one operation only. The next stage appears after five seconds.

Why this solves the problem

Encoding and recovery are the same small ideas from the earlier toys, repeated once for every three-byte block.

What this enables next

Separate the text into characters

Enter your own text, encode it into six shards, erase three, then recover the original value step by step.

Why repeat the whole run? Understanding each operation separately is not the same as understanding the pipeline. The combined view shows that no unexplained value enters and no required information disappears: the user's text becomes bytes, blocks, labelled clues, survivors, equations, recovered bytes and finally the same text.

This remains an educational code rather than a production storage format. Real implementations use byte-sized fields, fast arithmetic, many blocks and metadata that identifies every shard. The useful mental model stays the same: turn three source numbers into more than three labelled clues, then use any three surviving clues to rebuild the source numbers.

Sources