Correlation as measure of similarity

Normalized correlation is used to measure how similar are two signals. I can understand similarity visually but I haven't seen a mathematical definition for the similarity of 2 signals anywhere. So I have 2 big questions that are bothering me:

1. Is there a mathematical definition for how similar two signals are?(similar in same fashion of visually similar)

2. With that definition, is there a proof that shows correlation is maximum between similar signals and not any other signal?

EDIT:

Okay so I thought about 1 and I have a mathematical definition for similar signals. Basically s1 is similar to s2 if they are proportional, that is s2 = a.s1. So we can focus on question 2 now :). A proof that says out of all functions out there, the correlation of s1 and s2 is maximum only if s1=k.s2

• en.wikipedia.org/wiki/Cross-correlation – Andy aka Aug 5 '17 at 17:40
• I couldn't comment due to me low reputation, but you may find this interesting. It is called wavelet-based semblance analysis - link.It is a signal processing technique used to compare to time series signals and has a range of visual outputs. – tomdertech Aug 5 '17 at 19:03
• I've read the wikipedia article. It doesn't define similarity or provide a proof why the correlation is max between 2 similar signals. – doubleE Aug 5 '17 at 19:21

As you correctly noted, similarity is not a rigorously defined mathematical term. However, "distance" can be defined mathematically. Quoting Wikipedia:

In statistics and related fields, a similarity measure or similarity function is a real-valued function that quantifies the similarity between two objects. Although no single definition of a similarity measure exists, usually such measures are in some sense the inverse of distance metrics...

Here's a hand-wavy explanation, the math isn't totally precise, but hopefully it's enough to get some intuition:

Let's say we have real valued signals $x(t)$ and $y(t)$ defined on the unit interval $t \in [0,1]$. We will say that these signals are similar if the distance $||x-y||$ is small. Note that there are various choices of how to measure distance. A commonly used distance measure is the squared difference a.k.a. L2 distance defined as $$||x-y||^2_{L^2} \triangleq \int_0^1 (x(t)-y(t))^2 dt \ .$$

Let's say we have three signals $x$, $y$ and $z$. Normalize all signal energies to 1 so that $\int_0^1 (x(t))^2 dt = 1,$ etc. Suppose $x$ is more similar to $y$ than $z$. This means

$$||x-y||_{L^2} < ||x-z||_{L^2}$$

or,

$$\int_0^1 (x(t)-y(t))^2 dt < \int_0^1 (x(t)-z(t))^2 dt$$

or, rearranging terms,

$$\int_0^1 x(t) y(t) dt > \int_0^1 x(t) z(t) dt \ .$$

In other words, the correlation between $x$ and $y$ is higher than that between $x$ and $z$. This shows that in order to find a "more similar" signal, maximizing the correlation is indeed the right thing to do (assuming L2 distance).

• That was a really insightful derivation...I tried to formulate the problem in a more precise way. Please see my edit to question. – doubleE Aug 5 '17 at 20:08
• Note that because I normalized all signal energies to 1, the constant k in your edited question is 1. In other words - the signal that is most similar to a given signal is the given signal itself. The maximum value of the correlation is then equal to the signal energy i.e. 1. – Atul Ingle Aug 5 '17 at 20:14
• as far as i can tell, the math is fine. there's nothing hand-wavy or imprecise about it. – robert bristow-johnson Aug 5 '17 at 22:35
• actually the L2 norm or "distance" is the square root of the expression above. but that fact does not change any of the reasoning, which is correct as is. – robert bristow-johnson Aug 5 '17 at 23:28
• @robertbristow-johnson thanks for the edits. I think it's a bit hand-wavy because I didn't precisely define these functions as being in the space $L^2[0,1]$. The choice of the interval $[0,1]$ is also arbitrary. I also assumed unit norm signals without much justification. – Atul Ingle Aug 5 '17 at 23:48