In a convolutional neural network (CNN), when convolving the image, is the operation used the dot product or the sum of element-wise multiplication? The example below is taken from the lectures in deeplearning.ai shows that the result is the sum of the element-by-element product (or &quot;element-wise multiplication&quot;.  The red numbers represent the weights in the filter:
$(1*1)+(1*0)+(1*1)+(0*0)+(1*1)+(1*0)+(0*1)+(0*0)+(1*1) 
= 1+0+1+0+1+0+0+0+1 
= 4 $

HOWEVER, most resources say that it's the dot product that's used:

&quot;…we can re-express the output of the neuron as , where is the bias
term. In other words, we can compute the output by y=f(x*w) where b is
the bias term. In other words, we can compute the output by
performing the dot product of the input and weight vectors, adding in
the bias term to produce the logit, and then applying the
transformation function.&quot;

Buduma, Nikhil; Locascio, Nicholas. Fundamentals of Deep Learning: Designing Next-Generation Machine Intelligence Algorithms (p. 8). O'Reilly Media. Kindle Edition.

&quot;We take the 553 filter and slide it over the complete image and
along the way take the dot product between the filter and chunks of
the input image.  For every dot product taken, the result is a
scalar.&quot;

The best explanation of Convolutional Neural Networks on the Internet!

&quot;Each neuron receives some inputs, performs a dot product and
optionally follows it with a non-linearity.&quot;

CS231n Convolutional Neural Networks for Visual Recognition

&quot;The result of a convolution is now equivalent to performing one large
matrix multiply np.dot(W_row, X_col), which evaluates the dot product
between every filter and every receptive field location.&quot;

CS231n Convolutional Neural Networks for Visual Recognition
However, when I research how to compute the dot product of matrics, it seems that the dot product is not the same as summing the element-by-element multiplication. What operation is actually used (element-by-element multiplication or the dot product?) and what is the primary difference?
The convolution can be written as 

$I(x,y) = \sum_{i=0}^n \sum_{j=0}^m k(i,j) I(x+i, y+j)$

where the kernel $k$ is of size $n$ by $m$. The image is size $N$ by $M$. Ok so in your example we are evaluating $I(0,0)$, our kernel is $n=3$ and $m=3$. Then our image is $N=5$ and $M=5$. If you go through the equation then you will see that you get exactly the result you showed.

$(1∗1)+(1∗0)+(1∗1)+(0∗0)+(1∗1)+(1∗0)+(0∗1)+(0∗0)+(1∗1)=1+0+1+0+1+0+0+0+1=4$

This is a dot product as defined as being a sum of products. We multiply element-wise and then we add them all together. The result is the answer you got $4$.

The entire convolution operation across the image is a matrix where each entry is this dot product.