Answer: How Many Elementary Operations for Adding Two Numbers with $n$ Digits?

  • Context: MHB 
  • Thread starter Thread starter mathmari
  • Start date Start date
  • Tags Tags
    Operations
Click For Summary

Discussion Overview

The discussion revolves around the number of elementary operations required for adding and multiplying two numbers with $n$ digits, focusing on the definitions of elementary operations in the context of arithmetic operations. The scope includes theoretical considerations and mathematical reasoning related to addition and multiplication of multi-digit numbers.

Discussion Character

  • Technical explanation
  • Mathematical reasoning
  • Debate/contested

Main Points Raised

  • Some participants propose that adding two $n$-digit numbers requires $n$ elementary operations, as each digit and carry must be processed.
  • Others agree that at least $n$ operations are necessary for addition, confirming the initial claim.
  • There is a question raised about the multiplication of two $n$-digit numbers, specifically whether it can be done with fewer than $n$ elementary multiplications.
  • One participant notes that traditional multiplication requires $n^2$ elementary multiplications and $2n-1$ elementary additions, while also mentioning the Fast Fourier Transform (FFT) as a method that could reduce the number of multiplications to about $cn \ln n$ operations.
  • Another participant provides a mathematical explanation of how the FFT relates to the multiplication of two numbers, discussing the convolution theorem and the operations involved.
  • There is uncertainty expressed regarding the exact workings of the FFT in this context, indicating that further clarification is needed.

Areas of Agreement / Disagreement

Participants generally agree that $n$ elementary operations are required for the addition of two $n$-digit numbers. However, the discussion around multiplication remains unresolved, with competing views on the number of operations required and the implications of using FFT.

Contextual Notes

The discussion includes assumptions about the definitions of elementary operations and the methods of addition and multiplication, which may not be universally accepted or defined. The relationship between FFT and multiplication is not fully clarified, leaving some aspects open to interpretation.

mathmari
Gold Member
MHB
Messages
4,984
Reaction score
7
Hey! :o

With the term "elementary operation" we mean to add two digits of the decimal system and to write the result and the carries. How many elementary operations do we need for the addition of two numbers with $n$ digits?
(we consider that the addition of two digits together with the carry that comes from previous operations is one elementary operation)

If we add two numbers with $n$ digits, we add at each step two digits, one of each number, and possibly a carry. That means that we need $n$ elementary operations.

Is this correct?

How could we show that the addition of any two numbers with $n$ digits each one of them, cannot be done with less than $n$ steps/elementary operations?
 
Technology news on Phys.org
Hey! (Smile)

Yes, that is correct. (Nod)

To add two n-digit numbers, each digit will have to be processed.
So we need at least n operations. (Wasntme)
 
I like Serena said:
Yes, that is correct. (Nod)

(Smile)
I like Serena said:
To add two n-digit numbers, each digit will have to be processed.
So we need at least n operations. (Wasntme)

I see... What about the multiplication? In this case we have to count separately the number of elementary additions and elementary multiplications (i.e., multiplications of two digits and writing the carries).
Can the multiplication of two $n$-digit numbers be done in less than $n$ elementary multiplications?
(we have to notice that the answer is not obvious as in the case of the addition. It can be done in about $cn \ln n$ elementary multiplications, for a constant $c$. This can be achieved using the Fast Fourier Transform. It is not known if this bound is optimal.) To multiplicate two $n$-digit numbers, do we not have to execute $n^2$ elementary multiplications and $2n-1$ elementary additions?

Could you explain to me how the Fast Fourier Transform is related to the multiplications of two numbers?
 
mathmari said:
To multiplicate two $n$-digit numbers, do we not have to execute $n^2$ elementary multiplications and $2n-1$ elementary additions?

The straight forward way to multiply requires indeed $n^2$ elementary multiplications.
After that, I think it takes $n^2-1$ elementary additions though. (Wasntme)

Could you explain to me how the Fast Fourier Transform is related to the multiplications of two numbers?

Well, this is the first time I hear about it.
Let me see... (Thinking)

If we multiply $\sum a_i 10^i$ with $\sum b_j 10^j$, we get:
$$\sum_i a_i 10^i \cdot \sum_j b_j 10^j
= \sum_i\sum_j (a_i 10^i) \cdot (b_j 10^j)
= \sum_m\sum_i (a_i 10^i) \cdot (b_{m-i} 10^{m-i})
= \sum_m c_m
$$
This is the sum of a sequence of convolutions, meaning we can apply the convolution theorem:
$$
c_m = \mathscr F^{-1}\{\mathscr F\{a_m10^m\} \cdot \mathscr F\{b_m10^m\}\}
$$

Since the FFT takes $O(n\log n)$ operations, evaluating all $c_m$ also takes $O(n\log n)$ operations.
After that they only need to be summed.

To be honest, I'm still not clear how it would work exactly, but I suspect it works something like this. (Wasntme)
 

Similar threads

  • · Replies 17 ·
Replies
17
Views
2K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
Replies
9
Views
1K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 14 ·
Replies
14
Views
2K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K