Proving $\sum\limits_{i=1}^k | \langle x,v_i \rangle \langle y,v_i\rangle| \leq \|x\|\cdot \|y\|$

Let $V$ be a real inner product space, and let $v_1,v_2, \dots ,v_k$ be an orthonormal set of vectors. How do you prove that

$$\sum_{i=1}^k | \langle x,v_i \rangle \langle y,v_i\rangle| \leq \|x\|\cdot\|y\|?$$

When does the equality hold?

I've been trying to do this with the Bessel and Cauchy-Schwarz inequalities, but I can't make it work yet. Any help would be greatly appreciated.


We don't necessarily know that $\{v_i:1\le i\le k\}$ is a basis of $V$ since we don't know the dimension of $V$, but we are given that $\{v_i\}$ are orthonormal; that is $\left<v_i,v_j\right>=0$ when $i\not=j$ and $\left<v_i,v_i\right>=1$.

Consider the vector $$ x^\perp=x-\sum_{i=1}^k\left<x,v_i\right>v_i\tag{1} $$ $x^\perp$ is perpendicular to $\{v_i\}$: $$ \begin{align} \left<x^\perp,v_j\right> &=\left<x-\sum_{i=1}^k\left<x,v_i\right>v_i,v_j\right>\\ &=\left<x,v_j\right>-\left<x,v_j\right>\left<v_j,v_j\right>\\ &=0\tag{2} \end{align} $$ Therefore, $x^\perp$ is perpendicular to $x-x^\perp=\sum\limits_{i=1}^k\left<x,v_i\right>v_i$.

Next consider $$ \begin{align} \left<x-x^\perp,y-y^\perp\right> &=\left<\sum_{i=1}^k\left<x,v_i\right>v_i,\sum_{j=1}^k\left<y,v_j\right>v_j\right>\\ &=\sum_{i=1}^k\left<x,v_i\right>\left<y,v_i\right>\left<v_i,v_i\right>\\ &=\sum_{i=1}^k\left<x,v_i\right>\left<y,v_i\right>\tag{3} \end{align} $$ Note that since $x^\perp$ is perpendicular to $x-x^\perp$, $$ \|x-x^\perp\|^2+\|x^\perp\|^2=\|x\|^2\tag{4} $$ which implies that $\|x-x^\perp\|\le\|x\|$.

Now $(3)$, Cauchy-Schwarz, and $(4)$ yield $$ \begin{align} \left|\sum_{i=1}^k\left<x,v_i\right>\left<y,v_i\right>\right| &=\left|\left<x-x^\perp,y-y^\perp\right>\right|\\ &\le\|x-x^\perp\|\|y-y^\perp\|\\ &\le\|x\|\|y\|\tag{5} \end{align} $$ To finish off the proof (thanks to cardinal), consider the vector $$ x^+=\sum_{i=1}^k\left|\left<x,v_i\right>\right|v_i\tag{6} $$ Note that $\|x^+\|^2=\sum\limits_{i=1}^k\left<x,v_i\right>^2=\|x-x^\perp\|^2$.

Plugging $x^+$ and $y^+$ into $(5)$ gives $$ \begin{align} \sum_{i=1}^k\left|\left<x,v_i\right>\left<y,v_i\right>\right| &=\left|\sum_{i=1}^k\left<x^+,v_i\right>\left<y^+,v_i\right>\right|\\ &\le\|x^+\|\|y^+\|\\ &\le\|x\|\|y\|\tag{7} \end{align} $$