0Pricing
Cryptology Academy · Lesson

Learning With Errors: The Hard Problem

Understand the LWE and SIS problems, their hardness assumptions, and why they resist quantum attacks.

Learning With Errors: The Hard Problem is a free Cryptology Academy lesson on CoddyKit — lesson 1 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Cryptology Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

The LWE Problem Defined

The Learning With Errors (LWE) problem was introduced by Oded Regev in 2005 as a foundation for post-quantum cryptography. Given a random matrix A over Z_q and a vector b = As + e, the goal is to find the secret vector s. The vector e is a small error drawn from a discrete Gaussian distribution, making the problem computationally intractable.

LWE Matrix Structure

In the LWE problem, A is an m x n random matrix sampled uniformly over Z_q, where q is a prime modulus. The secret s is an n-dimensional vector, and e is a small error vector whose entries are drawn from a narrow Gaussian. Even knowing the structure of A does not help an adversary distinguish b from a uniformly random vector.

Decisional vs Search LWE

There are two standard formulations of LWE. Search LWE asks to recover the secret s given many samples (A, b). Decisional LWE asks to distinguish samples (A, As + e) from uniform random pairs (A, u). The two formulations are polynomially equivalent, meaning an algorithm solving one can be transformed to solve the other.

Discrete Gaussian Error Distribution

The error term in LWE is drawn from a discrete Gaussian distribution over the integers, parametrized by standard deviation sigma. Small sigma values ensure that e is short compared to q, making b look almost like As mod q. If sigma were zero there would be no error and the system could be solved by Gaussian elimination, so the error is essential to hardness.

Worst-Case to Average-Case Reduction

Regev proved a remarkable reduction: solving average-case LWE samples is at least as hard as solving worst-case instances of the Shortest Vector Problem (SVP) on lattices. This means if you can break LWE efficiently, you can solve any lattice problem efficiently. No classical or quantum algorithm is known to solve worst-case SVP in polynomial time.

Quantum Resistance of LWE

Unlike RSA and elliptic curve cryptography, no known quantum algorithm provides an exponential speedup against LWE. Grover's algorithm offers at most a quadratic speedup, and the best quantum lattice algorithms (variants of BKZ) do not break LWE for properly chosen parameters. This makes LWE a strong foundation for post-quantum security.

LWE Security Parameters

LWE security is governed by three parameters: dimension n (secret length), modulus q, and error standard deviation sigma. Larger n and smaller q/sigma ratio increase security. For 128-bit post-quantum security, typical values are n = 1024, q around 12289, and sigma around 3.2. The lattice estimator tool by Albrecht et al. is used to evaluate concrete security.

The SIS Problem

The Short Integer Solution (SIS) problem is a related lattice hardness assumption used for signatures. Given a random matrix A over Z_q, find a short nonzero vector x such that Ax = 0 mod q. SIS is the basis for hash functions and signature schemes in the lattice world, complementing LWE which underlies encryption and key encapsulation.

LWE-Based Encryption Sketch

A simple LWE encryption scheme works as follows: the public key is (A, b = As + e) and the secret key is s. To encrypt a bit m, the sender computes (u, v) = (A^T r, b^T r + m * floor(q/2)) for a random binary vector r. Decryption computes v - s^T u and rounds to recover m. This scheme achieves IND-CPA security under the LWE assumption.

Applications Built on LWE

LWE has enabled a wide range of cryptographic constructions beyond basic encryption. These include fully homomorphic encryption (FHE), identity-based encryption (IBE), attribute-based encryption (ABE), and key exchange protocols. CRYSTALS-Kyber (now ML-KEM, standardized as FIPS 203) is the most practically deployed LWE-based scheme.

LWE in Real Deployments

LWE-based cryptography is already entering production systems. Google and Cloudflare conducted TLS experiments using Kyber in 2018-2020. Chrome and Firefox added support for ML-KEM-768 in hybrid TLS handshakes in 2024. Signal Protocol added a post-quantum layer (PQXDH) using ML-KEM-1024 for forward secrecy, protecting long-term message confidentiality against future quantum computers.

LWE Hardness Check

Which statement best describes the hardness guarantee of the LWE problem?

LWE Takeaways

LWE is one of the most well-studied post-quantum hardness assumptions, backed by a strong worst-case reduction from lattice problems. Its three parameters (n, q, sigma) control the security-performance trade-off. LWE resists quantum attacks and underpins NIST-standardized schemes. Understanding LWE is the gateway to all modern lattice-based cryptography including ML-KEM and ML-DSA.

Frequently asked questions

Is the “Learning With Errors: The Hard Problem” lesson free?

Yes — the full text of “Learning With Errors: The Hard Problem” is free to read here on the web, and the Cryptology Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Cryptology Academy course, upgrade to CoddyKit PRO.

What will I learn in “Learning With Errors: The Hard Problem”?

Understand the LWE and SIS problems, their hardness assumptions, and why they resist quantum attacks. You practise Cryptology Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Cryptology Academy?

No prior experience is required. Cryptology Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Learning With Errors: The Hard Problem” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Cryptology Academy lesson?

Yes. Every Cryptology Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Learning With Errors: The Hard Problem
  2. NTRU: History, Design, and Security
  3. Ring-LWE and Module Lattices
  4. Security Proofs and Reductions in Lattice Schemes
← Back to Cryptology Academy