Skip to main content

๐Ÿ”ข The MLWE Equation

The Official Problem Statementโ€‹


๐ŸŽฏ The Simple Storyโ€‹

Here's the formal problem statement (in plain terms!):

Given:

  • A multiplication table (matrix A\mathbf{A})
  • A result vector (t\mathbf{t})

Find:

  • A secret vector (s\mathbf{s})
  • An error vector (e\mathbf{e})

Such that: As+e=t\mathbf{A}\mathbf{s} + \mathbf{e} = \mathbf{t}

Where:

  • s=Bobโ€™sย secretย (whatย weโ€™reย hiding)\mathbf{s} = \text{Bob's secret (what we're hiding)}
  • e=Randomย fogย (confusesย Eve)\mathbf{e} = \text{Random fog (confuses Eve)}
  • t=Foggedย resultย (whatย Eveย sees)\mathbf{t} = \text{Fogged result (what Eve sees)}

Problem: Two unknowns (s\mathbf{s} and e\mathbf{e}), one equation! Too many solutions!

Secret: Choose just one pair (s\mathbf{s}, e\mathbf{e}) that produces t\mathbf{t}. That's the MLWE problem.


๐Ÿง  Mental Modelโ€‹

Hold this picture in your head:

The MLWE Problem:

Given:
โ”Œโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”
โ”‚ A โ”‚ B โ”‚ C โ”‚ โ† Matrix ๐€
โ”œโ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”ค
โ”‚ D โ”‚ E โ”‚ F โ”‚
โ”œโ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”ค
โ”‚ G โ”‚ H โ”‚ I โ”‚
โ””โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”˜

And vector:
โ”Œโ”€โ”€โ”€โ”
โ”‚ J โ”‚ โ† Vector ๐ญ
โ””โ”€โ”€โ”€โ”˜

Find:
โ”Œโ”€โ”€โ”€โ”
โ”‚ s โ”‚ โ† Vector ๐ฌ (secret)
โ”œโ”€โ”€โ”€โ”ค
โ”‚ e โ”‚ โ† Vector ๐ž (error)
โ””โ”€โ”€โ”€โ”˜

Such that:
๐€ยท๐ฌ + ๐ž = ๐ญ

In other words:

What secret s\mathbf{s} and error e\mathbf{e} multiply with A\mathbf{A} to produce t\mathbf{t}?

This is exactly "Finding the Closest Point on a Lattice"! (SVP - Shortest Vector Problem)


๐Ÿ“Š See It Happenโ€‹

Let's see what Eve and Bob do:


๐ŸŽฎ Try It Yourselfโ€‹

Question 1: Given A=[3,5]\mathbf{A} = [3, 5], t=[10]\mathbf{t} = [10], find all (s\mathbf{s}, e\mathbf{e}) pairs such that As+e=t\mathbf{A}\mathbf{s} + \mathbf{e} = \mathbf{t}

Show Answer

Equation: 3s+e=103s + e = 10

Try different values:

sse=10โˆ’3se = 10 - 3sReasonable?
010โœ— Too large
17โœ— Too large
24โœ— Too large
31โœ“ Reasonable!
4-2โœ“ Reasonable!

But we don't know what "reasonable" means! Could be (ss, ee) = (5, -5), (6, -8), etc.

Many possibilities!


Question 2: If error must be between -2 and +2, which values of ss work with A=[3]\mathbf{A} = [3], t=[10]\mathbf{t} = [10]?

Show Answer

Equation: 3s+e=103s + e = 10

Error eโˆˆ[โˆ’2,โˆ’1,0,1,2]e \in [-2, -1, 0, 1, 2]

Try each:

  • e=โˆ’2e = -2: 3s=12โ†’s=43s = 12 \rightarrow s = 4 โœ“
  • e=โˆ’1e = -1: 3s=11โ†’s=3.673s = 11 \rightarrow s = 3.67 โœ— (not integer)
  • e=0e = 0: 3s=10โ†’s=3.333s = 10 \rightarrow s = 3.33 โœ— (not integer)
  • e=+1e = +1: 3s=9โ†’s=33s = 9 \rightarrow s = 3 โœ“
  • e=+2e = +2: 3s=8โ†’s=2.673s = 8 \rightarrow s = 2.67 โœ— (not integer)

Valid solutions: (s=4s=4, e=โˆ’2e=-2) or (s=3s=3, e=+1e=+1)

