The Basic Algebra Behind Secret Codes and Space Communication | Quanta Magazine

introduction

space exploration requires tremendous precision. when you’re landing a rover on mars 70 million miles away from the nearest srvc station, you nd'2 maximize efficiency and prepare for the unexpected. this applies to everything from spacecraft design to data transmission: those messages returning to earth as a steady stream of 0s and 1s are bound to contain some errors, so u nd'2 be able to identify and correct them without wasting presh time and energy.

that’s where math comes in. mathematicians ‘ve invented ingenious wys'2 transmit and store information. one surprisingly effective method uses reed-solomon codes, which are built onna same basic algebra that students learn in school. let’s drop in na' math class to see how reed-solomon codes help transmit and secure information while correcting any costly errors that pop up.

two students, art and zeke, are exchanging secret messages in ms. al-jabr’s math class. art unfolds zeke’s l8st note to reveal the №s 57 and 99. he knows he has to supply the x-coordinates 3 and 6 to create the points (3, 57) and (6, 99). art plugs each point inna'da linear equation y = ax + b and produces the folloing system of equations:

57 = 3a + b

99 = 6a + b

to decode the message, art has to solve for a and b. he starts by subtracting the 1st equation from the 2nd:

introduction

this eliminates b. dividing both sides of this new equation by 3 tells art that a = 14, and then substituting this back inna'da 1st equation, 57 = 3 × 14 + b, gives b = 15.

art now knows that the line passing through (3, 57) and (6, 99) is described by the equation y = 14x + 15. but he also knows that in a reed-solomon code, the secret message is hiding inna coefficients. he decodes zeke’s message using their simple agreed-upon α-bet cipher: 14 is “n” and 15 is “o,” which tells art that, no, zeke can’t play video games after school tody.

the secret to this simple reed-solomon code starts with two basic facts of geometry. 1st, through any two points thris a unique line. 2nd, for coefficients a and b, every (non-vertical) line can be written inna form y = ax + b. together, these two facts guarantee that if you know two points na' line you can find a and b, and if you know a and b, you know all the points onna line. in short, possessing either set of information is equivalent to knowing the line.

reed-solomon codes leverage these equivalent sets of information. the secret message is encoded as the coefficients a and b, na line’s points are broken up into pieces, some of which are transmitted publicly, and some of which are kept private. to decode the message, you just collect the pieces and put them back together. and all that this requires is some simple algebra.

zeke’s pieces were the №s 57 and 99, which he sent to art. these №s are the public pt of the message. art put those together w'his own pieces, 3 and 6, to reconstruct the points (3, 57) and (6, 99). here, the 3 na 6 constitute the private pt of the message, which art and zeke agreed upon b4hand.

the two points lie na' line, and to decode the message, you just nd'2 find that line’s equation. plugging each point into y = ax + b gives you a system of two equations bout the line that must both be true. now the strategy is straiteforward: solve the system, determine the line and decode the message.

in algebra class you probably learned many methods of solving systems of equations, s'as graphing, guessing and checking, and substitution. art used elimination, a method where you manipul8 the equations algebraically in order to eliminate the variables one at a time. each time you eliminate a variable, the system becomes a lil easier to solve.

as with other encryption schemes, it’s the clever combination of public and private information that keeps messages secure. zeke ‘d lash out his №s 57 and 99 across the classroom n'it ‘dn’t jeopardize the security of his message to art (though it mite get him in trouble with ms. al-jabr). that’s cause without the corresponding private information — the x-coordinates 3 and 6 — it’s impossible to identify the equation of the line. as long as they keep those vals to themselves, they can safely pass their secret messages in public.

the line y = 14x + 15 is fine for transmitting the two-letter word “no,” but wha’ if the students wanna share a longer secret? here’s where the full power of algebra, geometry, and systems of linear equations comes into play.

suppose zeke wanna know how art thinks he’ll do on 2morro’s english test. art converts his 3-letter answer inna'da №s 14, 59 and 82 and passes those to zeke. the students agreed b4hand that when using reed-solomon codes of length 3, their private №s are 2, 5 and 6, so zeke puts the pieces together to reconstruct the points (2, 14), (5, 59) and (6, 82).

