# I want to know what can I do(arithmetic operations) with the schemes!

**URL:** https://openfhe.discourse.group/t/i-want-to-know-what-can-i-do-arithmetic-operations-with-the-schemes/182
**Category:** FHE Questions
**Created:** [October 27, 2022, 1:48am UTC](https://openfhe.discourse.group/t/i-want-to-know-what-can-i-do-arithmetic-operations-with-the-schemes/182 "2022-10-27T01:48:59Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![Higuys](https://avatars.discourse-cdn.com/v4/letter/h/4bbf92/32.png) [@Higuys](https://openfhe.discourse.group/u/Higuys)
#### Post date: [October 27, 2022, 1:48am UTC](https://openfhe.discourse.group/t/i-want-to-know-what-can-i-do-arithmetic-operations-with-the-schemes/182/1 "2022-10-27T01:48:59Z")

</div>

I’m wondered about what arithmetic operations are supported from FHE.

I want to know for 2nd Gen(BGV,BFV), 3rd GEN(GSW,CGGI), 4th GEN(CKKS)!

And I really want to know detail operations!  
(ex. 2nd Gen support +,-,\*,/)

- Is 3rd can support more than and/or/not? I heard it is for a bit.

Thanks for reading 🙂

---

<div class="post-metadata">

### Author: ![iquah](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/iquah/32/8_2.png) [@iquah](https://openfhe.discourse.group/u/iquah)
#### Post date: [October 27, 2022, 3:08pm UTC](https://openfhe.discourse.group/t/i-want-to-know-what-can-i-do-arithmetic-operations-with-the-schemes/182/2 "2022-10-27T15:08:07Z")

</div>

Hi there!

They all support `+, -, *`. They do not support divisions.

You can see examples of those operations in action for CKKS, BGV and BFV in our [PKE Examples](https://github.com/openfheorg/openfhe-development/tree/main/src/pke/examples) directory and you can find examples for “third gen” in [BINFHE Examples](https://github.com/openfheorg/openfhe-development/tree/main/src/binfhe/examples)

---

<div class="post-metadata">

### Author: ![ypolyakov](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/ypolyakov/32/47_2.png) [@ypolyakov](https://openfhe.discourse.group/u/ypolyakov)
#### Post date: [October 27, 2022, 5:27pm UTC](https://openfhe.discourse.group/t/i-want-to-know-what-can-i-do-arithmetic-operations-with-the-schemes/182/3 "2022-10-27T17:27:37Z")

</div>

I also suggest watching the webinars in the PALISADE/OpenFHE tutorial: [Webinars – OpenFHE.org](https://www.openfhe.org/webinars/), starting with [Homomorphic Encryption for OpenFHE Users – OpenFHE.org](https://www.openfhe.org/portfolio-item/homomorphic-encryption-for-palisade-users-1/) I also suggest watching other tutorials in the series, including integer arithmetic and approximate arithmetic.

Note about divisions:

- Scalar divisions are supported in CKKS if we write the division as a double representing 1/number and then multiply by it using `EvalMult`.
- Homomorphic division can be performed in FHEW/TFHE (3rd Gen) by building a Boolean circuit for 1/encrypted\_number and evaluating it (see [Homomorphic Encryption for OpenFHE Users – OpenFHE.org](https://www.openfhe.org/portfolio-item/homomorphic-encryption-for-palisade-users-2/) for more details).

---

<div class="post-metadata">

### Author: ![Higuys](https://avatars.discourse-cdn.com/v4/letter/h/4bbf92/32.png) [@Higuys](https://openfhe.discourse.group/u/Higuys)
#### Post date: [October 28, 2022, 12:02am UTC](https://openfhe.discourse.group/t/i-want-to-know-what-can-i-do-arithmetic-operations-with-the-schemes/182/4 "2022-10-28T00:02:35Z")

</div>

I’m really thanks and sorry guys!

Because I’m not a programmar, I want to get easier and clear answer if you can!

1. What operations are supported for FHEs in each Gen? (+,-,poly-multi, …)

2. 3rd Gen support only for a bit? or they can support more bits with carry or else?

Thanks again guys!!

---

<div class="post-metadata">

### Author: ![iquah](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/iquah/32/8_2.png) [@iquah](https://openfhe.discourse.group/u/iquah)
#### Post date: [October 28, 2022, 5:27pm UTC](https://openfhe.discourse.group/t/i-want-to-know-what-can-i-do-arithmetic-operations-with-the-schemes/182/5 "2022-10-28T17:27:43Z")

</div>

@Higuys

Can I know your background and usecase? E.g are you a programmer, mathematician, have you taken discrete math classes, etc. I hope I’m not coming across as condescending, but it sounds like you’re not the usual audience we have, so I’m trying to get an idea of how we can best help.

But anyways, to answer your question

**BGV && BFV** : supports `+, *, -` across ciphertexts

**FHEW/TFHE** supports `+, *, -` and homomorphic division (as Yuriy mentioned)

**CKKS** : supports `+, *, -` across ciphertexts. As Yuriy mentioned, division can be done by doing it in the clear and then multiplying that with the ciphertext. But you can’t divide two ciphertexts directly

> poly-multi

Do you mean polynomial multiplication or polynomial evaluation? Polynomial multiplication is what we do on all of them but only `CKKS` supports polynomial evaluation. For `FHEW` (and I think TFHE, but I’ll defer to Yuriy) you can construct lookup tables for functions that you can evaluate a value on.

* * *

> 3rd Gen support only for a bit? or they can support more bits with carry or else?

In OpenFHE you can operate on actual numbers, not just bits. So yes, you can work on more than a single bit.

* * *

HTH!

---

<div class="post-metadata">

### Author: ![Higuys](https://avatars.discourse-cdn.com/v4/letter/h/4bbf92/32.png) [@Higuys](https://openfhe.discourse.group/u/Higuys)
#### Post date: [October 31, 2022, 4:26am UTC](https://openfhe.discourse.group/t/i-want-to-know-what-can-i-do-arithmetic-operations-with-the-schemes/182/6 "2022-10-31T04:26:07Z")

</div>

Thanks for your attention.

I studied cryptography 🙂

I heard that 3rd targeted a bit arithmetic and only 8~16 bits are supported in recent.

Is this right? and in a large integer, 2nd are more efficient than 3rd?

I want to know pros and cons in arithmetics in generations! (ex. CKKS only support approximate arithmetic)

---

<div class="post-metadata">

### Author: ![dcousins](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/dcousins/32/71_2.png) [@dcousins](https://openfhe.discourse.group/u/dcousins)
#### Post date: [November 8, 2022, 4:28pm UTC](https://openfhe.discourse.group/t/i-want-to-know-what-can-i-do-arithmetic-operations-with-the-schemes/182/7 "2022-11-08T16:28:34Z")

</div>

Hi  
maybe this will help. Note that typically TFHE/FHEW are used for boolean arithmetic, but we recently extened it to small integers (not shown in the picture)

 ![What is HE](https://canada1.discourse-cdn.com/flex031/uploads/openfhe/original/1X/d2e1b269c2da7da7b3871886af836571dd5a4bd5.png)

---

<div class="post-metadata">

### Author: ![yhh](https://avatars.discourse-cdn.com/v4/letter/y/c57346/32.png) [@yhh](https://openfhe.discourse.group/u/yhh)
#### Post date: [November 19, 2022, 2:40pm UTC](https://openfhe.discourse.group/t/i-want-to-know-what-can-i-do-arithmetic-operations-with-the-schemes/182/8 "2022-11-19T14:40:08Z")

</div>

Hi!

Since you’ve mentioned division, is there any chance I can do a ciphertext divide a plaintext?  
i.e. Given (a(x)s(x)+e(x),a(x)) and a’(x), where a’(x) is some function of a(x) [e.g.: automorphism, or square function], can i compute (a’s+e’, a’)?  
(I think e’(x) is okay not to satisfy the gaussian distribution, but shouldn’t be too large to destroy a ciphertext.  
(Furthermore, my condition allows scaling s(x) to Δs(x) at first, and i think that the scaling factor may introduce a rescale after the plain-ct mult, which would reduce the operation noise?

Thanks for your time!

---

<div class="post-metadata">

### Author: ![dcousins](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/dcousins/32/71_2.png) [@dcousins](https://openfhe.discourse.group/u/dcousins)
#### Post date: [November 22, 2022, 5:46pm UTC](https://openfhe.discourse.group/t/i-want-to-know-what-can-i-do-arithmetic-operations-with-the-schemes/182/10 "2022-11-22T17:46:30Z")

</div>

@yhh The division @ypolyakov mentions, is done by actually implementing a reciprocal operation using a digital combinatorial circuit – which is not a trivial thing to do.

---

<div class="post-metadata">

### Author: ![jmall](https://avatars.discourse-cdn.com/v4/letter/j/c67d28/32.png) [@jmall](https://openfhe.discourse.group/u/jmall)
#### Post date: [May 22, 2024, 9:26am UTC](https://openfhe.discourse.group/t/i-want-to-know-what-can-i-do-arithmetic-operations-with-the-schemes/182/11 "2024-05-22T09:26:35Z")

</div>

> [@dcousins](#):
>
> but we recently extened it to small integers (not shown in the picture)

Hello! Sorry to jump in late on this.

Can you link me to small integers implementation in openfhe?

Thanks,  
Janmajaya

---

<div class="post-metadata">

### Author: ![dcousins](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/dcousins/32/71_2.png) [@dcousins](https://openfhe.discourse.group/u/dcousins)
#### Post date: [May 22, 2024, 1:02pm UTC](https://openfhe.discourse.group/t/i-want-to-know-what-can-i-do-arithmetic-operations-with-the-schemes/182/12 "2024-05-22T13:02:11Z")

</div>

I’d start here, look at the last set of examples named Eval…

[binfhe/examples/README.md](https://github.com/openfheorg/openfhe-development/blob/main/src/binfhe/examples/README.md)
