I'm reading this data analytics book, and I came across the following problem:
Consider cosine similarity for two-dimensional non-negative feature data
Find all points that have a cosine similarity of 1 with (1, 1).
The solution is this equation: $\frac{x + y}{\sqrt{2 \cdot (x^2 + y^2)}} = 1$.
But I don't understand how we got this equation. As far as I know the cosine similarity takes 2 vectors and maps them onto the real numbers. The formula for the cosine similarity is $cos(x,y)= \frac{x \cdot y}{\sqrt{\sum x_i^2 \cdot \sum y_i^2}}$. How do we get $\frac{x + y}{\sqrt{2 \cdot (x^2 + y^2)}} = 1$ out of this? I don't see how that's possible.
If $a$ and $b$ are two vectors, cosine similarity is defined by $\cos(a,b)=\frac{a\cdot b}{||a||\times||b||}$. The formula you gave $$ \cos(a,b)= \frac{a \cdot b}{\sqrt{\sum a_i \cdot \sum b_i}} $$ is missing a power 2. The correct one is $$ \cos(a,b)= \frac{a \cdot b}{\sqrt{\sum a_i^2 \cdot \sum b_i^2}} $$ So in the case of two dimmensional vectors with $a=(1,1)$ and $b=(x,y)$ you directly get the answer you are looking for.