# Cosine distance in a space, and cheating?

I read an example of using cosine distance in RGB space, and it pointed out that (eg.) dark red and light red have a cosine distance (CD) of zero because CD only gives you the angle between vectors and doesn't consider length. Fair enough. I wondered if a way to fix this was by making it a four dimensional problem by adding the vector length VL, calculated in the normal Euclidean way way.

But this seems to be cheating because the R,G,B components are independent of each other whereas the length component VL is clearly a function of R, G and B. In some sense I'm not adding new information (or am I?)

I can't help feeling this shouldn't work, but it seems to as far as I can tell. Am I mistaken?

This is not about Cosine Vs. Euclidean distance but what the implications are of adding the latter to the former.

(I'm starting to wonder if, as CD is blind to vector length VL, I'm simply making VL visible to it by explicitly adding it back in as an extra dimension. That said, VL is entirely a function of the other dimensions so something doesn't feel right).

• I doubt the question is answerable on the information provided. How would you define whether this "works"? I don't see any requirements or metrics for evaluating whether it is satisfactory. P.S. Have you considered L2 distance? P.S. Are you familiar with perceptual distance and other colorspaces? Simple distance measures on RGB probably don't correspond very well to human perception of similarity of colors.
– D.W.
May 20, 2022 at 7:04
• RGB was just used as an example space. I've removed it from the heading, sorry for the confusion. As for whether it's answerable, I can't understand how you can't understand it, so I don't know how to clarify, sorry :-) (will look at L2 distance, never heard of it, ta - hang on, L2 is euclidean says wiki, which is used in my question??) May 20, 2022 at 7:11
• You should only use cosine distance if you want to ignore the vector length. Ignoring the length is the point of it, not a problem that needs fixing. If you don't want that property then you should use a metric, such as Euclidean distance, that fits your objective better. What is your objective? May 21, 2022 at 16:42
• I've learnt some useful things here but I can't accept any answers because they aren't relevant to my question. It may not be answerable as-is. I guess my question was a poor one, as D.W. initially said, so that's on me. Jun 8, 2022 at 9:31