Papers
Topics
Authors
Recent
Search
2000 character limit reached

Triorthogonal Matrices: Quantum Coding & Distillation

Updated 7 July 2026
  • 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 F2\mathbb F_2 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 TT gate and, in related constructions, CCZCCZ. For that reason, triorthogonality has become a standard organizing principle for magic-state distillation, transversal-gate analysis, and the construction of CSS-TT code families (Bravyi et al., 2012, Paetznick et al., 2013).

1. Definition and basic algebraic structure

A binary matrix GF2m×nG\in\mathbb F_2^{m\times n} with rows g1,,gmg_1,\dots,g_m is called triorthogonal when two conditions hold. First, every pair of distinct rows is orthogonal: j=1nGajGbj0(mod2)for all ab.\sum_{j=1}^n G_{a j}G_{b j}\equiv 0 \pmod 2 \quad\text{for all }a\neq b. Second, every triple of distinct rows has even triple overlap: j=1nGajGbjGcj0(mod2)for all distinct a,b,c.\sum_{j=1}^n G_{a j}G_{b j}G_{c j}\equiv 0 \pmod 2 \quad\text{for all distinct }a,b,c. Equivalently, if \wedge denotes coordinate-wise product and |\,\cdot\,| denotes Hamming weight modulo TT0, then triorthogonality is the requirement that TT1 for all pairs and TT2 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 TT3 and an even-weight block TT4. This parity split is not merely notational. The odd rows are later interpreted as logical operators, while the even rows generate an TT5-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 TT6, 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 TT7, one obtains a CSS stabilizer code by assigning the even-weight rows TT8 to the TT9-type stabilizers and taking the orthogonal complement of the full row span to define the CCZCCZ0-type stabilizers. The odd-weight rows then specify logical CCZCCZ1 operators, and the same rows can be used to choose logical CCZCCZ2 operators. In the standard binary formulation, if CCZCCZ3 has CCZCCZ4 odd rows, the associated CSS code encodes CCZCCZ5 logical qubits into CCZCCZ6 physical qubits (Bravyi et al., 2012, Paetznick et al., 2013).

A common formulation writes CCZCCZ7 and CCZCCZ8, so that the quantum code is CCZCCZ9. In this language, the code distance is

TT0

while in the earlier Bravyi–Haah presentation the relevant distillation parameter is the TT1-distance

TT2

with TT3 the span of the even rows and TT4 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 TT5, built from TT6 and TT7 gates, such that TT8 acts as logical TT9 on each encoded qubit (Bravyi et al., 2012). Jones showed that triorthogonal stabilizer codes also admit transversal implementation of GF2m×nG\in\mathbb F_2^{m\times n}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 GF2m×nG\in\mathbb F_2^{m\times n}1 with error correction (Paetznick et al., 2013). More recently, a logical Hadamard protocol based on transversal GF2m×nG\in\mathbb F_2^{m\times n}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 GF2m×nG\in\mathbb F_2^{m\times n}3, applies noisy physical GF2m×nG\in\mathbb F_2^{m\times n}4 gates supplied by imperfect GF2m×nG\in\mathbb F_2^{m\times n}5-states, performs a diagonal Clifford cleanup, measures the GF2m×nG\in\mathbb F_2^{m\times n}6-stabilizers coming from the even-row subspace, post-selects on the trivial syndrome, and then decodes. If the input state is GF2m×nG\in\mathbb F_2^{m\times n}7, the output error on each logical qubit scales as GF2m×nG\in\mathbb F_2^{m\times n}8, where GF2m×nG\in\mathbb F_2^{m\times n}9 is the g1,,gmg_1,\dots,g_m0-distance of the code, and the success probability is g1,,gmg_1,\dots,g_m1 (Bravyi et al., 2012).

The asymptotic overhead is expressed through the exponent

g1,,gmg_1,\dots,g_m2

so that the resource cost behaves as g1,,gmg_1,\dots,g_m3. Bravyi and Haah constructed an explicit infinite family with g1,,gmg_1,\dots,g_m4 and g1,,gmg_1,\dots,g_m5, yielding g1,,gmg_1,\dots,g_m6 as g1,,gmg_1,\dots,g_m7, together with leading-order behavior

g1,,gmg_1,\dots,g_m8

for the distillation error (Bravyi et al., 2012).

