# GLWE Homomorphic Addition with a Constant

Often you don’t want to add *another encrypted value* you just want to add a **known public constant** (like `+1`, or a known polynomial offset) to an encrypted message.

With GLWE, this is extremely simple and (importantly) **does not increase noise** in the same way ciphertext - ciphertext addition does.

***

## 1) What we have: a GLWE ciphertext encrypting `M`

A GLWE ciphertext encrypting a plaintext polynomial $$M \in \mathcal{R}\_p$$ has the form:

$$C = (A\_0,\ldots,A\_{k-1},B) \in \mathcal{R}\_q^{k+1}$$

with body:

$$B = \sum\_{i=0}^{k-1} A\_i S\_i + \Delta M + E \pmod q$$

* $$\vec{S}=(S\_0,\ldots,S\_{k-1})$$ is the secret key
* $$E$$ is the noise polynomial
* $$\Delta = q/p$$ is the encoding scale factor

***

## 2) The goal: add a known constant polynomial

Let $$\Sigma \in \mathcal{R}\_p$$ be a **public plaintext polynomial** you want to add:

$$M ;\mapsto; M + \Sigma$$

Examples of $$\Sigma$$:

* “add 1 to the constant term” → $$\Sigma(X)=1$$
* “add 3 to every coefficient” → $$\Sigma(X)=3 + 3X + 3X^2 + \cdots$$ (depending on your plaintext convention)
* “add a known offset vector packed into a polynomial”

***

## 3) Trick: represent the constant as a *trivial GLWE ciphertext*

A **trivial GLWE ciphertext** is a GLWE-shaped object with:

* all mask polynomials set to zero
* body set to the encoded plaintext (no secret key mixing)

For the constant $$\Sigma$$, the trivial ciphertext is:

$$C\_{\text{triv}}(\Sigma) = (0,\ldots,0,\Delta\Sigma)$$

This is “ciphertext-shaped,” so we can add it to other GLWE ciphertexts cleanly.

***

## 4) Homomorphic addition with a constant (the actual operation)

Just add component-wise:

$$C' = C + C\_{\text{triv}}(\Sigma)$$

That means:

* masks stay unchanged (because you add zeros): $$A\_i' = A\_i$$
* body shifts by $\Delta\Sigma$: $$B' = B + \Delta\Sigma \pmod q$$

So the resulting ciphertext is:

$$C' = (A\_0,\ldots,A\_{k-1},; B+\Delta\Sigma)$$

***

## 5) Why it works (correctness)

Decrypt $$C'$$:

$$
\begin{aligned}
T' &= B' - \sum\_i A\_i' S\_i \pmod q \\
&= (B + \Delta\Sigma) - \sum\_i A\_i S\_i \pmod q \\
&= (\Delta M + E) + \Delta\Sigma \pmod q \\
&= \Delta(M+\Sigma) + E \pmod q
\end{aligned}
$$

After rounding/decoding by $$\Delta$$, you recover:

$$M' = M + \Sigma \quad \text{in } \mathcal{R}\_p$$

You get the plaintext addition you wanted.

***

## 6) Noise impact (why this is “cheap”)

Notice what changed:

* The noise term stayed **exactly** $$E$$.
* You did **not** add a second independent noise term (as in ciphertext + ciphertext).

So “add constant” is typically treated as a nearly-free operation in noise budgeting. (You’re just shifting the encoded plaintext.)

This exact “add a constant by adding a trivial ciphertext” trick is described in the deep dive.

***

## 7) Tiny toy example

Let:

* $$q=64$$, $$p=4$$ ⇒ $$\Delta = q/p = 16$$
* You have an encryption of plaintext polynomial $$M$$, so the decrypted pre-rounded value is: $$T = \Delta M + E$$
* You want to add constant polynomial $$\Sigma = 1$$ (i.e., add 1 to the plaintext)

Make trivial ciphertext: $$C\_{\text{triv}}(\Sigma) = (0,\ldots,0,\Delta\Sigma) = (0,\ldots,0,16)$$

Add it: $$B' = B + 16$$

After decryption: $$T' = T + 16 = \Delta M + E + \Delta\Sigma = \Delta(M+1)+E$$

So decoding yields $$M+1$$.

***

## 8) Practical notes&#x20;

* $$\Sigma$$ **must be in the same plaintext space** ($$\mathcal{R}\_p$$) as $$M$$.
* You must use the **same** $$\Delta$$ (same `p` and `q` parameters) when forming $$\Delta\Sigma$$.
* If your scheme uses rounding during encoding (non power-of-two settings), then $$\Delta\Sigma$$ follows the same encoding conventions.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sabanaku77.gitbook.io/fhe-handbook-for-beginners/glwe-homomorphic-addition-with-a-constant.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
