# “Share” and “no share” measure between two vectors

Given two $n-$dimensional vector, namely $U = [u_1,u_2 \cdots u_n]$ and $V=[v_1,v_2 \cdots v_n]$ such that $\sum_i u_i = \sum_i v_i = 1$ and $u_i \in [0,1]$ and $v_i \in [0,1]$, i would like to derive a $\text{Share_coefficient}$ and $\text{NoShare_coefficient}$ measure which satisfies the below constraint.

1. $\text{Share_coefficient} + \text{NoShare_coefficient} = 1$
2. $\text{Share_coefficient}\geq 0$ and $\text{NoShare_coefficient}\geq 0$
3. When the vector $U$ and $V$ are identical then $\text{Share_coefficient}=1$
4. When the vector $U$ and $V$ are disjoint (e.g., $U=[1\;\; 0\;\; 0]$ and $V = [ 0\;\; 0.5 \;\; 0.5]$) then $\text{NoShare_coefficient}=1$
5. For other combination of vector $U$ and $V$, the coefficients are assigned accordingly; i.e. when the overlap between the vectors is more, then $\text{Share_coefficient}$ should be greater than $\text{NoShare_coefficient}$ and vice versa.

I derived the following measure.
$$\text{Share_coefficient} = 1- \frac{1}{2}\sum_i|u_i-v_i|\quad\text{ and }\quad \text{NoShare_coefficient} = \frac{1}{2}\sum_i|u_i-v_i|$$

But it is unable to distinguish the below two example

1. $U=[1\;\; 0\;\; 0]$ and $V=[0.5\;\; 0.5\;\; 0]$ (only 2-dimension are involved out of 3-dimension)
2. $U=[0.5\;\; 0.5\;\; 0]$ and $V=[0\;\; 0.5\;\; 0.5]$ (all the dimension are involved)

Both these example provides $\text{Share_coefficient} = \text{NoShare_coefficient} = 0.5$. However I would like to distinguish these two example by assigning different values.

Can anyone help me out in deriving a measure which distinguish the above example and satisfies the mentioned constraint?

-
Presumably, if you don't want these two cases to result in the same share coefficient, you also have some preference which of them should result in the higher one? – joriki Dec 20 '11 at 16:44
When you say you'd like to dinstinguish between these two cases, do you know which one you'd like to be greater? It seems like the most likely candidate for your share and no-share functions are the $cos^2$ and $sin^2$ of the angle between the two vectors. – Thomas Andrews Dec 20 '11 at 16:44
I would like the $share\_coefficient$ of first example to be greater than the second example. – Learner Dec 20 '11 at 16:47
Have you tried the correlation coefficient $$\text{share-coeff} = \frac{\sum_i u_iv_i}{\sqrt{\sum_i u_i^2}\sqrt{\sum_i v_i^2}}, ~\text{no-share-coeff} = 1 - \text{share-coeff}$$ – Dilip Sarwate Dec 20 '11 at 16:49
The cosine of the angle between two vectors can be computed as $\frac{u\cdot v}{|u||v|}$, so $cos^2$ can be written as $\frac{(u\cdot v)^2}{(u\cdot u)(v \cdot v)}$ which gives $0.5$ for your first example and $0.25$ for the second example. – Thomas Andrews Dec 20 '11 at 16:50

If two vectors are "disjoint" in your sense, then they are perpendicular - the angle between them is $\frac{\pi}2$. On the other hand, the angle between a vector and itself is $0$. Since you want the share value in these cases to be $0$ and $1$, respectively, this seems like the cosine function.
Since you want the values for share and no-share to add to $1$, I'd choose the squares of the cosine and sine of the angle between the two vectors to be your two functions.
Since the cosine of the angle between $U$ and $V$ can be written as $\frac{U\cdot V}{|U||V|}$, you can write:
$$\text{Share_coefficient}(U,V)=\frac{(U\cdot V)^2}{(U\cdot U)(V\cdot V)}$$