thumb|400px|class=skin-invert-image|Visual comparison of convolution, cross-correlation, and [[autocorrelation. For the operations involving function f, and assuming the height of f is 1.0, the value of the result at 5 different points is indicated by the shaded area below each point. The symmetry of f is the reason f \star g and g*f are identical in this example. ]]
thumb|400px|class=skin-invert-image|Visual comparison of convolution, cross-correlation, and [[autocorrelation. For the operations involving function f, and assuming the height of f is 1.0, the value of the result at 5 different points is indicated by the shaded area below each point. The symmetry of f is the reason f \star g and g*f are identical in this example. ]]
In mathematics (in particular, functional analysis), convolution is a mathematical operation on two functions f and g that produces a third function f*g, as the integral of the product of the two functions after one is reflected about the y-axis and shifted. The term convolution refers to both the resulting function and to the process of computing it. The integral is evaluated for all values of shift, producing the convolution function. The choice of which function is reflected and shifted before the integral does not change the integral result (see commutativity). Graphically, it expresses how the 'shape' of one function is modified by the other.
Discovered by embedding cosine similarity (sentence-transformers MiniLM, 384-dim).