Field with four elements Created 2026-10-06 Updated 2026-10-14
Build this finite field by taking a quotient ring of a polynomial ring:The polynomial has in the prime field . A polynomial of polynomial degree two is an irreducible polynomial exactly when it has no polynomial root in the coefficient field. Thus the quotient by an irreducible polynomial is a field construction applies. Its elements have unique representatives , with : precisely .
The defining relation is . Since this finite field has characteristic two, every element equals its additive inverse, and the relation becomes . Addition acts separately on the two coefficients:All coefficient calculations use modular arithmetic modulo two. For example, and . Encoding as the pair of bits gives , , , and ; addition is bitwise exclusive or. These are coordinates in the basis , so the label does not make the element .
For multiplication, expand using the distributive property and replace every by :For example, , while . The following complete tables are computed from the coefficient rules. Colors identify results, rather than their numerical sizes. Every row of the addition table lists all four elements, and every nonzero row of the multiplication table does too: adding an element, or multiplying by a nonzero element, can be undone.
The nonzero multiplicative inverses are , , and . Consequently the equation has the unique solution . Repeated multiplication gives , , , and . They cycle through every element of the multiplicative group of a finite field.
Compare the ring , also with four elements. Its addition satisfies , and its multiplication satisfies . Thus is a zero divisor, with no multiplicative inverse, and this ring is not a field. Multiplying by collapses different inputs to the same output: both and give , while both and give . In the field with four elements, multiplying by instead rotates the three nonzero elements, preserving their distinctness. The figure makes visible why counting four elements alone does not specify their arithmetic.
Finite field Created 2026-09-24 Updated 2026-10-13
A finite field is a field with finitely many elements: addition, subtraction, multiplication, and division by a nonzero element all stay inside a finite collection. Write , or , for a finite field with elements. The subscript counts elements; it does not prescribe modular arithmetic modulo . The field with four elements is the smallest example where that distinction matters.
Every finite field has size , where is a prime number and is a positive integer. To see the counting mechanism, use its prime field : the finite field is a finite-dimensional vector space over . For a basis , every element has exactly one expressionEach coefficient has choices, so there are expressions. Here is the characteristic of a field and is the dimension of a vector space. Thus sizes are possible, whereas are not prime powers and cannot be finite field sizes.
Conversely, every prime power occurs, and any two finite fields of the same size admit a field isomorphism. These are classification statements, beyond the counting argument. See Conrad's Theorems 1.5, 2.2, and 2.7.[ref]
https://kconrad.math.uconn.edu/blurbs/galoistheory/finitefields.pdf. Keith Conrad, Finite Fields, sections 1–2
Uniqueness means the arithmetic agrees after relabeling; it does not choose a basis, an irreducible polynomial for a quotient ring representation, or a particular field isomorphism. Even for the field with four elements, exchanging and preserves the arithmetic.The appeal for coding theory is exact, finite arithmetic with reliable division: polynomial interpolation and linear algebra work over a finite alphabet. A Reed-Solomon code represents messages by polynomials and adds redundancy by evaluating them at several distinct finite field elements. Forney's MIT notes develop this arithmetic as preparation for such error-correcting codes.[ref]
https://ocw.mit.edu/courses/6-451-principles-of-digital-communication-ii-spring-2005/8921c013c1d7802bb197572c52442b97_chap7.pdf. G. David Forney Jr., Introduction to finite fields, 2005
In cryptography, finite fields likewise supply exact arithmetic on finitely many symbols, with operations that can be implemented using bits.Historically, Évariste Galois published work on finite fields beyond prime fields in 1830, constructing them by adjoining elements satisfying irreducible polynomials over prime fields. Conrad's historical account also records E. H. Moore's 1893 terminology, from which the name Galois field and notation descend.[ref]
Group Created 2026-09-24 Updated 2026-10-14
A group packages reversible operations together with a rule for composing them. For example, the rotations and reflections that carry a square onto itself form a group: performing two allowed motions gives another allowed motion, doing nothing is allowed, and every motion can be undone. The elements are the motions themselves, rather than the vertices they move. Labels in the figure track those vertices; they are markers, rather than extra decorations that the motions must preserve.
Square symmetries composed in opposite orders
. The rotation is counterclockwise through , and the reflection is in the vertical axis. Products act rightmost first: . The red vertex starts at and ends at under , but at under . Both motions preserve the unmarked square, while their permutations of its vertices differ. Details.Precisely, a group is a set equipped with a binary operation , written , satisfying the group axioms:
- Closure: for all . This is already part of specifying the operation's target as .
- Associativity: for all .
- An identity element satisfies for every .
- Every has an inverse element with .
The group operation need not be ordinary numerical multiplication. With addition as the operation, the identity element is usually written and the inverse element of is written . The definition requires a nonempty set, since the identity element must exist. See McKernan's MIT lecture 1, Definition 1.1 for the axioms.
Why insist on associativity? It makes a string of operations unambiguous without specifying parentheses. For function composition, both and send to . This fixes the order of execution while allowing regrouping. Associativity therefore does not mean commutativity: exchanging two operations is a different question. Ordinary subtraction fails associativity, since whereas ; it cannot serve as a group operation on the integers.
An inverse element makes reversal exact and equations solvable. In any group, has the unique solution , since . Similarly, has solution . The side matters in a non-abelian group. Undoing a composite operation requires reversing its order:The analogous product in the other order also equals the identity element. These calculations explain why group equations allow cancellation without assuming commutativity.
For the square with vertices , choose the rotation and reflectionThroughout this example, multiplication is function composition with the rightmost operation performed first: . Our notation means the dihedral group of the square, with eight elements; the alternative convention calls the same group . Its elements areHere is clockwise rotation through , while each reflection is its own inverse element. There are exactly eight motions: the image of one vertex has four choices, and the image of an adjacent vertex has two choices; together these determine the motion. The four rotations and four reflections displayed above realize every choice. The vertex permutations give a concrete group action. The general polygon construction is discussed in Group Theory (v4.01) by James S. Milne (section 1.17).
Computing the two products rather than merely comparing their names givesThus but , proving . In fact is reflection in the line , whereas is reflection in . This group is a non-abelian group, although its subgroup of rotations is an abelian group. The relation expresses a geometric fact: conjugation of a counterclockwise rotation by a reflection turns it clockwise.
A contrasting example is the cyclic group under addition in modular arithmetic. Using representatives , the sum is modulo , and the inverse element of is . Repeated addition of runs through . The correspondence identifies this cyclic group with the rotation subgroup of : . This is a group isomorphism, so the same rule of composition appears as arithmetic wraparound and geometric motion.
By comparison, is an infinite cyclic group. It has identity element , inverse element for each integer , and a generator of a group , but no wraparound: , and no positive number of copies of sums to . Both examples are abelian groups. The nonnegative integers under addition have closure, associativity, and an identity element, but lack an inverse element for . Reversibility is precisely what fails.
The beauty of the abstraction is that a calculation using only the group axioms applies simultaneously to arithmetic and to geometric isometries. To make that connection universal, let each act on by the translation in a group . Each is a bijection, with inverse , and . Distinct elements give distinct maps because . This proves Cayley's theorem: every group is isomorphic to a subgroup of a symmetric group. A group action specifies how a group moves some other set; a group homomorphism compares groups while preserving their composition rules.
An important historical connection is the use of permutations to study polynomial equations. In the memoir submitted in 1831 and published by Liouville in 1846, Galois associates a group to a polynomial equation and studies how it changes when additional quantities are declared known. Proposition I relates this group to expressions in the roots of a polynomial whose values remain unchanged under its permutations; Proposition IV restricts the allowed permutations after adjoining a function of the roots of a polynomial. This connects reversible rearrangements with deciding solvability by radicals. See Galois's original memoir, pp. 417–433, especially Propositions I and IV; Liouville's introduction, p. 382.
Group action Created 2026-09-24 Updated 2026-10-14
A left group action of a group on a set is a function satisfyingwhere is the identity element of . The second rule means that moves the point first and moves it next. These rules let group multiplication describe consistent rearrangements of a set; see Ackerman's algebra notes, definition 0.4.1.1.
For each , the function is a bijection: its inverse is , using the inverse element of . Equivalently, a group action is a group homomorphism into the symmetric group of all permutations of , with and . See MIT's group-action notes, definition 23.1.
For a concrete group action, put the vertices of a polygon of a square at , , and . Let be a counterclockwise quarter-turn rotation and let be a reflection. Their eight permutations of the vertices of a polygon form the dihedral groupHere means the symmetry group of a four-sided polygon, with group order eight; the alternative convention calls this same group . Products apply the rightmost operation first. For example, and . The same group also has separate group actions on the sides of a polygon, the diagonals of a polygon, and the singleton set containing the centroid of the square. Specifying matters: changing what is moved changes the orbits of a group action and the stabilizer subgroups.
A group action need not be a faithful group action. For example, the cyclic group acts on by , using modular arithmetic. Only the parity of matters: fix both points and exchange them. The associated group homomorphism has group kernel , of group order two. Either point has a group orbit of size two and a stabilizer subgroup of group order two, so the orbit-stabilizer theorem gives .
The useful questions are which positions can be exchanged, and which transformations survive after imposing a constraint such as keeping one marked point fixed. An orbit of a group action answers the first question; a stabilizer subgroup answers the second. This turns a list of transformations into a count of distinct configurations, and explains why several transformations can produce the same configuration.
Hash collision 2026-10-13
A hash collision is a function collision of a hash function : two distinct inputs have the same output, . Repeating the same input is not a hash collision. Unequal hash values prove the keys differ; equal hash values only identify candidates that might be equal. This makes a hash function useful as a compact filter before comparing the original data.
Here is a deliberately simple example using modular arithmetic. Let for nonnegative integer keys, and let a four-bucket hash table use the further bucket index . For keys , the hash values are , while all three bucket indices are . Thus and form a hash collision for ; and share a table bucket even though their full hash values differ. Always specify which function is being compared: a table collision concerns the bucket-index function, which may discard more information than the original hash function.
With separate chaining, bucket holds all three records in a linked list. A search for visits that bucket and compares the stored keys until it finds ; a search for visits the same bucket but rejects every stored key. A hash collision changes the search work, while key comparison preserves correctness. Storing only one record per hash value would incorrectly merge distinct keys. This is the purpose of collision handling in a hash table.[ref]
The pigeonhole principle explains inevitability: if a hash function has only possible outputs, any distinct inputs contain a hash collision. In particular, a function whose domain of a function is larger than its finite codomain cannot be an injective function. This is an existence statement; it gives neither an efficient way to find the pair nor a probability for a smaller collection of keys. A particular small collection might have no hash collision at all.
For a cryptographic hash function, collision resistance asks that finding any two distinct messages with equal full digests be computationally infeasible under the specified model and resources. It does not mean that hash collisions do not exist. Preimage resistance asks a different question: given a target digest , how hard is it to find a message with ? The collision finder may choose both messages and their common digest; the preimage finder is given the digest in advance. These definitions distinguish two search tasks, independently of how a hash table stores records.[ref]
https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-107r1.pdf. Quynh Dang, NIST SP 800-107 Revision 1 (2012), section 3.1 and section 4.1, definitions of collision and preimage resistance
Hash function 2026-10-13
A hash function is a function assigning each key in an input set a value in an output set . Usually is much smaller: a long name or large integer becomes a small bucket index. Equal keys must receive equal values from the same hash function; different keys may also receive equal values. Such a hash collision means "look in the same place", and does not establish key equality. If , the pigeonhole principle makes some collisions unavoidable.
For example, modular arithmetic gives the hash function , with seven bucket indices . Store the seven keys : their values are respectively . In particular, although . A hash table is a data structure that uses these indices to locate records. With separate chaining, each bucket holds a linked list of records, so bucket retains all four keys . Inserting must not overwrite merely because their hash function values agree.
Searching for computes bucket , then compares the actual keys until it reaches . Searching for absent key reaches that same bucket and must reject every stored key. This data structure trades a search through all records for a search through one short chain, provided the hash function distributes keys adequately. A fixed hash function can perform poorly on patterned keys: already demonstrate the problem. A universal hash family introduces controlled randomness to limit the expected value of this extra work. Neither indexing nor a small collision probability inherently supplies encryption or message authentication; a cryptographic hash function has additional requirements such as collision resistance.
Hash table Created 2026-10-13 Updated 2026-10-18
A hash table stores records by key: for example, a product number can select its current stock count without scanning every product. A hash function selects a hash bucket in an array, and a collision-handling method such as separate chaining retains distinct keys assigned to the same hash bucket. The useful idea is to narrow the search to one small collection, while key equality decides which record actually matches.
Use a map interface with one value per key:
get(k) returns the associated value or an explicit absent result; put(k,v) replaces the value if an equal key is present, otherwise inserts a new record; delete(k) removes the matching record if present. The absent result must be distinguishable from every permitted stored value. Replacing a value does not increase the record count . A hash collision between unequal keys must never cause one record to replace the other.[ref]Lecture 8: Hashing I. 6.006 Introduction to Algorithms, Fall 2011 by Massachusetts Institute of Technology, 6.006 course staff; p. 1, dictionary operations and replacement of an existing key
Let denote the chosen key equality, an equivalence relation, and let be the bucket-index hash function for hash buckets. Correctness requiresThe converse is false: equal bucket indices merely identify candidates for a key equality comparison. If an implementation first computes a full hash value and then reduces it to a bucket index, equal keys must have equal values too. Keep both key equality and the hash function stable while a key is stored; changing the key so it selects another hash bucket can make its record unreachable. This distinction is explicit in the published
hashCode/equals contract.[ref]For a constructed integer example, use modular arithmetic to define and store keys with values . At , three records share hash bucket and one occupies hash bucket . The hash table load factor isIt is the mean number of records per hash bucket, including empty hash buckets, not a bound on the longest chain. With separate chaining, may exceed because records live in the chains rather than one record being confined to each array slot.
Growing this example to changes the bucket-index hash function: key now belongs to hash bucket , while keys still share hash bucket . Every record must be assigned using the new bucket-index hash function; copying the old array of chain heads unchanged is insufficient. The hash table load factor becomes .
Hash table resizing recomputes indices but does not guarantee fewer hash collisions
. Original deterministic model using , not a measured implementation. The upper panels retain keys in four and eight hash buckets; chain order is illustrative. The lower counterexample retains all four keys in hash bucket even after doubling. Details.For an insertion-only sequence starting empty with constant initial capacity, one policy doubles before inserting a new key that would make . A rebuild for separate chaining allocates the new array and transfers each existing record directly into its new chain. Since keys are already distinct, transfer needs no duplicate search. With constant-cost hashing and linking, this takes time complexity, hence at a growth threshold. Amortized analysis charges the occasional rebuild across many insertions: the old capacities form a geometric series with sum , so total rebuilding work over insertions is . This gives amortized resizing overhead; an insertion that triggers a rebuild can still take .[ref]
Lecture 9: Hashing II. 6.006 Introduction to Algorithms, Fall 2011 by Massachusetts Institute of Technology, 6.006 course staff; p. 2, rebuilding cost and geometric table doubling
The search to check for an existing key is additional work. Bounded hash table load factor together with the probabilistic assumptions in separate chaining gives expected amortized insertion, not worst-case . Rehashing alone gives no distribution guarantee: the diagram's keys all collide modulo both and . Even a low hash table load factor permits a long chain. If supporting shrinkage too, leave a gap between growth and shrink thresholds to avoid repeated rebuilding when insertions and deletions alternate near one threshold.[ref]
Lecture 9: Hashing II. 6.006 Introduction to Algorithms, Fall 2011 by Massachusetts Institute of Technology, 6.006 course staff; p. 3, expected bounds and shrinking at one-quarter occupancy
Hash table resizing Created 2026-10-13 Updated 2026-10-18
Changing the number of hash buckets and reassigning stored records using the new bucket-index hash function. Amortized analysis of rebuilding and expected value bounds for subsequent lookup address different costs.
Rebuild the balanced example from load factor of a hash table with while keeping exactly the same twelve records. Under , keys retain their indices, whereas keys move from hash buckets to hash buckets . The new chain lengths are twelve ones followed by four zeros; . Copying the old eight chain heads and adding eight empty heads would leave those four moved keys unreachable by the new lookup rule.
Hash table resizing from eight to sixteen hash buckets redistributes existing records
. Original modular arithmetic example for keys . Blue keys keep their indices; orange keys move because differs from . The record count stays twelve, and empty hash buckets still count towards capacity. Details.For a short algorithm correctness outline, allocate the new array, visit every old record once, compute its new bucket index, and link it into that hash bucket. At every step, each transferred record is stored exactly once at the index prescribed by the new hash function. Finishing the visit therefore preserves every key-value association and makes the new lookup rule valid. Direct transfer can skip duplicate searches because the old one-value-per-key map already established distinct equivalence classes; rebuilding is not twelve new user insertions.
Under constant-cost hashing, linking and slot initialization, separate chaining rebuilding takes time complexity: initialize new heads, examine old heads, and transfer records. For doubling, , this is in Big O notation. It is when the resize policy makes proportional to , but an enormous mostly empty old array can make scanning its heads dominate. Growing capacity can lower without shortening a particular chain: the concentrated keys all remain in hash bucket after growth from eight to sixteen.
For an insertion-only sequence starting empty, choose initial capacity and double before a genuinely new key would make . The first three growths occur before inserting records and transfer existing records. If distinct records are inserted, the transfer count is . More generally, the transferred old capacities form a geometric series; if the last is , their sum is . Initializing and scanning these geometrically growing arrays also costs in total, giving amortized rebuilding overhead per insertion. A triggering insertion still pays for its whole rebuild.[ref]
Lecture 9: Hashing II. 6.006 Introduction to Algorithms, Fall 2011 by Massachusetts Institute of Technology, 6.006 course staff; p. 2, Rehashing, How fast to grow?, and Amortized Analysis
The illustrative twelve-record resize above is an explicitly requested rebuild, not a growth triggered by this threshold policy. Checking for an equal key before growing also prevents a value replacement from triggering unnecessary growth. To combine resizing overhead with expected constant insertion time complexity, separately impose the collision and constant-cost assumptions in load factor of a hash table. Amortized analysis distributes rebuilding costs over operations; it does not randomize a poor hash function or bound a single operation's latency. With deletions, separate the grow and shrink thresholds; for example, growing when full and halving at one-quarter live occupancy leaves room for many operations between opposite rebuilds.[ref]
Lecture 9: Hashing II. 6.006 Introduction to Algorithms, Fall 2011 by Massachusetts Institute of Technology, 6.006 course staff; p. 3, Back to Hashing and Delete: halving when n reaches m/4
// Target: computer-science.bigb
Homomorphism 2026-10-13
A homomorphism is a map between algebraic structures preserving their specified operations. For a single binary operation, this means , where the source and target may use different operation symbols. A group homomorphism preserves the group operation; a ring homomorphism preserves addition and multiplication, with the identity convention specified; a module homomorphism preserves addition and scalar multiplication.
Reduction modulo is a ring homomorphism : adding or multiplying first and then reducing gives the same residue as reducing first and then operating. For example, , while the reduced operands give . This lets a complicated integer calculation be projected into simpler finite arithmetic. It also explains why a polynomial equation over the integers imposes necessary modular arithmetic conditions on any integer solution.
A homomorphism can lose information: and have the same image under that reduction. An isomorphism loses none of the structure because it has an operation-preserving inverse. Preservation of the operation, rather than preservation of arbitrary labels or sizes, is the essential condition.
Integer congruence 2026-10-14
For a positive modulus , integers are congruent when their difference is divisible by . This is an equivalence relation: zero is divisible by , changing sign preserves divisibility, and adding two divisible differences proves transitivity. Addition and multiplication respect it, because and . Its equivalence classes are the residue classes used in modular arithmetic.
Key equality Created 2026-10-13 Updated 2026-10-18
The equivalence relation used to decide whether two keys name the same record. A hash function must respect key equality; a hash collision does not establish key equality.
The choice of key equality is part of the map's meaning. In the one-value-per-key policy of hash table, one record represents each stored equivalence class of keys:
put(k,v) updates an existing equal key and adds a record only if no equal key is present. A collection that deliberately retains repeated equal keys has a different policy; its load count must count those extra records too. Repeated calls and distinct stored records are different quantities.[ref]Lecture 8: Hashing I. 6.006 Introduction to Algorithms, Fall 2011 by Massachusetts Institute of Technology, 6.006 course staff; p. 1, Dictionary Problem: distinct keys or replacement on repeated insertion
For an original example, restrict keys to two-letter strings using letters
A through Z or a through z. Declare two keys equal when replacing every uppercase letter by its lowercase counterpart gives the same string. Assign each letter its position in the alphabet, ignoring case, and define the bucket-index hash function as the sum of the two positions modulo , using modular arithmetic. Then AB and ab are equal keys and both select hash bucket . Key ba also selects hash bucket because , but is unequal to ab: order still matters. Starting empty, put(AB,7), put(ab,9), put(ba,4) leave two records, with values for the ab equivalence class and for ba; the hash table load factor is , not .The compatibility rule is one-way: . Otherwise a lookup using an equal spelling could search a different hash bucket and incorrectly report absence. Equal indices merely allow a key equality check. Both the equivalence relation and the hash function must stay consistent while records are stored; changing equality-relevant key contents can invalidate the lookup rule. The Java contract imposes these consistency and equality requirements on
equals and hashCode.[ref]Object (Java SE 25 & JDK 25). Java Platform, Standard Edition 25 API Specification by Oracle; Method Details, equals equivalence-relation contract and hashCode general contract
Lagrange's four-square theorem 2026-10-13
Every nonnegative integer is a sum of squares with four terms, with zero terms allowed. Precisely, for every integer , there exist nonnegative integers such thatAllowing arbitrary integer roots gives the same statement: changing a root to its absolute value leaves the resulting square number unchanged. Four is a uniform upper bound on the number of nonzero terms, rather than a demand for four positive terms. Repeated square numbers are allowed. Conrad states the positive case and explicitly explains the role of zero terms; follows by taking all four roots zero. [ref]
https://kconrad.math.uconn.edu/blurbs/ugradnumthy/descent.pdf. Keith Conrad, Proofs by Descent, Section 6, opening paragraph and Theorem 6.6
The small cases make the convention visible:In particular, could not be a sum of squares with four strictly positive roots, since each term would be at least one. Geometrically, a square of integer side length has area : the theorem says that any nonnegative whole-number total area can be split into at most four such square areas. It does not assert that those squares tile one larger square or a prescribed rectangle.
Why does the fourth term matter? Two square numbers do not suffice for : in modular arithmetic, a square number has remainder zero or one modulo four, so their sum cannot be three modulo four. The sum of two squares theorem gives a complete criterion for the positive integers representable with two terms. Even three terms leave gaps. A square number has remainder or modulo eight; adding three of these, with repetition allowed, never gives seven modulo eight. Thus cannot be sums of three square numbers, although Lagrange's four-square theorem represents all of them with four. This also proves that the bound four cannot be reduced to three.
The modulo-eight obstruction is not the only way that three terms can fail. For example, needs four: if three square numbers added to , their remainders modulo four would force all three roots even. Dividing by four would then express as a sum of three square numbers, contradicting the preceding calculation. These short checks explain the examples without requiring a full classification of sums of three square numbers.
The practical benefit of Lagrange's four-square theorem is an existence guarantee for a family of Diophantine equations: for every nonnegative integer , the displayed equation has an integer solution. It does not specify a unique solution. For instance, . To find a representation by a finite search, enumerate and test the sum. The floor function supplies a finite bound because no single term can exceed , and sorting roots removes duplicate orderings without discarding any possible sum. The theorem guarantees that the search succeeds.
A greedy algorithm that repeatedly subtracts the largest available square number need not find four terms: for it chooses , while uses four. The appeal of the theorem is this gap between local choices and a global promise: individual square numbers become farther apart, and two or three terms leave arithmetic obstructions, yet four terms cover every nonnegative integer.
For historical orientation, Conrad dates Lagrange's four-square theorem to and identifies the memoir as Démonstration d'un théorème d'arithmétique: it appeared in the Berlin Academy's volume for the year , published in , pages –. Keeping the volume year and publication year distinct avoids an apparent conflict between dates. [ref]
https://kconrad.math.uconn.edu/blurbs/ugradnumthy/descent.pdf. Keith Conrad, Proofs by Descent, Theorem 6.6 and reference 11
Linear congruence Created 2026-09-29 Updated 2026-10-14
A linear congruence asks for the integers satisfying , where are integers and . Let be their greatest common divisor. There are solutions exactly when divides . When solutions exist, there are exactly solution classes modulo , obtained from one solution byThe divisibility condition follows immediately from : every common divisor of must divide . Conversely, Bézout's identity constructs a solution when . Differences between any two solutions obey , equivalently , since and are coprime. This explains both the spacing and the number of solution classes.
For a complete example, solve . Here divides nine. Dividing the corresponding divisibility statement by three changes the integer modulus too:Because , multiplying by the modular inverse three gives . Lifting this class back to modulus fifteen yields . Direct substitution gives , and , each with remainder nine after division with remainder by fifteen. By contrast, has no solutions, because three does not divide ten.
This is why ordinary-looking division cannot be performed blindly in modular arithmetic. Reducing the equation and its integer modulus together keeps all solutions; retaining modulus fifteen after dividing by three would lose valid classes. When , the modular inverse of exists and gives a unique class . The Euclidean algorithm computes the Bézout coefficients needed for this construction. [ref]
https://ocw.mit.edu/courses/18-200-principles-of-discrete-applied-mathematics-spring-2024/mit18_200_s24_lec15.pdf. Moitra, MIT 18.200, Lecture 15, modular inverses and the extended Euclidean algorithm
Linear probing 2026-10-18
An open addressing probe rule that visits modulo , using modular arithmetic, until a matching record or an appropriate stopping slot is found.[ref]
Lecture 10: Hashing III: Open Addressing. 6.006 Introduction to Algorithms, Fall 2011 by Massachusetts Institute of Technology, 6.006 course staff; Lecture 10: Hashing III: Open Addressing, p. 3, Linear Probing formula
For capacity , the hash table probe numbered , starting at zero, inspects the array indexThe hash function gives the first array index. Each subsequent hash table probe moves one slot forward, wrapping from to by modular arithmetic. Keep the hash function and key equality fixed while hash table records are stored.
Use three distinguishable slot states: occupied by a live hash table record; never used since initialization or rebuilding, written
E; or deleted, written D, a tombstone in open addressing. Lookup compares occupied hash table keys using key equality, stops at E, and continues past D.[ref]5.2 LinearHashTable: Linear Probing. Open Data Structures: An Introduction by Pat Morin; Section 5.2, three entry types and find: nil stops lookup, del does not
For an original example, take an eight-slot array, integer hash table keys, and the hash function . Start with all slots
E and insert the hash table records in that order. The insertion hash table probe traces, expressed as array indices, areThe resulting array holds hash table keys at array indices , with E in the other four slots. The first three hash table keys have the same initial array index, a hash collision; the fourth begins at but joins the same linear probing cluster. Lookup of examines array indices , rejecting before returning . Lookup of absent examines , including the stopping E: five hash table probes for a hash table load factor .Bound lookup to at most hash table probes, even if no
E remains. For algorithm termination, the first array indices are distinct: equality of and implies that divides by modular arithmetic, and forces . They therefore cover the entire finite set of slots exactly once. If no occupied hash table key matches and no E is encountered, exhausting these hash table probes establishes absence; wrapping around again supplies no new information.[ref]Lecture 10: Hashing III: Open Addressing. 6.006 Introduction to Algorithms, Fall 2011 by Massachusetts Institute of Technology, 6.006 course staff; Lecture 10: Hashing III: Open Addressing, pp. 1–2, probe permutation requirement and Search loop with m trials
The attraction is a compact array and a simple hash table probe rule. Consecutive slots can benefit from spatial locality, although actual memory cache behavior depends on representation and hardware. Correctness rests on preserving the search route; speed depends on how long that route becomes. The linear probing cluster below explains why even a moderate hash table load factor gives no universal constant lookup bound.
Linear probing cluster 2026-10-18
A maximal consecutive run of occupied or deleted slots in linear probing, bounded by never-used slots when any exist; adjacency wraps around by modular arithmetic. Deleted slots still belong to the search run.[ref]
5.2 LinearHashTable: Linear Probing. Open Data Structures: An Introduction by Pat Morin; Section 5.2.1, definition of a run using non-nil entries and modular indices
In the eight-slot example, array indices form one linear probing cluster. Inserting absent hash table key starts at , passes the occupied slots , and fills . This extends the same linear probing cluster despite having a different initial array index from . A hash collision at the initial slot is enough to make later slots compete too.
For a worst-case family, insert integer hash table keys into an empty capacity- array, using the hash function , where . They occupy array indices . Lookup of absent needs hash table probes. Taking gives hash table load factor at most while the number of hash table probes grows with . Thus occupancy alone cannot promise constant lookup work.
Before any rebuilding, bounded lookup, deletion by hash table key, and insertion with a duplicate check each have worst-case time complexity in Big O notation, assuming constant-cost hash function evaluation, array access and key equality. The counterexample gives a matching linear worst-case growth in the number of hash table probes. Hash table resizing is additional work; expensive string comparisons or hashing also fall outside these constant-cost assumptions.
Modular exponentiation Created 2026-10-06 Updated 2026-10-20
Modular exponentiation computes the remainder for an integer base , a nonnegative integer exponent , and, here, an integer modulus . It applies exponentiation by squaring while reducing after each multiplication, including each squaring. The result is the unique representative in . There is no requirement that the base be coprime to the modulus when the exponent is nonnegative.[ref]
A Computational Introduction to Number Theory and Algebra by Victor Shoup. Section 3.4, pp. 64–66: canonical representatives, modular products, and nonnegative-exponent repeated squaring
Take , , and . Initialize ; the remaining digits giveHence . The final operation multiplies by , since the preceding square has already been reduced. The computation never needs to construct .
In general reduce the base first, . For , initialize and process the remaining binary digits with , followed, for a digit one, by . The loop invariant iswhere is the processed prefix value. The congruence is preserved because modular arithmetic respects multiplication: if , then and . Thus changing representatives never changes the final congruence class.
Both factors in every product are less than , so the unreduced product is less than , and the stored result is again less than . The same bounds hold for a gigantic exponent, such as : there are squarings, each on bounded-size residues. For base two, the corresponding ordinary power would have binary digits. The benefit is avoiding the huge ordinary power altogether, rather than constructing it and taking one final remainder. Initial reduction is essential when the supplied base is much larger than the modulus.
For , return under the same empty-product convention as exponentiation by squaring. For , require , find the modular multiplicative inverse , and compute ; the extended Euclidean algorithm can find that inverse. Its cost is separate from the positive-exponent binary powering multiplication count. For example, , while is undefined because and are not coprime.
A reversible computation gives the coherent quantum modular exponentiation used in quantum order finding and discrete-logarithm Fourier sampling.
Modular multiplicative inverse Created 2026-09-24 Updated 2026-10-13
For integers and , a modular multiplicative inverse is a congruence class satisfying . It exists exactly when . Necessity follows because every common divisor of would divide . Conversely, Bézout's identity gives for coprime integers, making an inverse. This is the basic bridge from greatest common divisor calculations to reversible modular arithmetic.
For example, , so . The modular congruence therefore has the unique solution class . Multiplication by sends all seventeen residue classes to different classes; multiplying by reverses it. The inverse criterion and its algorithmic construction are presented in Ankur Moitra, MIT 18.200, 2024, modular inverses and Euclid's algorithm.
By contrast, has no modular inverse modulo . Its products have only residues . Consequently has no solution, while has five solution classes, . Dividing by a noninvertible residue would discard this distinction. In a prime field , every nonzero residue is invertible; a general integer modulus instead gives a quotient ring that can have zero divisors.
Number-theoretic transform 2026-10-20
A number-theoretic transform is a discrete Fourier transform computed in modular arithmetic. In a finite field with elements, choose a primitive root of unity of order dividing . The transform above is inverted using and . With sufficient zero padding, it computes polynomial products exactly modulo , avoiding floating-point arithmetic rounding.
Number theory Created 2026-09-24 Updated 2026-10-13
Number theory studies integers, their divisibility, and the patterns created by prime numbers. Its questions often have short statements but rigid answers: which integers divide a given one, when does an equation have integer solutions, and when can arithmetic with congruence classes be reversed? The Euclidean algorithm and modular multiplicative inverses connect these questions through explicit calculations.
For example, and . Their shared prime factors give greatest common divisor . The Euclidean algorithm reaches that answer without finding either complete prime factorization. It also produces , an instance of Bézout's identity. This relation certifies every common divisor at once and solves an associated linear Diophantine equation.
Modular arithmetic retains only remainders, but the lost information can be surprisingly controlled. Multiplication by modulo is a permutation of all residue classes, because has modular inverse . Multiplication by modulo collapses fifteen residue classes to three. Thus an apparently small change in the modulus changes whether a calculation can be reversed. The Chinese remainder theorem explains another kind of compression: remainders modulo coprime integers can be combined into one remainder modulo their product.
Simple restrictions help reveal the structure without telling the whole story. Every prime number greater than three is congruent to or modulo : the other four residue classes force divisibility by or . The converse fails because and lie in those classes but are composite numbers. Necessary conditions are useful filters, not substitutes for primality testing.
The subject's appeal lies partly in this tension: prime factorization gives a clean description of every positive integer, while identifying factors and predicting their distribution lead to substantial further questions. Analytic number theory uses tools from analysis to study global patterns, and algebraic number theory extends arithmetic into number fields. Applications include cryptography and error-correcting codes; MIT's discrete applied mathematics course develops modular structures for both purposes. [ref]
https://ocw.mit.edu/courses/18-200-principles-of-discrete-applied-mathematics-spring-2024/mit18_200_s24_lec15.pdf. Ankur Moitra, MIT 18.200, Modular Arithmetic and Elementary Algebra, 2024, introduction
Euclid's Elements already gives a greatest-common-measure construction in Book VII, Proposition 2, and the argument that a finite list cannot exhaust the prime numbers in Book IX, Proposition 20. These are documented ancient treatments, rather than evidence that all of number theory began with one author. [ref]
https://mathcs.clarku.edu/~djoyce/java/elements/bookVII/propVII2.html. Euclid, Elements VII.2, translated text hosted by David Joyce
[ref]https://mathcs.clarku.edu/~djoyce/java/elements/bookIX/propIX20.html. Euclid, Elements IX.20, translated text hosted by David Joyce
p-adic integer Created 2026-09-28 Updated 2026-10-14
The p-adic integers retain arithmetic information modulo arbitrarily high powers of one prime number . They form the subringof the P-adic numbers. Their p-adic absolute value bounds the allowed denominators: belongs to , while does not. The name therefore describes a local arithmetic ring, not just the ordinary integers.[ref]
P-adic numbers by Jan-Hendrik Evertse. §3, printed pp. 6–7: definition of Zp, rational denominators and units
A concrete description gives an element by a compatible sequence of congruence classes:The inverse limit condition says that gaining more precision must preserve the digits already determined. Each is a residue modulo ; choosing its least nonnegative integer representative gives . The ordinary integer gives residues modulo .
The useful feature is that one exact object organizes an unlimited family of finite modular arithmetic calculations. Addition and multiplication are performed modulo each , and the results remain compatible. A p-adic digit expansion makes this concrete:The expansion is unique and converges in the p-adic metric; its higher powers have smaller p-adic absolute value. The digit agreement and p-adic distance criterion tells exactly which finite digits a precision bound preserves.[ref]