Which one is the "true" secret? We don't know!


Question 3: Why does this become much harder with multiple equations? (ML-KEM has k=3k=3 equations)

Show Answer

With 3 equations:

[A11A12A13A21A22A23A31A32A33][s0s1s2]+[e0e1e2]=[t0t1t2]\begin{bmatrix} A_{11} & A_{12} & A_{13} \\ A_{21} & A_{22} & A_{23} \\ A_{31} & A_{32} & A_{33} \end{bmatrix} \begin{bmatrix} s_0 \\ s_1 \\ s_2 \end{bmatrix} + \begin{bmatrix} e_0 \\ e_1 \\ e_2 \end{bmatrix} = \begin{bmatrix} t_0 \\ t_1 \\ t_2 \end{bmatrix}

Now we must find:

  • s=(s0,s1,s2)\mathbf{s} = (s_0, s_1, s_2) - 3 unknowns
  • e=(e0,e1,e2)\mathbf{e} = (e_0, e_1, e_2) - 3 unknowns

Total: 6 unknowns! But we still only know A\mathbf{A} and t\mathbf{t}!

Each unknown can take ~5 possible values (error -2 to +2)

Total possibilities: ~5^6 = 15,625

Much harder! (In real ML-KEM: 5^256 โ‰ˆ 10^178)


๐Ÿ”ข The Mathโ€‹

MLWE Problem Statementโ€‹

Module-Learning With Errors (MLWE): Given AโˆˆRqkร—k\mathbf{A} \in R_q^{k \times k} and tโˆˆRqk\mathbf{t} \in R_q^k, find s,eโˆˆRqk\mathbf{s}, \mathbf{e} \in R_q^k such that:

As+e=t\mathbf{A}\mathbf{s} + \mathbf{e} = \mathbf{t}

Where:

  • Rq=Zq[x]/(x256+1)R_q = \mathbb{Z}_q[x]/(x^{256} + 1) (polynomial ring, coefficients 0 to 3328)
  • k=3k = 3 for ML-KEM768 (matrix size)
  • sโ†ฯ‡ฮท1k\mathbf{s} \leftarrow \chi_{\eta_1}^k (secret from small error distribution)
  • eโ†ฯ‡ฮท2k\mathbf{e} \leftarrow \chi_{\eta_2}^k (error from small error distribution)

In words:

Find a polynomial vector s\mathbf{s} that, when multiplied by matrix A\mathbf{A}, and added to a small error polynomial vector e\mathbf{e}, produces result t\mathbf{t}

Security Reductionโ€‹

The beauty of MLWE is its security reduction to SVP:

Theorem: If you can solve MLWE efficiently โ†’ You can solve SVP โ†’ Break lattice problems

Since SVP has no known efficient algorithm (40+ years of research), MLWE is believed hard!

Quantum resistance: No known quantum algorithm better than Grover's speedup (square root)

MLWE Parameters (ML-KEM768)โ€‹

ParameterSymbolValueMeaning
Polynomial degreenn256Each polynomial: 256 coefficients
Coefficient modulusqq3329Coefficients: 0 to 3328
Matrix sizekk3Matrix: 3ร—3 = 9 polynomials
Error param 1ฮท1\eta_12Key generation error (-2 to +2)
Error param 2ฮท2\eta_22Encapsulation error (-2 to +2)

Result:

  • Each entry = polynomial with 256 coefficients
  • Matrix A\mathbf{A} = 9 polynomials = 2,304 coefficients total
  • Each coefficient values: 0, 1, 2, ..., 3328

Total possibilities:

  • Each coefficient: 3,329 values
  • Matrix: 3,329^2,304 โ‰ˆ 10^10,000 astronomically large!
  • Even with error distribution: Still huge search space!

๐Ÿ’ก Why We Careโ€‹

MLWE in ML-KEM Key Generationโ€‹

Bob's key generation algorithm:

t=As+e(modq)\mathbf{t} = \mathbf{A}\mathbf{s} + \mathbf{e} \pmod{q}

Alice receives: (A,t)(\mathbf{A}, \mathbf{t}) (public key)

Alice's encapsulation:

  • Uses A\mathbf{A} and t\mathbf{t}
  • Derives shared secret
  • Sends ciphertext (c1,c2)(\mathbf{c}_1, \mathbf{c}_2)

