How this calculation works
Compute bases for the sum and intersection of two full-rank integer lattices in the same coordinates. Exact unimodular Hermite-normal-form transformations preserve the integer constraints, avoiding the incorrect shortcut of finding a rational nullspace and rounding its basis vectors. Columns are lattice generators throughout the calculation.
L1∩L2 from integer kernel of [A|−B]; L1+L2=columns[A|B].A worked example
For lattices 2Z² and 3Z², the intersection is 6Z² and their sum is Z². Integer kernel and column-HNF operations recover full-rank bases for both.
Good to know
Full-rank square integer bases dimension1–3, exact HNF transformations. Columns are basis vectors; not intersection of real spans or rounded rational nullspace.
Reference: Method reference: Integer lattice intersection and sum basis calculator (opens in a new tab) ↗
Describe a lattice with integer column generators
A square full-rank integer matrix A generates all vectors Az with integer coefficient vector z. Its real span fills the ambient space, but it usually occupies only a discrete subset of that space. Two such full-rank lattices therefore have identical real spans while their lattice intersection can be much sparser.
Both bases must use the same ambient coordinate system and dimension. Reordering coordinates in only one input changes the geometric lattice rather than just its notation. Columns are generators; transposing a nonsymmetric matrix generally describes a different lattice and should not be used merely to make it resemble another package’s display.
The Integer relation calculator with coefficient and precision limits searches bounded coefficients relating decimal values. Full-rank lattice intersection here solves exact integer membership and returns column bases without a coefficient search bound.
Separate sum from intersection
The sum lattice contains all a+b with a in the first lattice and b in the second. Concatenating the two generator matrices supplies a generating set, and column HNF reduces it to a basis. The intersection instead contains vectors that can be generated by both bases independently.
Neither operation is the union of two point sets. A union of lattices need not itself be a lattice, while the sum is closed under integer addition and subtraction. The intersection retains common integer membership, not simply common membership in their real spans.
Derive the integer-kernel construction
A common vector satisfies Ax=By with integer x and y. Equivalently, the block matrix [A|−B] times the stacked coefficient vector is zero. The needed kernel is an integer module kernel, so integer combinations of its basis must generate every integral solution.
The HNF routine returns a full unimodular column transformation. Columns corresponding to zero transformed columns give that integer kernel. Multiplying the first coefficient block by A produces intersection generators. A final HNF gives a compact column basis and retains exact membership information.
Check the diagonal example
For A=2I and B=3I in two dimensions, the first lattice requires both coordinates even and the second requires both divisible by three. Common points have both coordinates divisible by six, so the intersection basis is 6I up to the chosen HNF convention.
The sum is all of Z squared because integer combinations of two and three generate one in each coordinate. Its HNF basis is I. This example shows that sum and intersection can move in opposite density directions even though both input real spans are already the whole plane.
Avoid rounding rational nullspaces
A rational nullspace basis spans all rational solutions, but clearing each basis vector’s denominators separately need not produce a saturated basis of all integer solutions. Integer combinations of those cleared vectors can miss legitimate integer points. Rounding is even worse because it can destroy the exact equation.
The unimodular transformation approach preserves the integer module by construction. The output is therefore not labeled as an approximate intersection of nearly matching vectors. If inputs come from noisy measured bases rather than exact integers, first decide what discrete model is justified; this page does not infer a nearby intended lattice.
Read HNF bases without requiring familiar vectors
A lattice can have many different integer bases related by unimodular transformations. HNF selects one conventional basis, so the returned columns need not resemble the original coordinate directions or a hand-chosen basis. Compare generated lattices and membership rather than raw column equality alone.
For full-rank sublattices, determinant magnitudes describe fundamental-cell volumes and provide useful consistency checks. Their relationship to indices can help audit a result, but a determinant alone does not identify the actual lattice. Two distinct lattices can share the same cell volume.
Keep rank and ambient restrictions explicit
This version supports full-rank square integer bases in dimensions one through three. A lower-rank embedded lattice requires handling a different ambient span and is rejected rather than padded with invented directions. Intermediate integer-size limits from HNF also apply to keep exact transformations bounded.
No closest-vector search, lattice reduction heuristic or geometric alignment is performed. Those are separate tasks elsewhere in the catalogue. Retain the column convention and common coordinate frame with both returned bases so that the sum and intersection can be reproduced exactly.
A few questions, answered
Is lattice intersection just real subspace intersection?
No. Integer membership is essential. Full-rank lattices share the whole real span but can have a much smaller common lattice.
Why not round a rational nullspace basis?
Rounding can break the equations, and separately clearing denominators can miss integer solutions. A unimodular integer-kernel construction is used instead.
Are basis vectors rows or columns?
Columns in both inputs and outputs.
Can I enter rank-deficient rectangular generators?
Not in this version. It requires full-rank square bases of common dimension one through three.