{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Definition\n\nLet $A$ be a [[finite set|0BBTH3YSZA]] with at least two elements, the alphabet, and let $n$ be a positive integer.\nFor words $x, y \\in A^n$, the Hamming distance $d(x, y)$ is the number of positions $i$ with $x_i \\ne y_i$.\nA code of length $n$ over $A$ is a [[subset|0BJR9QR08E]] $C \\subseteq A^n$ with at least two elements; its elements are the codewords.\nThe minimum distance of $C$ is $d(C) = \\min \\set{d(x, y) : x, y \\in C,\\ x \\ne y}$.\nFor an integer $t \\ge 0$, the code $C$ is $t$-error-correcting if for each word $y \\in A^n$ there is at most one codeword $c \\in C$ with $d(c, y) \\le t$.\n\n## Remarks\n\nThe code $C$ is $t$-error-correcting if and only if $d(C) \\ge 2t + 1$.\nOne direction uses the triangle inequality of the Hamming distance: if $d(c, y) \\le t$ and $d(c', y) \\le t$, then $d(c, c') \\le 2t$.\nExample: the binary repetition code $C = \\set{000, 111}$ has $d(C) = 3$, so it is $1$-error-correcting.\nA word with at most one $1$ is within distance $1$ of $000$ only, and a word with at least two $1$'s is within distance $1$ of $111$ only.\nNon-example: $C = \\set{000, 011}$ is not $1$-error-correcting, because $001$ is at distance $1$ from both codewords.\nA code with $M$ codewords, length $n$ and minimum distance $d$ is called an $(n, M, d)$ code.\nWhen $A$ is a finite field and $C$ is a subspace of $A^n$, the code is a linear code.\n",
  "commit": "547b6eddb8f2feb8d579f2d633d22a27b7e132fc",
  "front": {
    "defines": "TAE6K8NQ46",
    "kind": "definition",
    "msc": [
      "94B25",
      "94B05"
    ],
    "name": "Error-correcting code",
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Error_correction_code"
      }
    ],
    "tag": "X122TKFP9G",
    "uses": [
      "0BBTH3YSZA",
      "0BJR9QR08E"
    ]
  },
  "kind": "definition",
  "link": "https://math2.tamnd.com/node/X122TKFP9G/",
  "links": [
    {
      "field": "defines",
      "target": "TAE6K8NQ46"
    },
    {
      "field": "uses",
      "target": "0BBTH3YSZA"
    },
    {
      "field": "uses",
      "target": "0BJR9QR08E"
    }
  ],
  "markdown": "https://math2.tamnd.com/node/X122TKFP9G.md",
  "msc": [
    "94B25",
    "94B05"
  ],
  "name": "Error-correcting code",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/X12/X122TKFP9G.md",
  "status": null,
  "tag": "X122TKFP9G",
  "uri": "m2://X122TKFP9G",
  "url": "https://math2.tamnd.com/wiki/error-correcting-code-definition/",
  "writing": {
    "tag": "X122TKFP9G",
    "kind": "definition",
    "level": "W0",
    "next": [
      {
        "what": "a source with a locator",
        "have": 0,
        "want": 1
      }
    ]
  }
}
