Triorthogonal Matrices: Quantum Coding & Distillation
- Triorthogonal matrices are binary matrices characterized by pairwise and triple-wise parity constraints that bridge classical linear codes with CSS stabilizer codes.
- They enable transversal non-Clifford gate implementations, facilitating key processes such as magic-state distillation in fault-tolerant quantum computing.
- Multiple construction methods—including linear-equation search, randomized algorithms, and ILP formulations—support efficient design and classification of triorthogonal codes.
Triorthogonal matrices are binary matrices over whose row supports obey simultaneous pairwise and triple-wise parity constraints. In quantum information, they furnish a combinatorial interface between classical linear codes and Calderbank–Shor–Steane (CSS) stabilizer codes, with the distinctive feature that the resulting quantum codes admit transversal non-Clifford operations, most notably the gate and, in related constructions, . For that reason, triorthogonality has become a standard organizing principle for magic-state distillation, transversal-gate analysis, and the construction of CSS- code families (Bravyi et al., 2012, Paetznick et al., 2013).
1. Definition and basic algebraic structure
A binary matrix with rows is called triorthogonal when two conditions hold. First, every pair of distinct rows is orthogonal: Second, every triple of distinct rows has even triple overlap: Equivalently, if denotes coordinate-wise product and denotes Hamming weight modulo 0, then triorthogonality is the requirement that 1 for all pairs and 2 for all triples (Bravyi et al., 2012, Shi et al., 2024).
In most quantum-coding applications, the rows are partitioned by parity into an odd-weight block 3 and an even-weight block 4. This parity split is not merely notational. The odd rows are later interpreted as logical operators, while the even rows generate an 5-stabilizer subspace. The pairwise condition alone makes the row space self-orthogonal; the triple condition is the additional constraint that enables transversal gates above the Clifford level (Shi et al., 2024).
Several later works reformulate the same definition in adjacent languages. One may write the condition using incidence matrices for row overlaps, using Schur products and the space 6, or via “indicator polynomials” in Reed–Muller spaces. These reformulations do not change the underlying object: a triorthogonal matrix is always a matrix whose pairwise and triple-wise intersections of row supports have even parity (Camps-Moreno et al., 2024, Nezami et al., 2021).
2. From triorthogonal matrices to CSS stabilizer codes
Given a triorthogonal matrix 7, one obtains a CSS stabilizer code by assigning the even-weight rows 8 to the 9-type stabilizers and taking the orthogonal complement of the full row span to define the 0-type stabilizers. The odd-weight rows then specify logical 1 operators, and the same rows can be used to choose logical 2 operators. In the standard binary formulation, if 3 has 4 odd rows, the associated CSS code encodes 5 logical qubits into 6 physical qubits (Bravyi et al., 2012, Paetznick et al., 2013).
A common formulation writes 7 and 8, so that the quantum code is 9. In this language, the code distance is
0
while in the earlier Bravyi–Haah presentation the relevant distillation parameter is the 1-distance
2
with 3 the span of the even rows and 4 the span of all rows (Jiao et al., 7 Oct 2025, Bravyi et al., 2012).
The operational importance of the construction is that triorthogonality permits transversal implementation of non-Clifford gates. Bravyi and Haah showed that there exists a diagonal Clifford 5, built from 6 and 7 gates, such that 8 acts as logical 9 on each encoded qubit (Bravyi et al., 2012). Jones showed that triorthogonal stabilizer codes also admit transversal implementation of 0, and that logical Hadamard is not purely transversal because no triorthogonal code is fully self-dual; instead, Hadamard can be completed fault-tolerantly by combining transversal 1 with error correction (Paetznick et al., 2013). More recently, a logical Hadamard protocol based on transversal 2 teleportation and code-switching between a triorthogonal code and a symmetric CSS code was proposed, with the claim that these gadgets can be folded into Steane error correction without increasing the ancilla count (Jiao et al., 7 Oct 2025).
3. Role in magic-state distillation
Triorthogonal matrices were introduced in their modern form as a tool for low-overhead magic-state distillation. In the Bravyi–Haah protocol, one prepares an encoded state 3, applies noisy physical 4 gates supplied by imperfect 5-states, performs a diagonal Clifford cleanup, measures the 6-stabilizers coming from the even-row subspace, post-selects on the trivial syndrome, and then decodes. If the input state is 7, the output error on each logical qubit scales as 8, where 9 is the 0-distance of the code, and the success probability is 1 (Bravyi et al., 2012).
The asymptotic overhead is expressed through the exponent
2
so that the resource cost behaves as 3. Bravyi and Haah constructed an explicit infinite family with 4 and 5, yielding 6 as 7, together with leading-order behavior
8
for the distillation error (Bravyi et al., 2012).
The framework was later generalized beyond single-qubit 9 states. Haah and Hastings introduced generalized triorthogonal matrices with row blocks 0, 1, 2, and 3, arranged so that transversal 4 induces not only logical 5 gates but also controlled-6 and 7 on designated logical subsets. In that setting they presented both randomized and Reed–Muller-based constructions and showed an asymptotic distillation efficiency 8 (Haah et al., 2017).
The use of triorthogonality in distillation is not limited to abstract asymptotics. Jones adapted the triorthogonal-code approach to Toffoli-state distillation and gave an explicit leading-order estimate
9
for a family of 0 codes used in that setting (Paetznick et al., 2013). This places triorthogonal matrices at the intersection of error detection, transversal-gate synthesis, and resource-state production.
4. Classification and the small-code regime
A substantial structural advance is the classification of all small triorthogonal codes with 1. In that regime, there are exactly 2 inequivalent unital triorthogonal subspaces 3, each containing the all-ones vector. Every triorthogonal code with parameters 4 and 5 descends from exactly one of these 6 parent subspaces by puncturing and qubit deletion (Nezami et al., 2021).
The puncturing operation is organized by a subset 7 of size 8 satisfying the full-rank condition 9. Depending on parity, one obtains either an even descendant with 0 and 1, or an odd descendant with 2 and 3. Qubit deletion then removes repeated or zero columns from the resulting generator. This descendant structure gives a canonical way to view small triorthogonal codes as arising from a finite list of “parent” subspaces (Nezami et al., 2021).
The classification is expressed through Reed–Muller theory. To each unital subspace 4 of dimension 5 one associates an indicator polynomial
6
of Hamming weight 7, defined so that 8 precisely when 9 is a column of a generator for 0. The key lemma is that 1 is triorthogonal unital if and only if 2 and 3 has no linear factor. Thus the small-code classification reduces to classifying low-weight codewords in Reed–Muller codes. Using the results of Kasami, Tokura, and Azumi together with an exhaustive computer search, the authors found exactly 4 affine-inequivalent such polynomials of weight 5 (Nezami et al., 2021).
Several concrete consequences follow. The canonical 6 distillation code arises from the indicator polynomial 7 with 8 and 9, followed by puncturing. A new extremal example in the classified range is the 00 code obtained as the even descendant of subspace 01. The paper also proves a rate bound: for any triorthogonal code 02, one has 03. In the range 04, no code achieves 05 (Nezami et al., 2021).
5. Construction methods, existence criteria, and decoding
Beyond the small-code classification, several complementary methods have been developed for constructing triorthogonal matrices. One early approach is the Bravyi–Haah linear-equation search: one introduces a binary variable 06 for each column type 07 and translates pairwise and triple-wise overlap conditions into sparse linear equations over 08. With additional constraints excluding the all-zero column and repeated column pairs, this search produced numerous examples, including a 09 triorthogonal matrix whose code has distance 10 and yields a 11 distillation routine (Bravyi et al., 2012).
Haah and Hastings proposed a randomized row-by-row construction for generalized triorthogonal matrices. Each new row is chosen uniformly from the linear subspace defined by all previously imposed pairwise and triple-wise constraints together with the required row parity. They showed, by a first-moment argument and a version of the Lovász Local Lemma, that for 12 with 13 small, the algorithm succeeds with high probability, the code distance obeys 14, and the distillation efficiency satisfies 15 (Haah et al., 2017).
A more recent constructive route uses dual-distance constraints. For an even-weight generator matrix 16, one lets 17 be the classical code generated by 18 and imposes the conditions 19 on the dual weight enumerator, with
20
where 21 are binary Krawtchouk polynomials. Combined with linear overlap constraints, this yields an integer linear programming formulation whose feasibility is equivalent to the existence of an even-weight triorthogonal 22 of length 23 and dual distance at least 24. Using symmetry constraints, the method found nontrivial 25 triorthogonal codes for odd 26, including 27, and many of these are not generated by classical triply-even codes. The same work evaluated decoding over the dephasing channel and compared bounded-distance decoding, belief propagation plus ordered-statistics post-processing, and a GRAND-based decoder adapted to the quantum setting, identifying the latter as a promising option (Baldelli et al., 23 May 2026).
An additional algebraic construction starts from binary self-dual codes. Given a self-dual code 28 of dimension 29, Shi et al. described an algorithm that grows a maximal triorthogonal subspace by repeatedly solving linear equations of the form 30 for all distinct 31 already chosen. If the resulting triorthogonal subspace has dimension 32, then
33
The same work generalized shortening and extending to triorthogonal matrices and gave simple propagation rules such as concatenation and direct sum (Shi et al., 2024).
6. Generalizations, equivalence theory, and nonbinary variants
Triorthogonality has been extended in several directions. The most direct binary generalization is the generalized triorthogonal matrix of Haah and Hastings, in which the inhomogeneous cubic overlap conditions are arranged so that transversal 34 implements a prescribed collection of logical 35, controlled-36, and 37 gates. Their Reed–Muller construction uses the relations
38
and produces a generalized triorthogonal code with parameters
39
when 40. For 41, this yields a 42 code used to distill 43 logical 44 states from 45 noisy 46 gates, with roughly 47 48 gates per output 49. The same paper also reported punctured Reed–Muller triorthogonal codes with parameters 50, 51, and 52 (Haah et al., 2017).
A separate line of work studies binary triorthogonal codes as objects in their own right, rather than solely as distillation gadgets. In the CSS-53 poset framework, a triorthogonal code 54 is minimal if and only if 55 and all nonzero words have even weight, and maximal if and only if 56. The same analysis characterizes which row-equivalent generators remain triorthogonal: if 57 with odd rows in 58 and even rows in 59, then 60 is triorthogonal exactly when
61
with 62 a permutation matrix, 63 invertible, and 64 arbitrary. Consequently, any equivalent matrix that is also triorthogonal gives rise to a triorthogonal quantum code with the same parameters (Camps-Moreno et al., 2024).
There is also a qutrit analogue. Over 65, a triorthogonal matrix 66 is partitioned into 67 and 68 so that distinct rows are pairwise orthogonal modulo 69, all triples of rows satisfy the ternary cubic orthogonality condition, every row of 70 is self-orthogonal, and every row of 71 is not self-orthogonal. From this structure one obtains a family of qutrit CSS codes with parameters 72 for 73. For the maximal-rate choice 74, the yield parameter is
75
The case 76 gives a 77 code with yield parameter 78, which was reported to outperform all known qubit triorthogonal codes of size less than a few hundred qubits (Prakash et al., 2024).
Triorthogonal matrices therefore occupy a broad technical niche. At the binary level they are simultaneously a class of self-orthogonal classical generators, a source of CSS-79 codes, and a mechanism for transversal non-Clifford gates. At the level of contemporary research, they support exact small-parameter classification, randomized and ILP-based synthesis, decoding studies, extensions to 80 and 81, structural ties to self-dual and CSS-82 theories, and nonbinary generalizations relevant to qutrit magic-state distillation (Nezami et al., 2021, Baldelli et al., 23 May 2026, Prakash et al., 2024).