← LibraryLinearly Generated Sequences and Sparse Linear SystemsEngineering · MathematicsLesson 20/32← PrevNext →
ArticlePublished 6 Aug 2026Updated 5 Aug 20263 min readBy Kevin Jogin
KEVOS® Knowledge Library · Engineering → Mathematics

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
2n termsRecovery thresholdA sequence with a minimal polynomial of degree ≤ n is determined by its first 2n terms.
O(n·w)Wiedemann costn matrix–vector products at w non-zeros each, versus O(n3) for dense elimination.
gcdOne algorithmThe extended Euclidean algorithm computes minimal polynomials, decodes Reed–Solomon codes and performs rational reconstruction — the same procedure each time.
No fill-inMemory advantageIterative methods never modify the matrix, so sparsity is preserved throughout.

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.

ObjectLinearly generated sequence

Annihilated by a polynomial; the annihilators form an ideal in F[X].

InvariantMinimal polynomial

The monic generator; degree n means 2n terms suffice to determine it.

AlgorithmExtended Euclid / Berlekamp–Massey

Recovers the minimal polynomial in O(n²) operations.

ApplicationWiedemann

Solve Ax = b or find ker A using n matrix–vector products and no fill-in.

Contents

02

Linearly generated sequences

Definition D1

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.
i ≥ 0 aiXi = f(X)/grev(X)A sequence is linearly generated exactly when its generating series is a rational function — the link that makes rational function reconstruction the natural algorithm.
Contents

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

  1. input: a₀ … a_{2n−1} ∈ F
  2. A(X) ← ∑_{i<2n} a_i X^{2n−1−i}
  3. run extended Euclid on (X^{2n}, A), keeping the coefficient sequence
  4. stop at the first remainder r with deg r < n
  5. the corresponding multiplier t gives the reversed minimal polynomial
  6. 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.

Three views of the same procedure
ProblemInputOutputStopping rule
Minimal polynomial2n sequence termsshortest recurrenceremainder degree < n
Rational function reconstructionz and modulus fr/t with r ≡ ztdegree bounds on r and t
Reed–Solomon decodingreceived word syndromeserror locator polynomialhalf the redundancy consumed
Rational reconstruction over residue and modulusrational numbersize 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.

Contents

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.

  1. Form the Krylov sequence

    Choose random vectors u, v and compute ai = uTAiv for i = 0, …, 2n−1 using 2n matrix–vector products.

  2. 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.

  3. 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.

  4. 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.

Cost comparison on an n × n matrix with w non-zeros per row
MethodTimeSpaceSuitability
Dense Gaussian eliminationO(n3)O(n2)Small dense systems only
Structured Gaussian eliminationproblem-dependentgrows with fill-inPre-processing stage to shrink the matrix
WiedemannO(n2w) totalO(nw)Huge sparse systems; simple to implement
Block Wiedemann / block Lanczossame order, K-way parallelO(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.

Contents

05

Other uses of the same machinery

01

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 α.

02

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.

03

Reed–Solomon decoding

The syndrome sequence is linearly generated by the error locator polynomial; recovering it is exactly this computation.

04

Sequence prediction

Any sequence satisfying a fixed-order linear recurrence — including combinatorial ones like Fibonacci-type sequences — is identified from a finite prefix.

05

Order of a matrix

The minimal polynomial gives the eigenstructure over an extension field and hence the multiplicative order of an invertible matrix.

06

Discrete log linear algebra

Index-calculus systems over q are solved by the same iterative approach, with modular rather than binary arithmetic.

Contents

06

Quick reference and FAQ

Facts
FactStatement
Ideal structureGenerators of a sequence form an ideal of F[X]
DeterminationDegree ≤ n minimal polynomial is fixed by 2n terms
RationalityLinearly generated generating series is rational
Krylov sequenceuTAiv is generated by the minimal polynomial of A
Cayley–HamiltonMinimal polynomial divides the characteristic polynomial
Wiedemann iterations2n matrix–vector products, plus O(n2) for the sequence step
Kernel extractiong(0) = 0 signals a singular matrix and yields a kernel vector
Is Berlekamp–Massey different from the extended Euclidean algorithm?
They compute the same thing and have the same complexity. Berlekamp–Massey is incremental — it processes one term at a time and is convenient in streaming or hardware settings — while the Euclidean formulation reuses an existing gcd routine and generalises directly to rational function reconstruction.
What is the failure probability of Wiedemann?
For random u, v over a field of size q, the recovered polynomial is the true minimal polynomial with probability at least about 1 − 2n/q. Over F2 that bound is useless, which is precisely why block variants with many random vectors are used there; failure is detected cheaply by verification and handled by retry.
When is structured Gaussian elimination still worth doing?
Almost always as a pre-processing step. Sieve matrices contain many columns with a single non-zero entry — relations involving a large prime that appears once — and eliminating those shrinks the matrix substantially at negligible fill-in cost before the iterative phase begins.
Why not use a numerical iterative solver such as conjugate gradient?
Those methods rely on an inner product being positive definite, which is meaningless over a finite field. Lanczos can be adapted, but requires care because self-orthogonal vectors exist over F2; the block Lanczos variant handles this explicitly.
Contents

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


Continue learning

Discrete Probability for Algorithm AnalysisArticle · MathematicsNEXT LESSON →Asymptotic Notation and Machine ModelsArticle · MathematicsModules, Vector Spaces and MatricesArticle · MathematicsMultiprecision Integer ArithmeticArticle · Mathematics