What is Group Testing?
Group testing is a method to identify defective items in a large population using fewer tests than items. Developed around 1943 by R. Dorfman in an adaptive version (allowing several rounds of testing), the method was later studied in a non-adaptive setting, where all tests are designed in advance and run in a single round.
The key idea is that each test is applied to a pool of samples, while each sample participates in multiple pools. The test is positive if and only if the pool contains at least one defective item. A binary matrix $G \in \mathbb{B}_2^{n \times k}$ encodes the assignment: rows are samples, columns are tests, and $G_{ij} = 1$ means sample $i$ participates in test $j$.
This page provides a mathematical introduction and an interactive tool for analysing group testing matrices. The material is based on joint work with J. V. Dinesen, D. Forbes, O. Gnilke, and C. Rößing. The algebraic framework rests on the theory of residuated mappings, as developed in Blyth & Janowitz, Residuation Theory, while the coding-theoretic background can be found in Guruswami, Rudra & Sudan, Essential Coding Theory. See the references for the full list.
The Boolean Semifield $\mathbb{B}_2$
Consider the lattice $\mathbb{B}_2 := \{0, 1\}$ with order $0 < 1$. Its sup and inf operations give it the structure of a semifield, with addition $+$ (logical OR) and multiplication $\cdot$ (logical AND):
| $+$ | $0$ | $1$ |
| $0$ | $0$ | $1$ |
| $1$ | $1$ | $\mathbf{1}$ |
| $\cdot$ | $0$ | $1$ |
| $0$ | $0$ | $0$ |
| $1$ | $0$ | $1$ |
| $\oplus$ | $0$ | $1$ |
| $0$ | $0$ | $1$ |
| $1$ | $1$ | $\mathbf{0}$ |
The critical difference is highlighted: in $\mathbb{B}_2$ we have $1 + 1 = 1$ (gold), whereas in the Galois field $\mathbb{F}_2$ we have $1 \oplus 1 = 0$ (red). Over $\mathbb{B}_2$, there is no additive inverse, and hence no Gaussian elimination. This necessitates a different algebraic framework — residuation theory.
Let $(A, \leq)$ and $(B, \preceq)$ be partially ordered sets. A pair of mappings $(f, g)$ with $f: A \to B$ and $g: B \to A$ is called a residuated pair if $$f(a) \preceq b \;\Longleftrightarrow\; a \leq g(b) \quad\text{for all } a \in A,\; b \in B.$$ Here $f$ is called residuated and $g$ is called residual.
A mapping $f: \mathbb{B}_2^n \to \mathbb{B}_2^k$ is $\mathbb{B}_2$-linear if and only if it is residuated. If $f$ is represented by an $n \times k$ matrix $G$ (i.e., $f(x) = xG$), then its residual $g$ is given by $$g(y) \;=\; \overline{\,\overline{y} \cdot G^T\,},$$ where $\overline{(\cdot)}$ denotes componentwise negation.
Noiseless Group Testing
In the noiseless model, each test yields a perfectly reliable result. A binary vector $x \in \mathbb{B}_2^n$ represents the infection pattern ($x_i = 1$ if sample $i$ is defective). The test outcome is $y = xG \in \mathbb{B}_2^k$, computed over $\mathbb{B}_2$.
A central question is: can we recover $x$ from $y$, at least when the number of defectives is bounded? We write $w_H(x)$ for the Hamming weight of $x$ — the number of non-zero coordinates of $x$ — which equals the number of defective samples in the pattern $x$. Two conditions on $f$ capture recoverability, and their distinction is both subtle and important:
A group testing scheme $f: \mathbb{B}_2^n \to \mathbb{B}_2^k$ satisfies ($t$-sep) if $f$ is injective on vectors of weight at most $t$: whenever $x, y \in \mathbb{B}_2^n$ with $w_H(x) \leq t$, $w_H(y) \leq t$, and $f(x) = f(y)$, then $x = y$.
The scheme satisfies the stronger condition ($t$-dis) if: whenever $x, y \in \mathbb{B}_2^n$ with $w_H(x) \leq t$ and $f(x) = f(y)$, then $x = y$. Note that here only $x$ is required to have small weight — $y$ is arbitrary.
Both conditions are monotone: ($t$-dis) implies ($s$-dis) for all $s \leq t$, and likewise for ($t$-sep). This is immediate from the definitions, since $w_H(x) \leq s$ implies $w_H(x) \leq t$. We therefore speak of the maximum disjunctness of a scheme — the largest $t$ for which ($t$-dis) holds.
The condition ($t$-sep) merely says that different infection patterns of weight $\leq t$ produce different test outcomes — the mapping is invertible in principle. The condition ($t$-dis) is strictly stronger: it guarantees that no vector outside the Hamming ball can collide with one inside it. This has a decisive practical consequence:
The scheme represented by $G$ satisfies ($t$-dis) if and only if the residual mapping $g(y) = \overline{\,\overline{y} \cdot G^T}$ inverts $f$ on all $x \in \mathbb{B}_2^n$ with $w_H(x) \leq t$, i.e., $g(f(x)) = x$.
In other words: ($t$-dis) is equivalent to the existence of an efficient, constructive decider — the residual mapping $g$, which directly determines which items are defective. Under ($t$-sep) alone, a unique solution exists but there is no guarantee that the residual (or any efficient algorithm) can find it.
Remarkably, the stronger property admits a more efficient verification. The interactive tool below uses this residuation-based approach.
A scheme satisfying ($t$-dis) may produce false positives (declaring a healthy sample as defective) but never false negatives (missing a truly defective sample).
A Small Example: the Möbius Plane $\mathbb{M}_2$
The inversive plane $\mathbb{M}_2$ is a $3$-$(5, 3, 1)$ design with 5 points and 10 blocks (circles). Each circle passes through exactly 3 points, and any 3 points determine a unique circle. Its incidence matrix provides a $(10, 5)$-group testing scheme with maximum disjunctness $t = 1$, identifying a single defective among 10 using only 5 tests.
Drawing by Cornelia Rößing †
| A | B | C | D | E | |
| 1 | 1 | 0 | 1 | 0 | 1 |
| 2 | 0 | 1 | 1 | 1 | 0 |
| 3 | 1 | 1 | 0 | 0 | 1 |
| 4 | 1 | 0 | 0 | 1 | 1 |
| 5 | 1 | 1 | 0 | 1 | 0 |
| 6 | 0 | 1 | 0 | 1 | 1 |
| 7 | 1 | 1 | 1 | 0 | 0 |
| 8 | 1 | 0 | 1 | 1 | 0 |
| 9 | 0 | 0 | 1 | 1 | 1 |
| 10 | 0 | 1 | 1 | 0 | 1 |
Rows = samples (1–10), columns = tests (A–E).
Entry $1$: sample participates in pool.
Maximum disjunctness $t = 1$: any single
defective is recovered by the residual $g$.
Noisy Group Testing
In practice, tests may be unreliable. Experience with antigen tests during the COVID-19 pandemic shows that false-positive rates around 2% and false-negative rates exceeding 20% are realistic. We model test errors using the Hamming distance on $\mathbb{B}_2^k$. This is admittedly a simplification: the Hamming metric treats false positives and false negatives as equally costly, whereas in reality they arise with markedly different probabilities. A non-symmetric distance function — analogous to the Z-channel metric familiar from information theory — would be the more faithful model. Developing a full theory of group testing based on such an asymmetric metric remains an open research problem.
Remark. Lack of reliability is often associated with cheap tests: a less expensive assay tends to be less accurate. Error-correcting group testing offers a practical trade-off — it can compensate for reduced reliability without requiring one to pay for more expensive, higher-accuracy tests.
Caveat: Over $\mathbb{B}_2$, the Hamming distance does not enjoy all its familiar properties — in particular, it is not translation-invariant, since $\mathbb{B}_2$ has no subtraction. At least the following expression remains valid: $$d_H(x, y) \;=\; w_H(x) + w_H(y) - 2\,w_H(x \cdot y),$$ where $x \cdot y$ denotes the coordinatewise (Schur/Hadamard) product.
Codes over $\mathbb{B}_2$
Given a generator matrix $G \in \mathbb{B}_2^{n \times k}$ and a parameter $t$, we define the code $$C_t \;=\; B_n(t, 0) \cdot G \;=\; \{x G \mid x \in \mathbb{B}_2^n,\; w_H(x) \leq t\},$$ where $B_n(t, 0)$ is the Hamming ball of radius $t$ around the origin. The minimum distance $d_\min(C_t)$ determines the error-correction capability: up to $e = \lfloor(d_\min - 1)/2\rfloor$ faulty test results can be corrected.
As $t$ increases, the codes are nested: $\{0\} = C_0 \subseteq C_1 \subseteq \cdots \subseteq C_n$, and their minimum distances decrease — identifying more defectives leaves less room for error correction.
Group Testing with Barbilian Spaces
Let $\mathbb{F}_q$ be a finite field and $n \geq 2$. The Barbilian space $\mathrm{Barb}(q, n)$ is the incidence structure $(P, B)$, where $P$ consists of the points and $B$ of the hyperplanes of the projective space $\mathbb{P}(q, n)$. It forms a $2$-$\big(\frac{q^{n+1}-1}{q-1},\; \frac{q^n-1}{q-1},\; \frac{q^{n-1}-1}{q-1}\big)$ design.
For a prime power $q$ and integer $n \geq 2$, let $G$ be an incidence matrix of $\mathrm{Barb}(q, n)$. Then:
- The scheme tests $N = \frac{q^{n+1}-1}{q-1}$ participants using $K = N$ tests.
- Its maximum disjunctness is $t = q$.
- The minimum distance of $C_t = B_N(t, 0) \cdot G$ is: $$d_\min \;=\; \begin{cases} \frac{q^n - 1}{q-1} & \text{if } t = 1,\\ q^{n-1} - (t-2)\,q^{n-2} & \text{if } 2 \leq t \leq q.\end{cases}$$
Why not insist on $K \ll N$?
In classical noiseless group testing, the primary goal is to minimise the number of tests $K$ relative to the number of participants $N$. This remains a valid and important objective. However, when tests are unreliable, the scheme must carry redundancy to enable error detection or correction — and redundancy requires additional tests. Depending on the error probability and the desired correction capability, this may lead to $K$ close to $N$, equal to $N$, or even $K > N$.
The Barbilian spaces happen to produce schemes with $K = N$, a consequence of the inner symmetry of the underlying projective geometry (points and hyperplanes are equinumerous). They are one family of examples — not the final word on the matter. In general, the problem of minimising $K$ subject to a given $t$-disjunctness and a given error-correction guarantee remains wide open.
To appreciate the value of pooling, consider the trivial alternative: the $N \times N$ identity matrix $I_N$ also has $K = N$ and maximum disjunctness $t = N$ — it identifies any number of defectives. Yet its codes $C_t$ have $d_\min = 1$ for every $t \geq 1$: a single faulty test causes misidentification with no possibility of detection. Pooling is the mechanism that converts tests into redundancy and hence into robustness.
Two Examples at $N = 31$: Dense vs. Sparse
The following two Barbilian schemes both operate on $N = 31$ participants with $K = 31$ tests, but with strikingly different characteristics. Their incidence matrices are circulant, generated by a single row.
| $t$ | $|C_t|$ | $d_\min$ | corrects |
|---|---|---|---|
| 1 | 32 | 15 | 7 tests |
| 2 | 497 | 8 | 3 tests |
Each row has weight 15 (about half). Maximum disjunctness $t = 2$. The dense pooling yields high redundancy: even $C_2$ corrects 3 faulty tests.
| $t$ | $|C_t|$ | $d_\min$ | corrects |
|---|---|---|---|
| 1 | 32 | 6 | 2 tests |
| 2 | 497 | 5 | 2 tests |
| 3 | 4,528 | 4 | 1 test |
| 4 | 32,768 | 3 | 1 test |
| 5 | 174,898 | 2 | detects 1 |
Each row has weight 6 (about one fifth). Maximum disjunctness $t = 5$. The sparse structure trades error-correction strength for a much higher disjunctness ceiling.
| $\mathrm{Barb}(2,\,4)$ | Dense. Maximum disjunctness $t = 2$, but powerful error correction: $d_{\min} = 8$ at $t = 2$. |
| $\mathrm{Barb}(5,\,2)$ | Sparse. Maximum disjunctness $t = 5$, but weaker error correction: $d_{\min} = 2$ at $t = 5$. |
| $I_{31}$ | Trivial. Maximum disjunctness $t = 31$, but $d_{\min} = 1$ for every $C_t$ — no error handling at all. Pooling is the mechanism that converts tests into redundancy. |
Error-Correcting Group Testing Playground (ECGT)
Select a pre-loaded matrix or enter your own. The analyser computes the maximum $t$-disjunctness and the minimum distance of the associated codes $C_t$. Once the matrix is analysed, the ECGT simulation lets you choose an infection pattern $x$, introduce test errors, and watch the decoder recover $x$ — or fail when too many errors are present.
Enter a binary matrix (rows separated by newlines, entries by spaces or commas). Loads automatically when you stop typing or leave the field.
Select or enter a matrix to begin.
References
- [1] R. Dorfman, The detection of defective members of large populations, Ann. Math. Statist. 14 (1943), 436–440.
- [2] G. O. H. Katona, Combinatorial Search Problems, in: A Survey of Combinatorial Theory, North-Holland, 1973, 285–308.
- [3] T. S. Blyth and M. F. Janowitz, Residuation Theory, Pergamon Press, 1972.
- [4] V. Guruswami, A. Rudra, and M. Sudan, Essential Coding Theory, 2021.
- [5] J. V. Dinesen, O. W. Gnilke, M. Greferath, C. Rößing, Group testing via residuation and partial geometries, Advances in Mathematics of Communications 19 (2025), 397–405.
- [6] M. Greferath and C. Rößing, Group Testing with Error-Correction Capabilities for General Pandemics, Elsevier IFAC-Papers OnLine 55 (2022), 295–298.