← LibraryGaussian EliminationEngineering · MathematicsLesson 155/385← PrevNext →
ArticlePublished 7 Aug 20263 min readBy Kevin Jogin

Engineering  /  Mathematics  — Modules, Vector Spaces and Matrices

Gaussian Elimination

Gaussian elimination over a field, its complexity, pivoting, and its role as the bottleneck in sieve algorithms.

Page KV-MATH-0427Reading time 4 minReviewed 2026-08-07Author Kevin Jogin

Executive summary

Gaussian elimination reduces a matrix to echelon form by row operations, from which rank, kernel, image and solutions are all read off. It costs cubic time in the matrix dimension.

Over finite fields it is exact and needs pivoting only to avoid zero pivots. In sieve algorithms it is the phase that does not parallelise well, and specialised sparse methods replace it.

Learning objectives

  1. State the algorithm and its cost.
  2. Explain pivoting over a finite field.
  3. Identify why sparse methods are needed at scale.

01The algorithm

Algorithm

Gaussian elimination to row echelon form

Inputmatrix A over a field
Outputrow echelon form with recorded pivots
  1. Set the pivot row and column to 1.
  2. While rows and columns remain:
  3.   Find a row at or below the pivot row with a non-zero entry in the pivot column.
  4.   If none exists, advance the pivot column and continue.
  5.   Swap that row into the pivot position.
  6.   Scale the pivot row so the pivot entry is 1.
  7.   Subtract multiples of the pivot row from all rows below to clear the column.
  8.   Advance both the pivot row and column.
  9. Return the echelon form and the pivot positions.
Cost  O(n³) field operations for an n × n matrix

The rank is the number of pivots. Free columns correspond to kernel basis vectors, and pivot columns of the original matrix form a basis for the image.

02Pivoting over a finite field

Over a finite field, pivoting is required only to avoid a zero pivot — any non-zero entry serves equally well, because arithmetic is exact and there is no numerical error to control.

Pivoting strategies by setting
SettingPivot choiceReason
Finite fieldAny non-zero entryExact arithmetic; correctness only
Floating pointLargest magnitudeNumerical stability
Exact rationalSmallest entriesLimit coefficient growth
SparsePreserve sparsityMinimise fill-in

03The bottleneck in sieve algorithms

Index calculus and the sieve factoring methods both end with a large sparse linear system over a small field, and that phase behaves very differently from the relation collection preceding it.

  1. Relation collectionEmbarrassingly parallelEach candidate independent; scales across many machines
  2. Dense eliminationO(n³), poor parallelismInfeasible at sieve matrix sizes
  3. Block LanczosO(n²) with sparsityIterative; the practical choice
  4. Block WiedemannSimilar, better distributedUses linearly generated sequence machinery

Block Wiedemann is worth noting here because it connects directly to another stream in this collection: it reduces the linear system to finding a minimal linear recurrence for a sequence of vectors, which is the Berlekamp–Massey problem.

The practical consequence is that a factoring effort is limited less by total computation than by the memory and interconnect of the single system running the linear algebra phase.

04Frequently asked questions

Is O(n³) optimal?

No. Strassen's algorithm and its successors reduce matrix multiplication below cubic, and elimination inherits the improvement. The crossovers are high and the constants poor, so cubic methods dominate in practice.

Why does sparsity matter so much?

Because sieve matrices have millions of rows with only a handful of non-zero entries each. Storing them densely is impossible, and any method causing fill-in destroys the only property making the problem tractable.

Does pivoting affect the rank?

No. Rank is invariant under row operations and swaps, so any valid pivoting sequence yields the same rank. Only the specific echelon form differs.

Sources and method

Structural reference: Victor Shoup, A Computational Introduction to Number Theory and Algebra, Version 1, Cambridge University Press, 2005 — book pages 324-328.

This page carries the durable method layer only: definitions, constructions, algorithms, complexity results and selection criteria, authored originally for KEVOS. No text is transcribed or paraphrased from the source, and no numeric tables or benchmark data are reproduced — these are routed to live authoritative sources instead.

Author: Kevin Jogin. Last reviewed 2026-08-07.

Continue learning

The Inverse of a MatrixArticle · MathematicsNEXT LESSON →Computing Rank, Kernel and ImageArticle · MathematicsMatrices and Linear MapsArticle · MathematicsSolving Systems of Linear EquationsArticle · Mathematics