The framework was later generalized beyond single-qubit g1,,gmg_1,\dots,g_m9 states. Haah and Hastings introduced generalized triorthogonal matrices with row blocks j=1nGajGbj0(mod2)for all ab.\sum_{j=1}^n G_{a j}G_{b j}\equiv 0 \pmod 2 \quad\text{for all }a\neq b.0, j=1nGajGbj0(mod2)for all ab.\sum_{j=1}^n G_{a j}G_{b j}\equiv 0 \pmod 2 \quad\text{for all }a\neq b.1, j=1nGajGbj0(mod2)for all ab.\sum_{j=1}^n G_{a j}G_{b j}\equiv 0 \pmod 2 \quad\text{for all }a\neq b.2, and j=1nGajGbj0(mod2)for all ab.\sum_{j=1}^n G_{a j}G_{b j}\equiv 0 \pmod 2 \quad\text{for all }a\neq b.3, arranged so that transversal j=1nGajGbj0(mod2)for all ab.\sum_{j=1}^n G_{a j}G_{b j}\equiv 0 \pmod 2 \quad\text{for all }a\neq b.4 induces not only logical j=1nGajGbj0(mod2)for all ab.\sum_{j=1}^n G_{a j}G_{b j}\equiv 0 \pmod 2 \quad\text{for all }a\neq b.5 gates but also controlled-j=1nGajGbj0(mod2)for all ab.\sum_{j=1}^n G_{a j}G_{b j}\equiv 0 \pmod 2 \quad\text{for all }a\neq b.6 and j=1nGajGbj0(mod2)for all ab.\sum_{j=1}^n G_{a j}G_{b j}\equiv 0 \pmod 2 \quad\text{for all }a\neq b.7 on designated logical subsets. In that setting they presented both randomized and Reed–Muller-based constructions and showed an asymptotic distillation efficiency j=1nGajGbj0(mod2)for all ab.\sum_{j=1}^n G_{a j}G_{b j}\equiv 0 \pmod 2 \quad\text{for all }a\neq b.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

j=1nGajGbj0(mod2)for all ab.\sum_{j=1}^n G_{a j}G_{b j}\equiv 0 \pmod 2 \quad\text{for all }a\neq b.9

for a family of j=1nGajGbjGcj0(mod2)for all distinct a,b,c.\sum_{j=1}^n G_{a j}G_{b j}G_{c j}\equiv 0 \pmod 2 \quad\text{for all distinct }a,b,c.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 j=1nGajGbjGcj0(mod2)for all distinct a,b,c.\sum_{j=1}^n G_{a j}G_{b j}G_{c j}\equiv 0 \pmod 2 \quad\text{for all distinct }a,b,c.1. In that regime, there are exactly j=1nGajGbjGcj0(mod2)for all distinct a,b,c.\sum_{j=1}^n G_{a j}G_{b j}G_{c j}\equiv 0 \pmod 2 \quad\text{for all distinct }a,b,c.2 inequivalent unital triorthogonal subspaces j=1nGajGbjGcj0(mod2)for all distinct a,b,c.\sum_{j=1}^n G_{a j}G_{b j}G_{c j}\equiv 0 \pmod 2 \quad\text{for all distinct }a,b,c.3, each containing the all-ones vector. Every triorthogonal code with parameters j=1nGajGbjGcj0(mod2)for all distinct a,b,c.\sum_{j=1}^n G_{a j}G_{b j}G_{c j}\equiv 0 \pmod 2 \quad\text{for all distinct }a,b,c.4 and j=1nGajGbjGcj0(mod2)for all distinct a,b,c.\sum_{j=1}^n G_{a j}G_{b j}G_{c j}\equiv 0 \pmod 2 \quad\text{for all distinct }a,b,c.5 descends from exactly one of these j=1nGajGbjGcj0(mod2)for all distinct a,b,c.\sum_{j=1}^n G_{a j}G_{b j}G_{c j}\equiv 0 \pmod 2 \quad\text{for all distinct }a,b,c.6 parent subspaces by puncturing and qubit deletion (Nezami et al., 2021).

