Papers
Topics
Authors
Recent
Search
2000 character limit reached

Berlekamp–Massey Algorithm

Updated 30 May 2026
  • Berlekamp–Massey algorithm is a method for determining the minimal polynomial that generates a linear recurrence relation from a sequence, with critical applications in coding theory.
  • The algorithm iteratively updates the discrepancy and backup polynomial to refine the connection polynomial, thereby assessing and optimizing the sequence’s linear complexity.
  • Extensions like the Berlekamp–Massey–Sakata algorithm generalize the method to multivariate sequences, which is vital for decoding multidimensional cyclic and abelian codes.

The Berlekamp–Massey algorithm is a fundamental algorithm in coding theory and computer algebra for determining the minimal linear recurrence relation that a finite sequence over a field satisfies. Its core applications include efficient decoding of Reed–Solomon and BCH codes, cryptanalysis, sequence synthesis, and the theory of shift registers. The algorithm has powerful multivariate generalizations—most notably, the Berlekamp–Massey–Sakata (BMS) algorithm—crucial for decoding multidimensional cyclic and abelian codes and for multivariate sparse interpolation. The BM algorithm’s theoretical foundation is closely linked to minimal polynomial theory, linear feedback shift-register synthesis, extended Euclidean algorithms, and Gröbner basis computation.

1. Minimal Linear Recurrence Problem and Connection Polynomial

Given a sequence s0,s1,,sN1s_0, s_1, \ldots, s_{N-1} over a field F\mathbb{F}, the goal is to find the monic polynomial C(x)=1+c1x++cLxLC(x) = 1 + c_1x + \cdots + c_Lx^L of least degree LL such that

j=0Lcjsnj=0\sum_{j=0}^L c_j s_{n-j} = 0

