Engineering/Mathematics/Algebra and algorithms
Linearly Generated Sequences and Sparse Linear Systems
A sequence satisfying a linear recurrence is completely described by one polynomial, and that polynomial can be recovered from twice its degree in terms. Applied to the Krylov sequence of a sparse matrix, this turns an intractable dense elimination into a linear number of matrix–vector products.
- Advanced theory
- Algebra and algorithms
- Sieve back-end
- ≈15 min read
- Enables record factorizations
01
Executive summary
A sequence (a0, a1, …) over a field is linearly generated if some non-zero polynomial g(X) = ∑ ciXi annihilates it, meaning ∑i ci aj+i = 0 for all j. The set of such polynomials is an ideal, so it has a unique monic generator: the minimal polynomial of the sequence.
Two facts make this useful. The minimal polynomial can be computed from 2n terms by the extended Euclidean algorithm — equivalently by Berlekamp–Massey — in O(n2) field operations. And for a matrix A and vectors u, v, the scalar sequence ai = uTAiv is linearly generated by the minimal polynomial of A. Wiedemann's algorithm combines the two to solve sparse systems using only matrix–vector products.
Annihilated by a polynomial; the annihilators form an ideal in F[X].
The monic generator; degree n means 2n terms suffice to determine it.
Recovers the minimal polynomial in O(n²) operations.
Solve Ax = b or find ker A using n matrix–vector products and no fill-in.
02
Linearly generated sequences
Generator and minimal polynomial
For an infinite sequence (ai) over a field F, a polynomial g = ∑i=0k ciXi generates the sequence if ∑i=0k ciaj+i = 0 for every j ≥ 0. The generators together with 0 form an ideal of F[X]; if it is non-zero its monic generator is the minimal polynomial of the sequence, and it divides every other generator.
- Degree meaning. A minimal polynomial of degree k corresponds to the shortest linear feedback shift register producing the sequence, and its length is exactly the linear complexity of the sequence.
- Determination threshold. If the minimal polynomial has degree at most n, the first 2n terms determine it uniquely. This is the same information-theoretic count that appears in Reed–Solomon decoding and in rational reconstruction — because they are the same computation.
- Matrix case. For a square matrix A, the minimal polynomial of the sequence ai = uTAiv divides the minimal polynomial of A, which in turn divides the characteristic polynomial. For random u, v the divisor is usually the full minimal polynomial of A.
03
Computing the minimal polynomial
Given 2n terms, the minimal polynomial is recovered by running the extended Euclidean algorithm on X2n and the polynomial formed from the terms, stopping when the remainder degree drops below n.
Minimal polynomial from 2n terms
- input: a₀ … a_{2n−1} ∈ F
- A(X) ← ∑_{i<2n} a_i X^{2n−1−i}
- run extended Euclid on (X^{2n}, A), keeping the coefficient sequence
- stop at the first remainder r with deg r < n
- the corresponding multiplier t gives the reversed minimal polynomial
- normalise t to monic and reverse its coefficients
O(n²) field operations classically, O(n log² n) with fast polynomial arithmetic. Berlekamp–Massey performs the same computation in an incremental form with the same asymptotic cost.
| Problem | Input | Output | Stopping rule |
|---|---|---|---|
| Minimal polynomial | 2n sequence terms | shortest recurrence | remainder degree < n |
| Rational function reconstruction | z and modulus f | r/t with r ≡ zt | degree bounds on r and t |
| Reed–Solomon decoding | received word syndromes | error locator polynomial | half the redundancy consumed |
| Rational reconstruction over ℤ | residue and modulus | rational number | size bounds on numerator and denominator |
Recognising these as one algorithm is a genuine simplification: a single well-tested extended-gcd routine with configurable stopping conditions serves all four.
04
Wiedemann's algorithm for sparse systems
The matrices produced by sieve algorithms have millions of rows but only tens of non-zero entries per row. Dense elimination is impossible; iterative methods that touch the matrix only through multiplication are the practical answer.
Form the Krylov sequence
Choose random vectors u, v and compute ai = uTAiv for i = 0, …, 2n−1 using 2n matrix–vector products.
Recover the minimal polynomial
Run the extended Euclidean procedure on the 2n scalars to obtain g, the minimal polynomial of the sequence — with high probability the minimal polynomial of A itself.
Use g to solve the problem
If g(0) ≠ 0, the identity g(A) = 0 expresses A−1 as a polynomial in A, giving a solution of Ax = b. If g(0) = 0, factor out Xm to obtain a kernel vector.
Verify and repeat if necessary
Check the candidate directly with one more matrix–vector product. Failure occurs only for unlucky u, v; a fresh random choice succeeds with high probability.
| Method | Time | Space | Suitability |
|---|---|---|---|
| Dense Gaussian elimination | O(n3) | O(n2) | Small dense systems only |
| Structured Gaussian elimination | problem-dependent | grows with fill-in | Pre-processing stage to shrink the matrix |
| Wiedemann | O(n2w) total | O(nw) | Huge sparse systems; simple to implement |
| Block Wiedemann / block Lanczos | same order, K-way parallel | O(nw) | Production factoring records; distributed across machines |
The Wiedemann time is n matrix–vector products of cost O(nw) each, plus O(n²) for the sequence step. Over F₂ the vector operations are word-parallel XORs, which is why the block variants pack 64 or 128 right-hand sides into machine words.
Why the block variants exist
Blocking replaces the scalar sequence by a matrix sequence, using K random vectors at once. The number of iterations drops by a factor of K, the work per iteration is unchanged in word terms because K vectors fit in one machine word per coordinate, and the iterations parallelise cleanly. This is what makes the linear algebra stage of a large factoring effort feasible on a cluster.
05
Other uses of the same machinery
Minimal polynomial of a field element
Coordinates of the powers of α in F[X]/(f) form a linearly generated sequence; its minimal polynomial is the minimal polynomial of α.
Stream cipher analysis
Berlekamp–Massey recovers the shortest LFSR from a keystream segment, which is why linear complexity is a basic design criterion for keystream generators.
Reed–Solomon decoding
The syndrome sequence is linearly generated by the error locator polynomial; recovering it is exactly this computation.
Sequence prediction
Any sequence satisfying a fixed-order linear recurrence — including combinatorial ones like Fibonacci-type sequences — is identified from a finite prefix.
Order of a matrix
The minimal polynomial gives the eigenstructure over an extension field and hence the multiplicative order of an invertible matrix.
Discrete log linear algebra
Index-calculus systems over ℤq are solved by the same iterative approach, with modular rather than binary arithmetic.
06
Quick reference and FAQ
| Fact | Statement |
|---|---|
| Ideal structure | Generators of a sequence form an ideal of F[X] |
| Determination | Degree ≤ n minimal polynomial is fixed by 2n terms |
| Rationality | Linearly generated ⟺ generating series is rational |
| Krylov sequence | uTAiv is generated by the minimal polynomial of A |
| Cayley–Hamilton | Minimal polynomial divides the characteristic polynomial |
| Wiedemann iterations | 2n matrix–vector products, plus O(n2) for the sequence step |
| Kernel extraction | g(0) = 0 signals a singular matrix and yields a kernel vector |
Is Berlekamp–Massey different from the extended Euclidean algorithm?
What is the failure probability of Wiedemann?
When is structured Gaussian elimination still worth doing?
Why not use a numerical iterative solver such as conjugate gradient?
08
References and further reading
- V. Shoup, A Computational Introduction to Number Theory and Algebra, Cambridge University Press, 2005 — Chapter 19.
- D. H. Wiedemann, 'Solving sparse linear equations over finite fields', IEEE Trans. Inform. Theory 32 (1986) 54–62.
- P. L. Montgomery, 'A block Lanczos algorithm for finding dependencies over GF(2)', EUROCRYPT '95, LNCS 921, 106–120.
- J. L. Massey, 'Shift-register synthesis and BCH decoding', IEEE Trans. Inform. Theory 15 (1969) 122–127.
KEVOS® Knowledge LibraryEngineering → MathematicsTaxonomy ID: ENG-MATHPage ID: sparse-linear-systems-and-wiedemannReview cycle: annual