The puncturing operation is organized by a subset j=1nGajGbjGcj0(mod2)for all distinct a,b,c.\sum_{j=1}^n G_{a j}G_{b j}G_{c j}\equiv 0 \pmod 2 \quad\text{for all distinct }a,b,c.7 of size j=1nGajGbjGcj0(mod2)for all distinct a,b,c.\sum_{j=1}^n G_{a j}G_{b j}G_{c j}\equiv 0 \pmod 2 \quad\text{for all distinct }a,b,c.8 satisfying the full-rank condition j=1nGajGbjGcj0(mod2)for all distinct a,b,c.\sum_{j=1}^n G_{a j}G_{b j}G_{c j}\equiv 0 \pmod 2 \quad\text{for all distinct }a,b,c.9. Depending on parity, one obtains either an even descendant with \wedge0 and \wedge1, or an odd descendant with \wedge2 and \wedge3. 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 \wedge4 of dimension \wedge5 one associates an indicator polynomial

\wedge6

of Hamming weight \wedge7, defined so that \wedge8 precisely when \wedge9 is a column of a generator for |\,\cdot\,|0. The key lemma is that |\,\cdot\,|1 is triorthogonal unital if and only if |\,\cdot\,|2 and |\,\cdot\,|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 |\,\cdot\,|4 affine-inequivalent such polynomials of weight |\,\cdot\,|5 (Nezami et al., 2021).

Several concrete consequences follow. The canonical |\,\cdot\,|6 distillation code arises from the indicator polynomial |\,\cdot\,|7 with |\,\cdot\,|8 and |\,\cdot\,|9, followed by puncturing. A new extremal example in the classified range is the TT00 code obtained as the even descendant of subspace TT01. The paper also proves a rate bound: for any triorthogonal code TT02, one has TT03. In the range TT04, no code achieves TT05 (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 TT06 for each column type TT07 and translates pairwise and triple-wise overlap conditions into sparse linear equations over TT08. With additional constraints excluding the all-zero column and repeated column pairs, this search produced numerous examples, including a TT09 triorthogonal matrix whose code has distance TT10 and yields a TT11 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 TT12 with TT13 small, the algorithm succeeds with high probability, the code distance obeys TT14, and the distillation efficiency satisfies TT15 (Haah et al., 2017).

A more recent constructive route uses dual-distance constraints. For an even-weight generator matrix TT16, one lets TT17 be the classical code generated by TT18 and imposes the conditions TT19 on the dual weight enumerator, with

TT20

where TT21 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 TT22 of length TT23 and dual distance at least TT24. Using symmetry constraints, the method found nontrivial TT25 triorthogonal codes for odd TT26, including TT27, 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 TT28 of dimension TT29, Shi et al. described an algorithm that grows a maximal triorthogonal subspace by repeatedly solving linear equations of the form TT30 for all distinct TT31 already chosen. If the resulting triorthogonal subspace has dimension TT32, then

TT33

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 TT34 implements a prescribed collection of logical TT35, controlled-TT36, and TT37 gates. Their Reed–Muller construction uses the relations

TT38

and produces a generalized triorthogonal code with parameters

TT39

when TT40. For TT41, this yields a TT42 code used to distill TT43 logical TT44 states from TT45 noisy TT46 gates, with roughly TT47 TT48 gates per output TT49. The same paper also reported punctured Reed–Muller triorthogonal codes with parameters TT50, TT51, and TT52 (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-TT53 poset framework, a triorthogonal code TT54 is minimal if and only if TT55 and all nonzero words have even weight, and maximal if and only if TT56. The same analysis characterizes which row-equivalent generators remain triorthogonal: if TT57 with odd rows in TT58 and even rows in TT59, then TT60 is triorthogonal exactly when

TT61

with TT62 a permutation matrix, TT63 invertible, and TT64 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 TT65, a triorthogonal matrix TT66 is partitioned into TT67 and TT68 so that distinct rows are pairwise orthogonal modulo TT69, all triples of rows satisfy the ternary cubic orthogonality condition, every row of TT70 is self-orthogonal, and every row of TT71 is not self-orthogonal. From this structure one obtains a family of qutrit CSS codes with parameters TT72 for TT73. For the maximal-rate choice TT74, the yield parameter is

TT75

The case TT76 gives a TT77 code with yield parameter TT78, 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-TT79 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 TT80 and TT81, structural ties to self-dual and CSS-TT82 theories, and nonbinary generalizations relevant to qutrit magic-state distillation (Nezami et al., 2021, Baldelli et al., 23 May 2026, Prakash et al., 2024).

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Triorthogonal Matrices.