Polynomials
"I learned this in 4th grade", you say, "and I already know how to do Taylor approximations and binomial expansions and get local minima... what else is there to do?" (At least that was my first thought )
😛
Turns out, polynomials are super useful in the world of discrete math. Here, we'll cover two applications in discrete space, which are secret sharing and error correction.
Gotta do some quick review first! Recall that all polynomials are in the form
where
is the degree of the polynomial (highest power) and
are the coefficients.
Polynomials have some nice properties:
- A nonzero polynomial of degreehas at mostreal roots.
- If we're givendistinct points (x y pairs), there is exactly one, unique polynomial of degreethat goes through all of those points.
Like many things in discrete math, polynomials can be taken to a modulo as well! When this happens and we have
where
is a polynomial and
is a prime number, we say that we're working in a Galois Field
.
Even when working over a finite field, the two properties of polynomials still apply. Finite fields restrict the number of possible polynomials, which is actually necessary for some of the applications below.
We have already established that
points only have one unique degree
polynomial that goes through all of them. But how do we find this one polynomial?
Lagrange Interpolation is a method to recover this polynomial given your original points. It has a lot of interesting ties to previously covered concepts like the Chinese Remainder Theorem and linear algebra (which won't be covered here, but explore it further to find out more!). Here's how it works:
First, let's find a polynomial that is degree
and is equal to
at point
, but
everywhere else. This isn't too hard to do: we can use
. Note here that we skipped
because adding that term would make the polynomial degree
! However, this alone would result in a number other than 1 at
, so we can normalize it by dividing by all
:
Why are we doing this though? Well, you can think of it like creating a basis of polynomials so that we can take a linear combination of all of them to get the original. Since
, we can multiply it by
to ensure that it passes through the original point. Combining all of the delta polynomials for all
original points yields
Now, let's take a look at a cool application of Lagrange interpolation!
Here's the setup: let's say you're in the Super Secret Club and want to create a secret code for your Super Secret Vault™. However, you want to make sure that the Vault™ can only be opened if 30 of your 50 members agree. How would we pull this off?
Here's the solution: create a 29-degree polynomial and give each person in the club a point on that polynomial
. Make sure none of the x's are 0! Then, set the secret code equal to
, the y-value of the polynomial corresponding to
.
We know that a 29-degree unique polynomial can be recovered with 30 distinct points. So, if 30 members agree and get together to share their points, we can use Lagrange interpolation to recover the original polynomial! Once you have this original polynomial, it is a simple matter to recover the secret code by plugging in 0 to the polynomial.
Lagrange interpolation can also be used to correct errors in data (if it gets erased or corrupted). There are two main types of errors: erasure errors, when the data is simply lost, and general errors, where the data is corrupted and displays something other than the original data.
Erasure errors aren't too tough to think about once we have a good grasp of polynomial properties. Since we know that a unique polynomial of degree
can be recovered with
points, we could simply tack on an additional
points in order to protect the original polynomial from
erased points.
General errors, on the other hand, are slightly more difficult to consider because they could throw off the result wildly if we do not identify them. So how do we figure out which points are the errors?
Let us construct an error-locator polynomial
where an error
represents the incorrect value given by one of the spies when in a larger group.
For any one point
in the original polynomial
, we know that
where
is the original location of the point of the polynomial.
If we have
original data points, this provides enough points for a
degree polynomial, which we can call
. For any particular point, though, we know that
since the point given is either in the original polynomial, or is in the error-locator polynomial. Therefore, in order to solve for the true polynomial
, we can take the ratio
by definition of
. Since we do not know what each value
is, we need to solve a system of linear equations for each point to identify what these are. This requires
equations, because we require the polynomial
to perform this calculation.
Last modified 2yr ago