for all nLn \geq L. The minimal such C(x)C(x) is known as the connection polynomial or error-locator polynomial; LL defines the linear complexity of the sequence (Norton, 2010, Berthomieu et al., 2021, Berthomieu et al., 2017). In coding theory, for Reed–Solomon codes, the BM algorithm computes the error-locator and error-evaluator polynomials required to solve the key equation fundamental to syndrome-based decoding (O'Sullivan et al., 2021, Giacomelli, 2013, 0908.2198).

2. The Classical Berlekamp–Massey Algorithm

2.1. Algorithmic Structure

The BM algorithm iterates over the sequence, maintaining:

  • The current minimal polynomial C(x)C(x)
  • A backup polynomial B(x)B(x) (the last instance where F\mathbb{F}0's degree increased)
  • Degree F\mathbb{F}1 of F\mathbb{F}2
  • The last discrepancy F\mathbb{F}3 and its associated index F\mathbb{F}4

At each index F\mathbb{F}5, the discrepancy is calculated as

F\mathbb{F}6

If F\mathbb{F}7, F\mathbb{F}8 remains unchanged. If F\mathbb{F}9, C(x)=1+c1x++cLxLC(x) = 1 + c_1x + \cdots + c_Lx^L0 is updated by shifting and combining with C(x)=1+c1x++cLxLC(x) = 1 + c_1x + \cdots + c_Lx^L1: C(x)=1+c1x++cLxLC(x) = 1 + c_1x + \cdots + c_Lx^L2 If C(x)=1+c1x++cLxLC(x) = 1 + c_1x + \cdots + c_Lx^L3, then C(x)=1+c1x++cLxLC(x) = 1 + c_1x + \cdots + c_Lx^L4 are updated accordingly, and C(x)=1+c1x++cLxLC(x) = 1 + c_1x + \cdots + c_Lx^L5 increases to C(x)=1+c1x++cLxLC(x) = 1 + c_1x + \cdots + c_Lx^L6 (Berthomieu et al., 2017, Yu et al., 2013, Giacomelli, 2013).

2.2. Pseudocode

C(x)C(x)3 The above pseudocode is conceptual; exact field arithmetic and degree handling must be respected (Berthomieu et al., 2017, Atti et al., 2022).

2.3. Correctness and Complexity

After at most C(x)=1+c1x++cLxLC(x) = 1 + c_1x + \cdots + c_Lx^L7 steps, the minimal connection polynomial is constructed. The complexity is C(x)=1+c1x++cLxLC(x) = 1 + c_1x + \cdots + c_Lx^L8 in naive arithmetic, or C(x)=1+c1x++cLxLC(x) = 1 + c_1x + \cdots + c_Lx^L9 with FFT-based convolution. At each step, only LL0 coefficients are updated (Norton, 2010, Berthomieu et al., 2021).

3. Algebraic Foundations and Minimal Polynomials

The BM algorithm is equivalent to the process of finding the unique minimal polynomial that annihilates the sequence. This connection is formalized via annihilator ideals and Laurent polynomial action: for LL1 (a domain), the minimal polynomial LL2 satisfies

LL3

The minimal polynomial construction leads to the same recursive update as the BM algorithm via reciprocal pairs and shift operators, as shown by Norton (Norton, 2010). This gives rise to alternative iterative and recursive implementations, with total operation count bounded by LL4 multiplications in a field.

4.1. Key Equation for Reed–Solomon and Dual Codes

The BM algorithm can be interpreted as a specialized instance of the extended Euclidean algorithm, solving the key equation

LL5

in Reed–Solomon decoding, where LL6 is the error-locator polynomial and LL7 the error-evaluator. The Euclidean recursion

LL8

yields the same recurrence and update structure as the BM algorithm, with discrepancies mapped to the leading coefficients of remainders (0908.2198, O'Sullivan et al., 2021).

4.2. Modified and Reverse Variants

The BM framework extends to cases with arbitrary moduli, such as the reverse BM algorithm for general LL9, yielding minimal j=0Lcjsnj=0\sum_{j=0}^L c_j s_{n-j} = 00 with bounded-degree remainder in j=0Lcjsnj=0\sum_{j=0}^L c_j s_{n-j} = 01 (Yu et al., 2013). This is essential for decoding with punctured or shortened codes, and for algebraic inversion in quotient rings.

5. Generalizations: The Berlekamp–Massey–Sakata Algorithm

5.1. Multivariate Recurrences and the BMS Algorithm

The Berlekamp–Massey–Sakata (BMS) algorithm generalizes BM to multivariate sequences and arrays, seeking minimal sets of bivariate (or multivariate) polynomials annihilating a multidimensional data array j=0Lcjsnj=0\sum_{j=0}^L c_j s_{n-j} = 02. The BMS algorithm produces a Gröbner basis for the ideal of relations by iteratively constructing minimal generators over a chosen monomial ordering (Bernal et al., 2024, Berthomieu et al., 2017).

5.2. Application to Abelian and AG Codes

In two dimensions and for abelian codes, the BMS algorithm efficiently computes Gröbner bases characterizing locator ideals from a reduced set of syndrome observations. With suitable index set selection j=0Lcjsnj=0\sum_{j=0}^L c_j s_{n-j} = 03 of size j=0Lcjsnj=0\sum_{j=0}^L c_j s_{n-j} = 04, the final iterate yields the complete Gröbner basis for the ideal, greatly reducing syndrome sampling requirements compared to naive methods (Bernal et al., 2024).

5.3. Handling Missing Syndrome Values and Syndrome Inference

For practical scenarios where some syndrome values are unavailable, recent work (Bernal et al., 18 Sep 2025) introduces inference techniques that allow the BMS algorithm to proceed and reconstruct missing data. The algorithms leverage redundancy in the structure to infer or parametrize missing syndromes, culminating in a unique solution by local consistency checks.

6. Complexity, Optimizations, and Output-Sensitive Algorithms

6.1. Complexity

  • Classical BM: j=0Lcjsnj=0\sum_{j=0}^L c_j s_{n-j} = 05 operations, j=0Lcjsnj=0\sum_{j=0}^L c_j s_{n-j} = 06 sequence samples.
  • BMS (2D): Up to j=0Lcjsnj=0\sum_{j=0}^L c_j s_{n-j} = 07 in worst case, but using minimal index sets reduces to j=0Lcjsnj=0\sum_{j=0}^L c_j s_{n-j} = 08, where j=0Lcjsnj=0\sum_{j=0}^L c_j s_{n-j} = 09 is the designed error-correction radius (Bernal et al., 2024).
  • Output-sensitive polynomial division-based variants can further exploit the structure for quasi-linear arithmetic complexity and minimal sequence queries, especially in high dimensions (Berthomieu et al., 2021).

6.2. Comparison with Scalar-FGLM and Interpolation Algorithms

The Scalar-FGLM algorithm computes relations via linear algebra on Hankel matrices and is particularly effective for dense or nearly square staircase shapes but incurs high cost for sparse, large multivariate data. The BMS algorithm is shift/add-based and typically requires fewer table queries, making it more efficient for sparse or output-sensitive Gröbner basis computation (Berthomieu et al., 2017, Berthomieu et al., 2021).

Algorithm Dimension Arithmetic Complexity Sequence Queries
Berlekamp–Massey 1 nLn \geq L0 or nLn \geq L1 nLn \geq L2
BMS (Sakata) nLn \geq L3 nLn \geq L4 nLn \geq L5
Scalar-FGLM nLn \geq L6 nLn \geq L7 nLn \geq L8
Poly Scalar-FGLM nLn \geq L9 output-sensitive C(x)C(x)0 C(x)C(x)1

7. Extensions, Non-linear Generalizations, and Open Problems

7.1. Non-linear Feedback Synthesis

The classical BM algorithm produces optimal linear feedback models only. For synthesis of minimal nonlinear binary C(x)C(x)2-stage machines, algorithmic extensions have been introduced that construct Boolean state machines generating any given binary sequence, optimizing for stage count but potentially incurring exponential support in the resulting logic (Dubrova, 2010).

7.2. Simultaneous and Interleaved Decoding

For interleaved codes or simultaneous key equations (Simultaneous Partial Inverse, SPI), BM-type algorithms exist that ensure uniqueness and degree bounds for the minimal polynomial solution across multiple sequences, generalizing the classical multi-sequence BM of Feng–Tzeng (Yu et al., 2016).

7.3. Syndrome Majority Voting and Inference for Multivariate Codes

Recent advances allow the BMS algorithm to function with partial syndrome information, reconstructing missing values via combinatorial and algebraic methods (including monomial-order switching and parametric updates), directly paralleling Feng–Rao majority voting in the one-point AG code case (Bernal et al., 18 Sep 2025).

7.4. Adaptive and Lazy Variants

Variants of the BM algorithm supporting lazy evaluation, dynamic extension when the minimal degree is unknown, and fully division-based restatements offer improved flexibility and implementation simplicity, essential for large sparse linear algebra and on-the-fly computation (Atti et al., 2022).


References

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Berlekamp–Massey Algorithm.