# CKKS -- Key Switching and Relinearization

DevFeed: [CKKS -- Key Switching and Relinearization](<https://devfeed.tech/articles/ckks-key-switching-and-relinearization-93098.md>)

Original publisher: [Read original article](<https://www.jeremykun.com/2026/10/21/ckks-key-switching-and-relinearization/>)

Published: 2026-10-21T18:27:41Z

Content type: tutorial

Language: en

Sources: [Jeremy Kun](<https://devfeed.tech/sources/jeremy-kun.md>)

Topics: [homomorphic encryption](<https://devfeed.tech/topics/homomorphic-encryption.md>), [FHE](<https://devfeed.tech/topics/fhe.md>), [Encryption](<https://devfeed.tech/topics/encryption.md>), [polynomials](<https://devfeed.tech/topics/polynomials.md>), [Tutorial](<https://devfeed.tech/topics/tutorial.md>), [private key](<https://devfeed.tech/topics/private-key.md>), [public key](<https://devfeed.tech/topics/public-key.md>), [test](<https://devfeed.tech/topics/test.md>)

Tags: [addition](<https://devfeed.tech/tags/addition.md>), [ckks](<https://devfeed.tech/tags/ckks.md>), [ckks-tutorial](<https://devfeed.tech/tags/ckks-tutorial.md>), [cryptography](<https://devfeed.tech/tags/cryptography.md>), [homomorphic-encryption](<https://devfeed.tech/tags/homomorphic-encryption.md>), [key](<https://devfeed.tech/tags/key.md>), [mathematics](<https://devfeed.tech/tags/mathematics.md>), [programming](<https://devfeed.tech/tags/programming.md>), [python](<https://devfeed.tech/tags/python.md>), [switching](<https://devfeed.tech/tags/switching.md>)

## AI overview

Relinearization converts CKKS multiplication's three-component ciphertext, which decrypts under (1, s, s²), back to two components under (1, s) by treating the s² component as a key-switching problem. Naive key switching homomorphically evaluates decryption using an encryption of the source key under the target key, but its added noise is multiplied by a potentially large ciphertext component and can overwhelm the message. Gadget decomposition splits that component into base-B digits and pairs them with encryptions of scaled source keys, reducing noise growth to roughly B log(Q) times the key-switch-key noise at the cost of more products for smaller bases. The article implements this approach and relinearization, while noting the need to generate a relinearization key first. It also explains that plaintext-ciphertext operations avoid encrypting public or static data per user; multiplication scales existing error and may require rescaling depending on the implementation. Rescaling itself is left to the next article, and the tutorial has not yet moved to RNS form.

## Source excerpt

Table of Contents This is part of a tutorial series on the CKKS homomorphic encryption scheme. In the last article, we described the ciphertext-ciphertext addition and multiplication operations. We ended with two challenges, one to restore the squared scaling factor $\Delta^2$ back to $\Delta$, and the other to convert a three-tuple ciphertext (decrypting under $(1, s, s^2)$) back to a two-tuple ciphertext (decrypting under $(1, s)$). This article covers the latter challenge, which is called relinearization.