# Dual code

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/Dual_code
> Markdown URL: https://mediated.wiki/source/Dual_code.md
> Source: https://en.wikipedia.org/wiki/Dual_code
> Source revision: 1212907100
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

For players of both rugby codes, see [List of dual-code rugby internationals](/source/List_of_dual-code_rugby_internationals).

In [coding theory](/source/Coding_theory), the **dual code** of a [linear code](/source/Linear_code)

- C ⊂ F q n {\displaystyle C\subset \mathbb {F} _{q}^{n}}

is the linear code defined by

- C ⊥ = { x ∈ F q n ∣ ⟨ x , c ⟩ = 0 ∀ c ∈ C } {\displaystyle C^{\perp }=\{x\in \mathbb {F} _{q}^{n}\mid \langle x,c\rangle =0\;\forall c\in C\}}

where

- ⟨ x , c ⟩ = ∑ i = 1 n x i c i {\displaystyle \langle x,c\rangle =\sum _{i=1}^{n}x_{i}c_{i}}

is a scalar product. In [linear algebra](/source/Linear_algebra) terms, the dual code is the [annihilator](/source/Annihilator_(ring_theory)) of *C* with respect to the [bilinear form](/source/Bilinear_form) ⟨ ⋅ ⟩ {\displaystyle \langle \cdot \rangle } . The [dimension](/source/Dimension_(vector_space)) of *C* and its dual always add up to the length *n*:

- dim ⁡ C + dim ⁡ C ⊥ = n . {\displaystyle \dim C+\dim C^{\perp }=n.}

A [generator matrix](/source/Generator_matrix) for the dual code is the [parity-check matrix](/source/Parity-check_matrix) for the original code and vice versa. The dual of the dual code is always the original code.

## Self-dual codes

A **self-dual code** is one which is its own dual. This implies that *n* is even and dim *C* = *n*/2. If a self-dual code is such that each codeword's weight is a multiple of some constant c > 1 {\displaystyle c>1} , then it is of one of the following four types:[1]

- **Type I** codes are binary self-dual codes which are not [doubly even](/source/Doubly_even_code). Type I codes are always [even](/source/Even_code) (every codeword has even [Hamming weight](/source/Hamming_weight)).

- **Type II** codes are binary self-dual codes which are doubly even.

- **Type III** codes are ternary self-dual codes. Every codeword in a Type III code has Hamming weight divisible by 3.

- **Type IV** codes are self-dual codes over **F**4. These are again even.

Codes of types I, II, III, or IV exist only if the length *n* is a multiple of 2, 8, 4, or 2 respectively.

If a self-dual code has a generator matrix of the form G = [ I k | A ] {\displaystyle G=[I_{k}|A]} , then the dual code C ⊥ {\displaystyle C^{\perp }} has [generator matrix](/source/Generator_matrix) [ − A ¯ T | I k ] {\displaystyle [-{\bar {A}}^{T}|I_{k}]} , where I k {\displaystyle I_{k}} is the ( n / 2 ) × ( n / 2 ) {\displaystyle (n/2)\times (n/2)} identity matrix and a ¯ = a q ∈ F q {\displaystyle {\bar {a}}=a^{q}\in \mathbb {F} _{q}} .

## References

1. **[^](#cite_ref-1)** [Conway, J.H.](/source/John_Horton_Conway); [Sloane, N.J.A.](/source/Neil_Sloane) (1988). [*Sphere packings, lattices and groups*](https://archive.org/details/spherepackingsla0000conw/page/77). Grundlehren der mathematischen Wissenschaften. Vol. 290. [Springer-Verlag](/source/Springer-Verlag). p. [77](https://archive.org/details/spherepackingsla0000conw/page/77). [ISBN](/source/ISBN_(identifier)) [0-387-96617-X](https://en.wikipedia.org/wiki/Special:BookSources/0-387-96617-X).

- Hill, Raymond (1986). [*A first course in coding theory*](https://archive.org/details/firstcourseincod0000hill). Oxford Applied Mathematics and Computing Science Series. [Oxford University Press](/source/Oxford_University_Press). p. [67](https://archive.org/details/firstcourseincod0000hill/page/67). [ISBN](/source/ISBN_(identifier)) [0-19-853803-0](https://en.wikipedia.org/wiki/Special:BookSources/0-19-853803-0).

- [Pless, Vera](/source/Vera_Pless) (1982). [*Introduction to the theory of error-correcting codes*](/source/Introduction_to_the_Theory_of_Error-Correcting_Codes). Wiley-Interscience Series in Discrete Mathematics. [John Wiley & Sons](/source/John_Wiley_%26_Sons). p. 8. [ISBN](/source/ISBN_(identifier)) [0-471-08684-3](https://en.wikipedia.org/wiki/Special:BookSources/0-471-08684-3).

- J.H. van Lint (1992). [*Introduction to Coding Theory*](https://archive.org/details/introductiontoco0000lint/page/34). [GTM](/source/Graduate_Texts_in_Mathematics). Vol. 86 (2nd ed.). Springer-Verlag. p. [34](https://archive.org/details/introductiontoco0000lint/page/34). [ISBN](/source/ISBN_(identifier)) [3-540-54894-7](https://en.wikipedia.org/wiki/Special:BookSources/3-540-54894-7).

## External links

- [MATH32031: Coding Theory - Dual Code](https://web.archive.org/web/20170516194659/https://www.maths.manchester.ac.uk/~pas/code/notes/part9.pdf) - pdf with some examples and explanations

---
Adapted from the Wikipedia article [Dual code](https://en.wikipedia.org/wiki/Dual_code) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/Dual_code?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
