Advanced maths

Exact cover calculator with solution counts and chosen subsets

Find and count exact covers of a finite ground set by selected input subsets.

Your numbers

Rows on separate lines; comma-separated values within each row.

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

Find and count exact covers of a finite ground set by selected input subsets. Every ground element must appear in exactly one chosen row, so overlap between chosen subsets is forbidden. The tool returns an exact count and one witness of selected row indices when feasible. Input rows are labeled choices; equal subsets entered on different rows remain distinct alternatives.

THE FORMULAChoose rows so Σchosen 1[element∈row]=1 for every ground element.

A worked example

The six subsets are all pairs from four elements. An exact cover is a perfect pairing: {01,23}, {02,13}, or {03,12}. There are three exact covers. Overlapping rows such as {01,02} do not qualify even though they cover several elements.

Good to know

≤20 elements and 1–25 nonempty labeled subset rows. Exact counting capped at 1,000,000 states. Repeated equal subset rows are different selectable row labels; choose one if selected, never both with overlapping elements. No minimum-cost objective or incomplete count presented as final.

Exactly once is stronger than at least once

A set cover needs every element covered but permits overlap. An exact cover requires each element exactly once, so choosing two rows with a common element is invalid even if their union is correct.

The ground set is the full label range, including elements absent from every row. An absent element makes an exact cover impossible. Empty subsets are excluded because they would create optional choices that do not contribute to covering the ground set.

Exact cover chooses rows with no repeated ground elementGround set: {0,1,2}Row: {0,1}Row: {2}Every element occurs exactly once
The six subsets are all pairs from four elements. An exact cover is a perfect pairing: {01,23}, {02,13}, or {03,12}. There are three exact covers. Overlapping rows such as {01,02} do not qualify even though they cover several elements. Static schematic; numerical labels define the example.

Overlaps are forbidden and counting covers is required; minimum set cover permits overlapping coverage. The Finite semigroup Green relations calculator from an operation table offers a complementary calculation under its own stated assumptions.

Why row identity matters

Two identical subset rows may represent different placements, assignments or labeled options. The calculation treats them as separate choices, so choosing one versus the other yields different covers.

If the intended problem identifies duplicate rows, remove those duplicates before calculation. Do not divide the final count by a simple duplicate factor: different covers can use different numbers of repeated alternatives. Retaining row indices in the witness makes the counting convention explicit.

Worked example and mathematical rule

The six subsets are all pairs from four elements. An exact cover is a perfect pairing: {01,23}, {02,13}, or {03,12}. There are three exact covers. Overlapping rows such as {01,02} do not qualify even though they cover several elements.

Choose rows so Σchosen 1[element∈row]=1 for every ground element.

Branching on an uncovered element

At each search state, choose an uncovered ground element and consider rows containing it that do not intersect the already covered set. Every exact cover must select exactly one such row.

This branching rule avoids counting the same chosen-row set in every possible selection order. Integer bit masks track coverage, and arbitrary-precision integers accumulate completed covers. The search is still exponential, so a state cap prevents unsupported instances from yielding a misleading partial total.

Reading a zero result

A completed zero means no combination of the supplied rows partitions the ground set. It can arise from a missing element, forced overlapping rows or a less obvious global conflict.

The tool does not identify a smallest infeasible subproblem. A search-cap error is different: it means no complete count was established. An existing witness from another solver can be checked directly even when enumerating every possible cover would be expensive.

Checking the selected rows

Expand the returned row indices, concatenate their element lists and verify that every ground label occurs exactly once. The total cardinality of chosen subsets must equal the ground-set size.

That cardinality condition alone is insufficient because duplicated coverage could hide an uncovered element. Permuting the input row order changes witness indices but preserves the count when rows remain distinct. Relabeling ground elements consistently also preserves the combinatorial problem.

Modeling applications carefully

Exact cover is useful for tilings, assignment puzzles and selection systems after valid options have been encoded as rows. The encoding must include every constraint that needs exactly-one enforcement.

A physical placement may require several ground labels representing occupied cells and usage restrictions. The calculator does not generate those placements automatically or interpret geometry from the labels. A valid cover proves the encoded finite system is satisfiable, not that omitted real-world constraints have been addressed.

A few questions, answered

Is this a minimum set cover solver?

No. It requires exactly-once coverage and counts all labeled exact covers.

Do duplicate rows count separately?

Yes. Rows are labeled alternatives.

Why reject empty subsets?

They add optional labeled choices without covering any ground element.

Does a state-cap error mean no solution?

No. It means the complete search and count are unresolved.

Find your calculator

Start typing to explore the library.