Bob's decapsulation:

  • Has s\mathbf{s} (private key)
  • Can recover e\mathbf{e} from t\mathbf{t}
  • Derives same shared secret!

Eve's problem: Find s\mathbf{s} given (A,t)(\mathbf{A}, \mathbf{t}) โ†’ Equivalent to MLWE โ†’ Hard!

MLWE vs LWEโ€‹

LWE (Learning With Errors): As+e=b\mathbf{A}\mathbf{s} + \mathbf{e} = \mathbf{b}

With:

  • AโˆˆZqmร—n\mathbf{A} \in \mathbb{Z}_q^{m \times n} (regular matrix)
  • sโˆˆZqn\mathbf{s} \in \mathbb{Z}_q^n (vector of integers)
  • eโˆˆZqm\mathbf{e} \in \mathbb{Z}_q^m (error vector)

MLWE (Module-LWE): As+e=t\mathbf{A}\mathbf{s} + \mathbf{e} = \mathbf{t}

With:

  • AโˆˆRqkร—k\mathbf{A} \in R_q^{k \times k} (matrix of polynomials)
  • sโˆˆRqk\mathbf{s} \in R_q^k (vector of polynomials)
  • eโˆˆRqk\mathbf{e} \in R_q^k (error of polynomials)

Why MLWE: Faster operations, smaller keys, NTT enabled!


โœ… Quick Checkโ€‹

Can you state the MLWE problem?

Try saying this out loud:

"MLWE is: Given matrix ๐€ and result ๐ญ, find secret vector ๐ฌ and error vector ๐ž such that ๐€ยท๐ฌ + ๐ž = ๐ญ. The problem is there are too many (๐ฌ, ๐ž) pairs possible, making it hard to find the true secret!"

Can you work with polynomial MLWE?

Try this simplified examples:

Given:

  • Matrix A=[[x+1],[xโˆ’1]]\mathbf{A} = [[x+1], [x-1]]
  • Matrix t=[x2+x]\mathbf{t} = [xยฒ + x]

Goal: Find s\mathbf{s} and e\mathbf{e} such that Aโ‹…s+e=t\mathbf{A} \cdot \mathbf{s} + \mathbf{e} = \mathbf{t}

Let s=[x]\mathbf{s} = [x] (single entry) Then Aโ‹…s=[(x+1)x,(xโˆ’1)x]=[x2+x,x2โˆ’x]\mathbf{A} \cdot \mathbf{s} = [(x+1)x, (x-1)x] = [xยฒ + x, xยฒ - x]

We want this plus e\mathbf{e} to equal [x2+x,x2+x][xยฒ + x, xยฒ + x]

So e\mathbf{e} must satisfy: [x2+x,x2โˆ’x]+e=[x2+x,x2+x][xยฒ + x, xยฒ - x] + \mathbf{e} = [xยฒ + x, xยฒ + x]

Thus: e=[0,(x2+x)โˆ’(x2โˆ’x)]=[0,2x]\mathbf{e} = [0, (xยฒ + x) - (xยฒ - x)] = [0, 2x]

One solution: s=[x]\mathbf{s} = [x], e=[0,2x]\mathbf{e} = [0, 2x]

But there are many more!


๐ŸŽ“ Key Takeawaysโ€‹

โœ… MLWE equation = As+e=t\mathbf{A}\mathbf{s} + \mathbf{e} = \mathbf{t} (two unknowns!) โœ… Given to attacker = A\mathbf{A} and t\mathbf{t} (public key) โœ… Eve's problem = Find s\mathbf{s} and e\mathbf{e} โ†’ Too many possibilities โœ… Bob's advantage = Has s\mathbf{s} (secret) โ†’ Can recover โœ… Security reduction = MLWE solves SVP โ†’ SVP is hard โ†’ MLWE is hard โœ… MLWE for ML-KEM = t=As+e\mathbf{t} = \mathbf{A}\mathbf{s} + \mathbf{e} in polynomial ring R3329R_{3329} โœ… Parameters = n=256n=256, q=3329q=3329, k=3k=3, ฮท=2\eta=2 (256-bit security)


๐ŸŽ‰ What You'll Learn Nextโ€‹

Now you understand the MLWE problem! Next, we'll see how ML-KEM actually works. The complete process is covered in the algorithm chapters that follow.

For the KEM concept overview, continue to: