# Distance measure for binary arrays

Basically if I have binary sequence that I want to check against, and I want to determine how far other binary sequences are to this first sequence, what is the most appropriate measure to use.

The distance measures i have seen, like Manhattan etc., all give numeric values indicating ultimately the difference, not how far one sequence is from another.

For example -

A - 0101000010

B - 0000000010

C - 0101000000

D - 0000000100

C is much closer in similarity to A, than B is. I want a measure that calculates a percentage of the relative distances between all the values seen. The distance measures would score B and D the same - I want to show that D is actually further in similarity than B, and that C is the closest.

I have tried SOkal-SneathIV and other distance measures from "A Survey of Binary SImilarity and Distance Measures", 2009 - however for the sequences which have the same mismatches (regardless of position) end up with the same score - whereas I want the position reflected in the measure.

Thanks, U.

Why not just counting the components of the array that differ? This way the distance from A to be will be 2, from A to C 1, and from A to d 3.

Or if you prefer the square root of 2, of 1, of 3.

• Yes but then any sequences which have the same differences will receive the same score. So if SeqX and SeqY have two changes in total but in different places then the score would be 2 in both cases - I want a measure to help say which one is further from being identical. Thanks. U. May 3 '18 at 9:42

Here is a relatively standard distance measure for binary sequences: $$d(x,y) = 2^{-n}$$ where $$x$$ and $$y$$ have the same first $$n$$ digits and differ thereafter.