# How to show normalized cross correlation(NCC) lies in $[-1,1]$? [closed]

Provided two real number sequences: $a_1,a_2,...,a_n$;$b_1,b_2,...,b_n$, define their means respectively: $$\bar a=\frac{1}{n}\sum_{i=1}^n a_i,\bar b=\frac{1}{n}\sum_{i=1}^n b_i$$ and define their variances and covariance respectively: $$var(a)=\frac{1}{n}\sum_{i=1}^n (a_i-\bar a)^2,var(b)=\frac{1}{n}\sum_{i=1}^n (b_i-\bar b)^2,cov(a,b)=\frac{1}{n}\sum_{i=1}^n (a_i-\bar a)(b_i-\bar b)$$ naturally leads to the definition of normalized cross correlation: $$NCC=\frac{cov(a,b)}{\sqrt{var(a)var(b)}}=\frac{\sum_{i=1}^n(a_i-\bar a)(b_i-\bar b)}{\sqrt{\sum_{i=1}^n (b_i-\bar b)^2 \sum_{i=1}^n (a_i-\bar a)^2}}$$ Now how to show that $NCC$ lies in $[-1,1]$?

• It's not true. Let $a_1=a_2=b_1=b_2=1$. – user856 Jan 11 '18 at 7:29
• what is true is that $\sum_i |a_ib_i|\ge\sqrt{\sum_i|a_ib_i|^2}$ – Masacroso Jan 11 '18 at 7:32
• You can replace $a_ib_i$ with simply $x_i$ as they appear only as a product. Then the statement is wrong, but see here a correct one related to yours: math.stackexchange.com/questions/1129300/… – Jean-Claude Arbaut Jan 11 '18 at 7:33
• Sorry for my curtness, I tried to simplify the proof of normalized cross correlation lying in $[-1,1]$, but it is wrong, I need to edit my post. – Finley Jan 11 '18 at 7:34
• Why is this question edited to be almost not related to the original question? You should ask another question instead. Editing the question to become unrelated to the original question is unfair to the people who answered earlier. – edm Jan 11 '18 at 7:59

Assume two vectors $a=(a_1,...,a_n)$ and $b=(b_1,...,b_n)$. Their inner product could be defined as $$a.b=a_1b_1+...+a_nb_n$$ or equivalently $$a.b=|a||b|cos\theta$$ where $|a|$ denotes norm of a vector as $|a|=\sqrt{a_1^2+...+a_n^2}$ and $\theta$ is the angle between two vectors. We also know $$a.b\le|a||b|$$ with equality iff $\theta=0$ therefore by substitution we obtain: $$a_1b_1+...+a_nb_n\le \sqrt{a_1^2+...+a_n^2}\sqrt{b_1^2+...+b_n^2}$$
This is also referred to as Cauchy-Schwarz inequality. A general form can be written as: $$a_1b_1+...+a_nb_n\le {(a_1^2+...+a_n^2)^{p}}{(b_1^2+...+b_n^2)^{q}}$$ when $p+q=1$ and $p,q\ge0$
Try $n=2$, $a_1=a_2=b_1=b_2=1$.
We obtain $$2\leq\sqrt2.$$