ArticleslgStudy

physics

Learning with errors

Learning with errors is a physics 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 Learning with errors rather than just read about it. In short: In cryptography, learning with errors (LWE) is a mathematical problem that is widely used to create secure encryption algorithms. It is based on the idea of representing secret information as a set of equations with errors.

Key takeaways

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

Reference excerpt

In cryptography, learning with errors (LWE) is a mathematical problem that is widely used to create secure encryption algorithms. It is based on the idea of representing secret information as a set of equations with errors. In other words, LWE is a way to hide the value of a secret by introducing noise to it. In more technical terms, it refers to the computational problem of inferring a linear n-ary function f over a finite ring from given samples yi=f(𝐱i) some of which may be erroneous. The LWE problem is conjectured to be hard to solve, and thus to be useful in cryptography. More precisely, the LWE problem is defined as follows. Let ℤq denote the ring of integers modulo q and let ℤqn denote the set of n-vectors over ℤq. There exists a certain unknown linear function f:ℤqn→ℤq, and the input to the LWE problem is a sample of pairs (𝐱,y), where 𝐱∈ℤqn and y∈ℤq, so that with high probability y=f(𝐱). Furthermore, the deviation from the equality is according to some known noise model. The problem calls for finding the function f, or some close approximation thereof, with high probability. The LWE problem was introduced by Oded Regev in 2005 (who won the 2018 Gödel Prize for this work); it is a generalization of the parity learning problem. Regev showed that the LWE problem is as hard to solve as several worst-case lattice problems. Subsequently, the LWE problem has been used as a hardness assumption to create public-key cryptosystems, such as the ring learning with errors key exchange by Peikert.

Definition Denote by 𝕋=ℝ/ℤ the additive group on reals modulo one. Let 𝐬∈ℤqn be a fixed vector. Let ϕ be a fixed probability distribution over 𝕋. Denote by A𝐬,ϕ the distribution on ℤqn×𝕋 obtained as follows.

Pick a vector 𝐚∈ℤqn from the uniform distribution over ℤqn, Pick a number e∈𝕋 from the distribution ϕ, Evaluate t=⟨𝐚,𝐬⟩/q+e, where ⟨𝐚,𝐬⟩=∑i=1naisi is the standard inner product in ℤqn, the division is done in the field of reals (or more formally, this "division by q" is notation for the group homomorphism ℤq⟶𝕋 mapping 1∈ℤq to 1/q+ℤ∈𝕋), and the final addition is in 𝕋. Output the pair (𝐚,t). The learning with errors problem LWEq,ϕ is to find 𝐬∈ℤqn, given access to polynomially many samples of choice from A𝐬,ϕ. For every α>0, denote by Dα the one-dimensional Gaussian with zero mean and variance α2/(2π), that is, the density function is Dα(x)=ρα(x)/α where ρα(x)=e−π(|x|/α)2, and let Ψα be the distribution on 𝕋 obtained by considering Dα modulo one. The version of LWE considered in most of the results would be LWEq,Ψα

Decision version The LWE problem described above is the search version of the problem. In the decision version (DLWE), the goal is to distinguish between noisy inner products and uniformly random samples from ℤqn×𝕋 (practically, some discretized version of it). Regev showed that the decision and search versions are equivalent when q is a prime bounded by some polynomial in n.

Solving decision assuming search Intuitively, if we have a procedure for the search problem, the decision version can be solved easily: just feed the input samples for the decision problem to the solver for the search problem. Denote the given samples by {(𝐚i,𝐛i)}⊂ℤqn×𝕋. If the solver returns a candidate 𝐬, for all i, calculate {⟨𝐚i,𝐬⟩−𝐛i}. If the samples are from an LWE distribution, then the results of this calculation will be distributed according χ, but if the samples are uniformly random, these quantities will be distributed uniformly as well.

Solving search assuming decision For the other direction, given a solver for the decision problem, the search version can be solved as follows: Recover 𝐬 one coordinate at a time. To obtain the first coordinate, 𝐬1, make a guess k∈ℤq, and do the following. Choose a number r∈ℤq uniformly at random. Transform the given samples {(𝐚i,𝐛i)}⊂ℤqn×𝕋 as follows. Calculate {(𝐚i+(r,0,…,0),𝐛i+(rk)/q)}. Send the transformed samples to the decision solver. If the guess k was correct, the transformation takes the distribution A𝐬,χ to itself, and otherwise, since q is prime, it takes it to the uniform distribution. So, given a polynomial-time solver for the decision problem that errs with very small probability, since q is bounded by some polynomial in n, it only takes polynomial time to guess every possible value for k and use the solver to see which one is correct. After obtaining 𝐬1, we follow an analogous procedure for each other coordinate 𝐬j. Namely, we transform our 𝐛i samples the same way, and transform our 𝐚i samples by calculating 𝐚i+(0,…,r,…,0), where the r is in the jth coordinate. Peikert showed that this reduction, with a small modification, works for any q that is a product of distinct, small (polynomial in n) primes. The main idea is if q=q1q2⋯qt, for each qℓ, guess and check to see if 𝐬j is congruent to 0modqℓ, and then use the Chinese remainder theorem to recover 𝐬j.

Average case hardness Regev showed the random self-reducibility of the LWE and DLWE problems for arbitrary q and χ. Given samples {(𝐚i,𝐛i)} from A𝐬,χ, it is easy to see that {(𝐚i,𝐛i+⟨𝐚i,𝐭⟩)/q} are samples from A𝐬+𝐭,χ. So, suppose there was some set 𝒮⊂ℤqn such that |𝒮|/|ℤqn|=1/poly⁡(n), and for distributions A𝐬′,χ, with 𝐬′←𝒮, DLWE was easy. Then there would be some distinguisher 𝒜, who, given samples {(𝐚i,𝐛i)}, could tell whether they were uniformly random or from A𝐬′,χ. If we need to distinguish uniformly random samples from A𝐬,χ, where 𝐬 is chosen uniformly at random from ℤqn, we could simply try different values 𝐭 sampled uniformly at random from ℤqn, calculate {(𝐚i,𝐛i+⟨𝐚i,𝐭⟩)/q} and feed these samples to 𝒜. Since 𝒮 comprises a large fraction of ℤqn, with high probability, if we choose a polynomial number of values for 𝐭, we will find one such that 𝐬+𝐭∈𝒮, and 𝒜 will successfully distinguish the samples. Thus, no such 𝒮 can exist, meaning LWE and DLWE are (up to a polynomial factor) as hard in the average case as they are in the worst case.

Hardness results

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Learning with errors

Start with the simplest possible case. Write down what Learning with errors claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In physics, 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 Learning with errors 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 Learning with errors 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 Learning with errors

In research
Learning with errors appears in physics 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 Learning with errors 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
Learning with errors is common in secondary-school and first-year university syllabi. It links to neighbouring topics Post-quantum cryptography, so understanding it makes those chapters shorter.
In everyday life
Look for Learning with errors 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 “Learning with errors” →

How to study Learning with errors in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Learning with errors 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 Learning with errors out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Learning with errors in simple terms?

In cryptography, learning with errors (LWE) is a mathematical problem that is widely used to create secure encryption algorithms. It is based on the idea of representing secret information as a set of equations with errors.

Why does Learning with errors matter?

Because it connects several physics 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 Learning with errors?

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 Learning with errors.

Tags

  • Post-quantum cryptography

Keep exploring