I am reading a paper and it mentions the following inequality to be true by Cauchy-Schwarz inequality: for $x_i, y_i \in \mathbb{R}^d$ for $i = 1,\ldots, n$, and any positive definite matrix $A \in \mathbb{R}^{d\times d}$, the following is true
\begin{equation} \sum_{i=1}^n x_i^\top A y_i \leq \sqrt{(\sum_{i=1}^n \|x_i\|_A)(\sum_{i=1}^n \|y_i\|_A)} \end{equation}
Can someone provide step by step proof of how CS inequality is used here?
Since $A$ is positive definite, there exists a matrix $B$ such that $A = B^\top B$. Next, note that $$x_i^\top Ay_i = x_i^\top B^\top By_i = (Bx_i)^\top (By_i)$$ for each $i\in\{1,2,\dots, n\}$. Put $$u := \begin{pmatrix} Bx_1 \\ Bx_2 \\ \vdots \\ Bx_n \end{pmatrix}\qquad\text{and}\qquad v := \begin{pmatrix} By_1 \\ By_2 \\ \vdots \\ By_n \end{pmatrix}.$$ Note that $u,v\in\mathbb R^{d^2}$. Now apply the Cauchy-Schwartz inequality:
$$u^\top v = \sum_{i=1}^n (Bx_i)^\top(By_i) \leq \sqrt{\left(\sum_{i=1}^n\vert(Bx_i)^\top(Bx_i)\vert\right)\left(\sum_{i=1}^n\vert(By_i)^\top(By_i)\vert\right)}.$$ Finally, note that $(Bz)^\top (Bz) = z^\top B^\top B z = z^\top Az$, and write $\Vert z\Vert_A$ for $z^\top Az$.