ArticleslgStudy

science

Linear code

Linear code is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Linear code rather than just read about it. In short: In coding theory, a linear code is an error-correcting code for which any linear combination of codewords is also a codeword. Linear codes are traditionally partitioned into block codes and convolutional codes, although turbo codes can be seen as a hybrid of these two types.

Key takeaways

  • Linear code belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Linear code to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Linear code from memory before moving on to harder problems.

Reference excerpt

In coding theory, a linear code is an error-correcting code for which any linear combination of codewords is also a codeword. Linear codes are traditionally partitioned into block codes and convolutional codes, although turbo codes can be seen as a hybrid of these two types. Linear codes allow for more efficient encoding and decoding algorithms than other codes (cf. syndrome decoding). Linear codes are used in forward error correction and are applied in methods for transmitting symbols (e.g., bits) on a communications channel so that, if errors occur in the communication, some errors can be corrected or detected by the recipient of a message block. The codewords in a linear block code are blocks of symbols that are encoded using more symbols than the original value to be sent. A linear code of length n transmits blocks containing n symbols. For example, the [7,4,3] Hamming code is a linear binary code which represents 4-bit messages using 7-bit codewords. Two distinct codewords differ in at least three bits. As a consequence, up to two errors per codeword can be detected while a single error can be corrected. This code contains 24 = 16 codewords.

Definition and parameters A linear code of length n and dimension k is a linear subspace C with dimension k of the vector space 𝔽qn where 𝔽q is the finite field with q elements. Such a code is called a q-ary code. If q = 2 or q = 3, the code is described as a binary code, or a ternary code respectively. The vectors in C are called codewords. The size of a code is the number of codewords and equals qk. The weight of a codeword is the number of its elements that are nonzero and the distance between two codewords is the Hamming distance between them, that is, the number of elements in which they differ. The distance d of the linear code is the minimum weight of its nonzero codewords, or equivalently, the minimum distance between distinct codewords. A linear code of length n, dimension k, and distance d is called an [n,k,d] code (or, more precisely, [n,k,d]q code). We want to give 𝔽qn the standard basis because each coordinate represents a "bit" that is transmitted across a "noisy channel" with some small probability of transmission error (a binary symmetric channel). If some other basis is used then this model cannot be used and the Hamming metric does not measure the number of errors in transmission, as we want it to.

Generator and check matrices As a linear subspace of 𝔽qn, the entire code C (which may be very large) may be represented as the span of a set of k codewords (known as a basis in linear algebra). These basis codewords are often collated in the rows of a matrix G known as a generating matrix for the code C. When G has the block matrix form 𝑮=[Ik∣P], where Ik denotes the k×k identity matrix and P is some k×(n−k) matrix, then we say G is in standard form. A matrix H representing a linear function ϕ:𝔽qn→𝔽qn−k whose kernel is C is called a check matrix of C (or sometimes a parity check matrix). Equivalently, H is a matrix whose null space is C. If C is a code with a generating matrix G in standard form, 𝑮=[Ik∣P], then 𝑯=[−PT∣In−k] is a check matrix for C. The code generated by H is called the dual code of C. It can be verified that G is a k×n matrix, while H is a (n−k)×n matrix. Linearity guarantees that the minimum Hamming distance d between a codeword c0 and any of the other codewords c ≠ c0 is independent of c0. This follows from the property that the difference c − c0 of two codewords in C is also a codeword (i.e., an element of the subspace C), and the property that d(c, c0) = d(c − c0, 0). These properties imply that

minc∈C, c≠c0d(c,c0)=minc∈C, c≠c0d(c−c0,0)=minc∈C, c≠0d(c,0)=d. In other words, in order to find out the minimum distance between the codewords of a linear code, one would only need to look at the non-zero codewords. The non-zero codeword with the smallest weight has then the minimum distance to the zero codeword, and hence determines the minimum distance of the code. The distance d of a linear code C also equals the minimum number of linearly dependent columns of the check matrix H. Proof: Because 𝑯⋅𝒄T=0, which is equivalent to ∑i=1n(ci⋅𝑯𝒊)=0, where 𝑯𝒊 is the ith column of 𝑯. Remove those items with ci=0, those 𝑯𝒊 with ci≠0 are linearly dependent. Therefore, d is at least the minimum number of linearly dependent columns. On another hand, consider the minimum set of linearly dependent columns {𝑯𝒋∣j∈S} where S is the column index set. ∑i=1n(ci⋅𝑯𝒊)=∑j∈S(cj⋅𝑯𝒋)+∑j∉S(cj⋅𝑯𝒋)=0. Now consider the vector 𝒄′ such that cj′=0 if j∉S. Note 𝒄′∈C because 𝑯⋅𝒄′T=0 . Therefore, we have d≤wt(𝒄′), which is the minimum number of linearly dependent columns in 𝑯. The claimed property is therefore proven.

Example: Hamming codes

As the first class of linear codes developed for error correction purpose, Hamming codes have been widely used in digital communication systems. For any positive integer r≥2, there exists a [2r−1,2r−r−1,3]2 Hamming code. Since d=3, this Hamming code can correct a 1-bit error. Example : The linear block code with the following generator matrix and parity check matrix is a [7,4,3]2 Hamming code.

𝑮=(1000110010001100101110001101), 𝑯=(101110011 100100111001)

Example: Hadamard codes

Hadamard code is a [2r,r,2r−1]2 linear code and is capable of correcting many errors. Hadamard code could be constructed column by column : the ith column is the bits of the binary representation of integer i, as shown in the following example. Hadamard code has minimum distance 2r−1 and therefore can correct 2r−2−1 errors. Example: The linear block code with the following generator matrix is a [8,3,4]2 Hadamard code: 𝑮Had=(00001 1110011001101010101). Hadamard code is a special case of Reed–Muller code. If we take the first column (the all-zero column) out from 𝑮Had, we get [7,3,4]2 simplex code, which is the dual code of Hamming code.

Nearest neighbor algorithm The parameter d is closely related to the error correcting ability of the code. The following construction/algorithm illustrates this (called the nearest neighbor decoding algorithm): Input: A received vector v in 𝔽qn. Output: A codeword w in C closest to v, if any.

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Linear code

Start with the simplest possible case. Write down what Linear code claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Linear code before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Linear code ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Linear code

In research
Linear code appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Linear code in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Linear code is common in secondary-school and first-year university syllabi. It links to neighbouring topics Coding theory, Finite fields, so understanding it makes those chapters shorter.
In everyday life
Look for Linear code outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Linear code” →

How to study Linear code in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Linear code means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Linear code out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Linear code in simple terms?

In coding theory, a linear code is an error-correcting code for which any linear combination of codewords is also a codeword. Linear codes are traditionally partitioned into block codes and convolutional codes, although turbo codes can be seen as a hybrid of these two types.

Why does Linear code matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Linear code?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Linear code.

Tags

  • Coding theory
  • Finite fields

Keep exploring