Code that can be generated from 3 of 5 trusted people? Suppose a computer contains sensitive data protected by a 3-digit passcode. (I understand this does not provide much security in the real world, but for the sake of the problem, assume only 3 digits.) In order to prevent anyone from single-handedly having the ability to access the data, the passcode is divided into 5 pieces $n_{1}, n_{2}, n_{3}, n_{4}, n_{5} \in \{0, 1, 2, ..., 999\}$ and distributed among 5 trusted people.
If the majority of the trusted people agree to unlock the data, the passcode can be generated from 3 or more of the 5 parts. However, 2 or fewer of the trusted members cannot determine the passcode.
I do not understand how to formulate such an encoding scheme. I tried some approaches using polynomials and linear algebra, but I got hung up on the part about only needing any 3 of the 5 pieces.
 A: Pick two random numbers $r_1$ and $r_2$ and let $P(x) = r_2x^2 + r_1 x + S$ where $S$  is the passcode.  For each person, pick a random $x_i\ne 0$ and give this person the pair $\langle x_i, P(x_i)\rangle$.
Any three people can get together and use Lagrange interpolation to find the unique $P$ that passes through all their three points.  They can then compute $P(0)$ to find the passcode.  (To do this, just solve the system of three linear equations $r_2x_i^2+r_1x_i +S = 0$ for the three unknowns $r_1, r_2, S$.)
However, with two people, there is an infinite family of 2nd-degree polynomials passing through their points  $\langle x_i, P(x_i)\rangle$ and  $\langle x_j, P(x_j)\rangle$, including one passing through $\langle 0, S'\rangle$ for every $S'$, so they learn nothing.
(Consider the analogous situation where we want two people instead of three to be able to get the passcode.  We pick a line $r_1x+S$ and give each person one point on the line, which by itself is useless.  But two people together have two points, which determines the line, and its $y$-intercept.)
