8
$\begingroup$

Till now I know correlation tells about similarity. I was watching a video lecture on image similarity in which I came to know that correlation is analogous to dot product. And hence correlation of two images is maximum when these images are similar as happens in dot product of two aligned(similar) vectors.

Dot product of two vectors $a=[a_1, a_2, a_3, .....]$ and $b=[b_1, b_2, b_3, .....]$ is given as $$a\cdot b=\sum_{i}a_ib_i$$ While cross correlation of two discrete real signals $x(n)$ and $y(n)$ is given as $$R_{xy}(n)=\sum_mx(m)y(n+m)$$
So now I want to know:

  • How correlation is analogous to dot product?
  • When is correlation maximum?
  • Why?
$\endgroup$
5
  • $\begingroup$ So write down the formula for dot product of two functions (add that to your question). Do the same for correlation (and add that to your question). $\endgroup$ Dec 16, 2016 at 9:39
  • $\begingroup$ @Marcus I dont understand what exactly you are asking me to do. Can you please answer this question or is there something wrong in the question ? $\endgroup$
    – No Sound
    Dec 16, 2016 at 9:49
  • $\begingroup$ I think the question doesn't show your real problem: since you're asking about the analogy between correlation and dot product, you definitely know what both of them are - and if you added that knowledge, in the shape of formulas, to your question, we could much easier answer it! $\endgroup$ Dec 16, 2016 at 10:27
  • $\begingroup$ So: edit your question to include the definition of correlation and of dot-product. Then, explain with these what you need help with. The way you ask this now, I really don't know where to start explaining! $\endgroup$ Dec 16, 2016 at 10:30
  • $\begingroup$ I have edited the question and I am waiting for explanation. $\endgroup$
    – No Sound
    Dec 16, 2016 at 15:15

1 Answer 1

3
$\begingroup$

So using your formula for the cross-correlation:

$$R_{xy}(n)=\sum_m x(m)y(n+m)$$

we see that

$$\begin{align} R_{xy}[n]&=\sum_m x[m]y[n+m]\\ &= \sum_m x[m] \tilde y_n[m]\\ &= x \cdot \tilde y_n\\ \text{for}\\ \tilde y_n[k] &= y[n+k]\text{ ,}\\ \end{align}$$ which is a dot product.

So for any "shift" in the cross-correlation, you have the dot product of the first operand with the $n$-shifted second operand.

Note, by the way, that your formulas are only correct for real-valued $x$, i.e. in general, the correct formula for dot product and cross correlation are:

$$\begin{align} x\cdot y &= \sum\limits_{i=0}^{N-1} x^*[i]y[i]\\ R_{xy}[n] &= \sum\limits_{i=0}^{N-1} x^*[i]y[n+i]\\ \text{with}\\ x,y &\in \mathbb C^N\\ {z}^*&= \Re\{z\} - \Im\{z\} \end{align}$$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.