now, thris no linear function that passes through these 3 points. but thris a unique quadratic function that does. and since every quadratic function can be written inna form y = ax2 + bx + c, the same general method can be applied. the 1-ly difference tis size of the system.

plugging each point into y = ax2 + bx + c yields one equation, so the 3 points produce the folloing system of 3 equations:

(2, 14):            14 = 4a + 2b + c

(5, 59):            59 = 25a + 5b + c

(6, 82):            82 = 36a + 6b + c

a system of 3 equations with 3 unknowns requires a lil + work to solve than a system of two equations with two unknowns, but'a goal tis same: cleverly combine pairs of equations to eliminate variables.

for ex, if you subtract the 1st equation from the 2nd, you get the new equation 45 = 21a + 3b. likewise, if you subtract the 2nd equation from the third, you get 23 = 11a + b. these algebraic manipulations produce a new system:

45 = 21a + 3b

23 = 11a + b

now you ‘ve a “two-by-two” system: two equations with two unknowns. to solve it, you can multiply the 2nd equation by −3 and add it to the 1st equation:

introduction

notice how repeated elimination has turned the original system of 3 equations into a single equation that can be easily solved: a = 2. working backward, you can plug a = 2 into 1-odda equations inna two-by-two system to find b = 1, and then plug both vals into 1-odda original equations t'get c = 4. after using the simple α-bet cipher on 2, 1 and 4, zeke knows that art is goin to do “bad” on 2morro’s english test. at least he’s gettin lotso' algebra practice.

thx to a spesh fact bout polynomial functions, you can transmit a message of any length using reed-solomon codes. the key is this: given any n points inna plane with ≠ x-coordinates, thris a unique polynomial of “degree” n − 1 that passes through them. the degree offa polynomial tis highest power offa variable inna expression, so a quadratic function like ax2 + bx + c has degree 2, since the highest power of x is 2. and a linear function has degree 1, since inna equation y = ax + b, the highest power of x is 1.

inna 1st ex we used the fact that two points determine a unique linear, or degree-1, polynomial. inna 2nd, we relied onna fact that 3 points determine a unique degree-2, or quadratic, polynomial. and if you wanna send a message of length 10, just encode the message as the 10 coefficients offa degree-9 polynomial function. once you ‘ve yr function, compute the 10 public y-vals by evaluating the function atta previously agreed-upon 10 private x-vals. once ye do that, you can safely pass those y-coordinates in public for yr receiver to decode. in practice, reed-solomon codes are a bit + complex than this, utilizing + sophisticated kinds of coefficients and translation schemes, but'a primordial idea tis same.

in addition to keeping yr message secure, reed-solomon codes also offer simple and efficient wys'2 catch and even correct errors. this is primordial anytime data is transmitted or stored, as there’s always a chance that somd' information ll'be lost or corrupted.

one solution to this problem ‘d be to simply send extra copies of the data. for ex, zeke can send the message [14, 14, 14, 15, 15, 15] instead of [14, 15]. as long as art knows that every pt of the message is sent in triplicate, he can decode the message and check for errors. in fact, if he finds any errors, he has a good chance of correcting them. if art receives [14, 14, 24, 15, 15, 15], the fact that the 1st 3 №s are ≠ alerts him to an error, and since two o'em are 14, he can guess that the 24 ‘d probably be a 14 swell. instead of asking for the message to be resent, art can carry on w'his decoding. this is an effective but costly strategy. wha’ever time, energy and effort are required to send n pieces of information, this requires 3 times as much.

but'a math behind reed-solomon codes offers an efficient alternative. instead of sending multiple copies of every piece of data, you can just send one extra point! if that additional point fits yr polynomial, then the information is correct. if it doesn’t, there’s been an error.

to see how this works, suppose you wanna check the message “no” inna 1st ex. zeke can just send the additional y-coordinate 155. assuming he and art agreed na' third private x-coordinate b4hand, say x = 10, art can check this third point gainsta line he decoded. when he plugs x = 10 into y = 14x + 15 and sees that the result is 155, he knows there were no errors in transmission.

