3
$\begingroup$

assuming I have two vectors $A$ and $B$, where $A$ is completely known and from $B$ I know only that the first k components are 0. What is the maximum possible cosine value for the angle between the vectors given these constraints? (best case scenario for the remaining components of B)

All vector components are positive, so that the cosine will be between 0 and 1.

I found the formula $\frac{\sqrt{\sum_{i=k}^{n}{A_i^2}}}{\|A\|}$ myself using logic and experimenting, but I'm looking for a formal proof.

Geometrically it seems logically that the cosine should be highest when all the remaining components of $b$ equal the ones in $a$, but I don't have a proof for this either.

Cosine Similarity formula I'm using: $\cos(\theta) = {A \cdot B \over \|A\| \|B\|} = \frac{ \sum_{i=1}^{n}{A_i \times B_i} }{ \sqrt{\sum_{i=1}^{n}{(A_i)^2}} \times \sqrt{\sum_{i=1}^{n}{(B_i)^2}} }$

$\endgroup$

1 Answer 1

2
$\begingroup$

You can write $A$ as $(A_\perp,A_\parallel)$ and $B$ as $(0,B_\parallel)$; then $A\cdot B=A_\parallel\cdot B_\parallel$ and $|B|=|B_\parallel|$, so $\cos\angle(A,B)=(|A_\parallel|/|A|)\cos\angle(A_\parallel,B_\parallel)$. The factor depends only on $A$, so the same $B$ maximizes the two cosines. Clearly $B_\parallel\parallel A_\parallel$ maximizes $\cos\angle(A_\parallel,B_\parallel)$ with maximal value $1$, and the corresponding maximal value of $\cos\angle(A,B)$ is the factor $|A_\parallel|/|A|$.

$\endgroup$
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .