From A First Course in Linear Algebra
Version 1.08
© 2004.
Licensed under the GNU Free Documentation License.
http://linear.ups.edu/
This Section is a Draft, Subject to Changes
In this section we will see how to use solutions to systems of equations to share a secret among a group of people. We will be able to break a secret up into, say 10 pieces, so as to distribute the secret among 10 people. But rather than requiring all 10 people to collaborate on restoring the secret, we can design the split so that any smaller group, of say just 4 of these people, can collaborate and restore the secret. The numbers 10 and 4 here are arbitrary, we can choose them to be anything.
Suppose we have a secret, $S$. This could be the combination to a lock, a password on an account, or a recipe for chocolate chip cookies. If the secret is text, we will assume that the characters have been translated into integers (say with the ASCII code), and these numbers have been rolled up into one grand positive integer (perhaps by concatenating binary strings for the ASCII code numbers, and interpreting the longer string as one big base 2 integer). So we will assume $S$ is some positive integer.
Suppose you wish to give parts of your secret to $n$ people, and you wish to require that any group of $m$ (or more) of these people should be able to combine their parts and recover the secret. Perhaps you are President and CEO of a small company and only you know the password that authorizes large transfers of money among the company’s bank accounts. If you were to die or become incapacitated, it would perhaps hamper the company’s ability to function if they couldn’t quickly rearrange their assets, especially since they are also without a CEO. So you might wish to give this secret to six of your trusted VicePresidents. But you don’t trust them that much and you certainly don’t want any one of these people to be able to access the company’s accounts all by themselves without anybosy else in the company knowing about it. Simultaneously, you know that in an emergency, it might not be possible to get all six VicePresidents together and maybe even one or two of them have met the same unfortunate fate you did. So you would like any group of three VicePresidents to be able to combine their parts and recover $S$. So you would choose $n=6$ and $m=3$.
We will describe the split, with no motivation. The explanation of how the secret recovery is handled will explain our choices here. Choose a large prime number, $p$, bigger than any possible secret. For a single number in a combination lock, $p$ could be small. For a onepage recipe, $p$ would need to be huge. All of our subsequent arithmetic will be modulo $p$, so consult Subsection F.FF for a brief description of how we do linear algebra when our field is ${\mathbb{Z}}_{p}$. Build a polynomial, $r\left(x\right)$, of degree $m1$ as follows. Set the constant term to $S$, and choose the other $m$ coefficients at random from ${\mathbb{Z}}_{p}$. The quality of your random generator will ultimately affect the quality of how hidden your secret remains.
Compute the pairs $\left(i,\phantom{\rule{0em}{0ex}}r\left(i\right)\right)$, $1\le i\le n$. To person $i$, of the $n$ persons you will give a part of your secret, present the pair $\left(i,\phantom{\rule{0em}{0ex}}r\left(i\right)\right)$, and instruct them to keep this secret, for all $1\le i\le n$. They could perhaps encrypt their pairs with AES (Advanced Encryption Standard) using a password known only to them individually. Or you could do this for each of them in advance and tell them the chose password orally in private. At any rate, each person gets a pair of integers, an input to the polynomial, and the output of evaluating the polynomial, and they keep this information secret. They do not know the polynomial itself, and certainly not the constant term $S$, so the secret is still safe.
Now suppose that $m$ of these people get together, in the event you are unable to act, or perhaps without your permission. Suppose they pool all of their pairs, or even just turn them over to one member of the group. What do they now know collectively? Suppose that
$$\begin{array}{lll}\hfill r\left(x\right)={a}_{0}+{a}_{1}x+{a}_{2}{x}^{2}+\cdots +{a}_{m1}{x}^{m1}& \phantom{\rule{2em}{0ex}}& \hfill \end{array}$$where, of course, ${a}_{0}=S$ is the secret. A single pair, $\left(i,\phantom{\rule{0em}{0ex}}r\left(i\right)\right)$, results in a linear equation whose unknowns are the $m$ coefficients of $r\left(x\right)$. With $m$ pairs revealed, we now have $m$ equations in $m$ variables. Furthermore, the coefficent matrix of this system is a Vandermonde matrix (Definition VM). With our inputs to the polynomial all different (we used $1,\phantom{\rule{0em}{0ex}}2,\phantom{\rule{0em}{0ex}}3,\phantom{\rule{0em}{0ex}}\dots ,\phantom{\rule{0em}{0ex}}n$), the Vandermonde matrix is nonsingular (Theorem NVM). Thus by Theorem NMUS there is a unique solution for the coefficients of $r\left(x\right)$. We only desire the constant term — the other coefficients (the randomly chosen ones) are of no interest, they were used to mask the secret as it was split into parts.
A few practical considerations. If certain individuals in your group are more important, or more trustworthy, you can give them more than one part. You could split a secret into 30 parts, giving 5 VicePresidents each 4 parts and give 10 department heads each 1 part. Then you might require 12 parts to be present. This way three VicePresidents could recover the secret, or 4 department heads could standin for a VicePresident. Furthermore, the 10 department heads could not recover the secret without having at least one VicePresident present.
The inputs do not have to be consecutive integers, starting at 1. Any set of different integers will suffice. Why make it any easier for an attacker? Mix it up and choose the inputs randomly as well, just keep them different.
Why do all this arithmetic over ${\mathbb{Z}}_{p}$? If we worked with polynomials having real number coefficients, properties of polynomials as continuous functions might give an attacker the ability to compute the secret with a reasonable amount of computing time. For example, the magnitude of the output is going to dominated by the term of $r\left(x\right)$ having degree $m1$. Suppose an attacker had a few of the pairs, but not a full set of $m$ of them. Or even worse, suppose some group of fewer than $m$ of your trusted acquaintances were to conspire against you. It might be possible to guess a limited range of values for the coeffiecent of the largest term. With a limited range of values here, the next term might fall to a similar analysis. And so on. However, modular arithmetic is in some ways very unpredictable looking and as high powers “wraparound” this sort of analysis will be frustrated. And we know it is no harder to do linear algebra in ${\mathbb{Z}}_{p}$ than in $\u2102$.
OK, here’s a nontrivial example.
Example SS6W
Sharing a secret 6 ways
Let’s return to the CEO and his six VicePresidents. Suppose the
password for the company’s accounts is a sequence of 5 twodigit
numbers, which we will concatenate into a 10digit number, in this case
$S=603725962$. For a prime
$p$ we choose the 11digit
prime number $p=22801761379$. From
the requirement that $m=3$
VicePresidents are needed to recover the secret, we need a seconddegree polynomial
and so need two more coefficients, which we will construct at random between
$1$ and
$p$. The
resulting polynomial is
We will now build six pairs of inputs and outputs, where we will choose the inputs at random (not allowing duplicates) and we do all our arithmetic modulo $p$,
VP  $x$  $r\left(x\right)$

Finance  20220406046  7205699654 
Human Resources  8862377358  17357568951 
Marketing  13747127957  18503158079 
Legal  15835120319  14060705999 
Research  6530855859  5628836054 
Manufacturing  9222703664  2608052019 
The two numbers of each row of the table are then given to the indicated VicePresident. Done. The secret has been split six ways, and any three VP’s can jointly recover the secret.
Let’s test the recovery process, especially since it contains the relevant linear algebra. Suppose we write the unknown polynomial as $r\left(x\right)={a}_{0}+{a}_{1}x+{a}_{2}{x}^{2}$ and the VP’s for Finance, Marketing and Legal all get together to recover the secret. The equations we arrive at are,
$$\begin{array}{llllllll}\hfill & \text{Finance}\phantom{\rule{2em}{0ex}}& \hfill 7205699654& =r\left(20220406046\right)\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill & \phantom{\rule{2em}{0ex}}& \hfill & ={a}_{0}+{a}_{1}\left(20220406046\right)+{a}_{2}{\left(20220406046\right)}^{2}\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill & \phantom{\rule{2em}{0ex}}& \hfill & ={a}_{0}+20220406046{a}_{1}+7793596215{a}_{2}\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill & \text{Marketing}\phantom{\rule{2em}{0ex}}& \hfill 18503158079& =r\left(13747127957\right)\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill & \phantom{\rule{2em}{0ex}}& \hfill & ={a}_{0}+{a}_{1}\left(13747127957\right)+{a}_{2}{\left(13747127957\right)}^{2}\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill & \phantom{\rule{2em}{0ex}}& \hfill & ={a}_{0}+13747127957{a}_{1}+18840301370{a}_{2}\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill & \text{Legal}\phantom{\rule{2em}{0ex}}& \hfill 14060705999& =r\left(15835120319\right)\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill & \phantom{\rule{2em}{0ex}}& \hfill & ={a}_{0}+{a}_{1}\left(15835120319\right)+{a}_{2}{\left(15835120319\right)}^{2}\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill & \phantom{\rule{2em}{0ex}}& \hfill & ={a}_{0}+15835120319{a}_{1}+8874412999{a}_{2}\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\end{array}$$So they have a linear system, $\mathcal{\mathcal{L}}\mathcal{S}\phantom{\rule{0em}{0ex}}\left(A,\phantom{\rule{0em}{0ex}}b\right)$ with
$$\begin{array}{llllllll}\hfill A& =\left[\begin{array}{ccc}\hfill 1\hfill & \hfill 20220406046\hfill & \hfill 7793596215\hfill \\ \hfill 1\hfill & \hfill 13747127957\hfill & \hfill 18840301370\hfill \\ \hfill 1\hfill & \hfill 15835120319\hfill & \hfill 8874412999\hfill \end{array}\right]\phantom{\rule{2em}{0ex}}& \hfill b& =\left[\begin{array}{c}\hfill 7205699654\hfill \\ \hfill 18503158079\hfill \\ \hfill 14060705999\hfill \end{array}\right]\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\end{array}$$With a Vandermonde matrix as the coefficient matrix, they know there is a solution, and it is unique. By Theorem SNCM (or through rowreducing the augmented matrix) they arrive at the solution,
$$\begin{array}{llll}\hfill {A}^{1}b& =\left[\begin{array}{ccc}\hfill 5716900879\hfill & \hfill 9234437646\hfill & \hfill 7850422855\hfill \\ \hfill 20952200747\hfill & \hfill 16452595922\hfill & \hfill 8198726089\hfill \\ \hfill 17286943796\hfill & \hfill 18018241597\hfill & \hfill 10298337365\hfill \end{array}\right]\left[\begin{array}{c}\hfill 7205699654\hfill \\ \hfill 18503158079\hfill \\ \hfill 14060705999\hfill \end{array}\right]=\left[\begin{array}{c}\hfill 603725962\hfill \\ \hfill 22561982919\hfill \\ \hfill 8844088338\hfill \end{array}\right]\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\end{array}$$So the CEO’s password is the secret $S={a}_{0}=603725962$ (as expected). $\u22a0$