# A 3x3 image kernel takes 9 multiplications and 8 or 9 additions for each pixel?

I doubt because you have 9 multiplications and you are adding 9 numbers together, when using a 3x3 convolution matrix.

Adding 9 numbers: 1+2+3+4+5+6+7+8+9

We are performing 8 additions as we repeat the operation of 'adding' 8 times (8 times a '+' sign).

We can say there are 9 additions as well, if you would accept a definition like: 0+1+2+3+4+5+6+7+8+9

But what does make more sense for computers: 8 adds or 9 adds?

## 1 Answer

As you have 9 terms to add together, your computer will perform 8 additions as each addition needs two inputs. So you have 9 multiplications and 8 additions.

• A computer does memory operations as well, like pop and push (intel architecture). Those don't count as addition? – user8005 May 30 '13 at 3:53
• Counting instructions is not the same as counting arithmetic operations. The instructions required to perform 9 muls and 8 adds may vary a great deal dependent on the target. – niaren May 30 '13 at 6:50