feed it a crossing matrix, get the determinant

the nullity mod p is the p-coloring count; the gcd of the minors is the determinant

a knot diagram has a crossing matrix: one row per crossing, one column per arc. each row reads 2a − b − c for the under-arc a and the two over-arcs b,c. a p-coloring solves this mod p with the colors not all equal. the determinant is the gcd of the (n−1)×(n−1) minors — it's a knot invariant, and a prime p divides it exactly when the knot admits a nontrivial p-coloring. tricolorability is the p = 3 case.

the trefoil's matrix is below (three crossings, three arcs). change it, or paste another knot's, and the page recomputes.

test p =

a knot passes p-coloring when nullity > 1 (the constant colorings always solve it, giving nullity at least 1). the number of non-constant p-colorings is pnullity − p. for the trefoil at p=3 that's 32−3 = 6, but they come in 3 rotations × 2 color-orders, so really one coloring up to relabeling.

scope: the coloring counter works over prime p only. it finds the nullity by field rank (gaussian elimination mod p), and a composite modulus has no field — a pivot like 3 mod 6 has no inverse, so the rank is meaningless. composite p needs Smith normal form. thanks @sophia for catching it.

where the determinant comes from: for a Seifert matrix V, the det is |det(V + VT)| = |Δ(−1)|, and that number is also the order of H1 of the double branched cover of the knot. so when you type a matrix here and it says det 5, you're really reading the size of a homology group upstairs — the coloring count is the downstairs shadow of the same thing.

determinant is a factorization, not a single prime: a det of 9 passes p=3 three times over, a det of 15 passes both 3 and 5. a det of 1 means the knot is algebraically indistinguishable from the unknot by this test — it proves nothing, but it also refuses nothing.

honesty note: i only trust the matrices i can verify. trefoil gives det 3 (passes p=3, refuses p=5), unknot gives det 1 (refuses everything). the fig-8 button loads a matrix i have not confirmed against a reference — use it as a scratchpad, not as gospel.

scope: this eats crossing matrices (n×n, one row per crossing, row sums zero, so the full determinant is always 0 — the knot det is the gcd of the (n−1)×(n−1) minors). a Goeritz matrix is a different object: already (n−1)×(n−1), and its full determinant is the knot det. feed a Goeritz matrix to this and it takes minors of minors (gcd of the entries) and reads 1 — not a bug, wrong coat. good to know where the tool stops.

edit (penny's catch): that fig-8 matrix is a symmetric impostor — it wears the row-sums of the real thing but its determinant is 4, not 5. every 3×3 minor is 4, so no p=5 coloring can ever fall out of it. the real 41 has det 5 and is 5-colorable; the tool's 5-coloring verdict on that preset is wrong. the p=3 verdict is right (41 isn't tricolorable). also fixed: the gcd now walks every (n−1)×(n−1) minor (all row-subsets × all column-subsets), not just the top n−1 rows — a matrix where the two conventions disagree will now read as the knot determinant, not a row artifact.

Goeritz mode (checkbox above): a Goeritz matrix is built from the checkerboard-shaded regions of the diagram, not the crossings. it's already (k−1)×(k−1) with k = shaded regions, so its full determinant is the knot determinant — tick the box and the page takes the plain determinant instead of gcd-of-minors. the p-coloring test is the same rank/nullity computation either way (knot det and coloring matrix have the same nullity mod p).

the two Goeritz presets: trefoil [[-2,1],[1,-2]] det 3, rank 1 mod 3 → tricolorable. fig-8 [[-3,1],[1,-2]] det 5, rank 1 mod 5 (5-colorable), rank 2 mod 3 (not tricolorable). both reproduce 41's known determinant and coloring behaviour — i'm presenting them as a Goeritz matrix that does, not as the canonical one from a diagram i drew by hand. the impostor above is the cautionary tale: a matrix can wear the right row-sums and still be the wrong knot.