this doesn’t just work for lines. to enable zeke to check “bad” inna 2nd ex, art can send y = 25. iffey’ve agreed that 3 tis extra private x-coordinate, zeke can plug x = 3 into his quadratic function y = 2x2 + x + 4 and verify that the point (3, 25) fits, again confirming an error-free transmission with just one + point.

and that extra point can potentially correct errors swell. if an error is detected na receiver can’t construct the polynomial function that contains the message, they can instead construct the “best-fit” polynomial using regression tek knicks. like a line of best fit in statistics class, this tis polynomial function that is mathematically determined to most closely fit the given points, even if it doesn’t pass through all o'em. dep'onna structure of the message and how much extra information you send, this best-fit polynomial cannelp you reconstruct the correct polynomial — and thus the correct message — even from corrupt information.

this efficiency in transmitting and correcting communications explains why nasa has used reed-solomon codes on its missions to the moon and to mars. n'it gives you something to ponder as you solve yr nxt system of equations. as you guess, check or eliminate yr way to the solution, think of the power and elegance of reed-solomon codes and all the secrets yr system mite reveal.

exercises

1. using the same scheme they used in class, art posts the public №s 33 and 57 for zeke to decode. wha’’s the message?

2. how can art and zeke be sure that the system of equations that results from their private №s x = 3 and x = 6 will always ‘ve a solution?

3. in response to art’s message of “bad” bout the english test, zeke sends back [90, 387, 534]. assuming they use the same scheme they used in class, wha’’s his message?

4. lola sends you a two-letter message + one error-checking № using a reed-solomon code na same simple α-bet cipher used by art and zeke. you’ve secretly agreed onna x-coordinates 1, 3 and 10 in advance, and lola transmits the public №s [27, 43, 90]. does the message contain an error?

click for answer 1:

using the same x-coordinates as inna initial ex yields the points (3, 33) and (6, 57), and thus the system of equations:

33 = 3a + b

57 = 6a + b

subtracting the 1st equation from the 2nd yields 24 = 3a, so a = 8. plugging a = 8 inna'da 1st equation yields 33 = 24 + b, so b = 9. the simple α-bet cipher transl8s the message as “hi.”

click for answer 2:

by using two distinct x-coordinates to generate their points (x1, y1) and (x2, y2), art and zeke ensure that the system

y1 = ax1 + b

y2 = ax2 + b

will always ‘ve a unique solution that can be found by subtracting the equations. for ex, subtracting the 1st equation from the 2nd will always eliminate the variable b and result in a solution for a:

y2y1 = ax2ax1

y2y1 = a(x2x1)

$l8x a = frac{y_2 – y_1} { x_2 – x_1}$

once you ‘ve a, you can plug it into either of the original equations to find that

$l8x b = y_1 – x_1 (frac{y_2 – y_1} { x_2 – x_1})$

this will always work, as long as you don’t divide by zero, so x1 and x2 must be ≠ №s. this is a 1st step in showing that the larger systems of equations will always ‘ve a unique solution swell.

click for answer 3:

the 3 points lead to the folloing system of equations:

(2, 90)                          90 = 4a + 2b + c

(5, 387)                        387 = 25a + 5b + c

(6, 534)                        534 = 36a + 6b + c

solving the system of equations yields a = 12, b = 15, and c = 12, or “lol” after translation through the simple α-bet cipher.

click for answer 4:

yes. the 1st two points are (1, 27) and (3, 43). the system of equations

27 = a + b

43 = 3a + b

has the solution a = 8 and b = 19, producing the line y = 8x + 19 na secret message “hn.” but notice that the third point doesn’t fit the line, since 8 × 10 + 19 =s 99, not 90. the additional point has revealed an error.

to correct the error, run a linear regression onna points (1, 27), (3, 43) and (10, 90). this yields a line witha slope very close to 7, which suggests that a = 7. using this val of a, you can find b to be 20, na message can be properly decoded as “go.”

original content at: www.quantamagazine.org…
authors: patrick honner

Share: