I am reading something in quantum mechanics, and it has the following claim.
Setting: Consider a complex vector space $\mathbb{C}^k$, its projective space $P(\mathbb{C}^k)$. For nonzero $x \in \mathbb{C}^k$, we denote $x'$ the corresponding equivalence class of $x$ in $P(\mathbb{C}^k)$. We also consider the set of density matrices $D_k = \{\rho \in M_k(\mathbb{C})| \rho \geq 0, \text{tr }\rho = 1\}$ where $M_k(\mathbb{C})$ is the set of $k \times k$ complex matrices. The set $D_k$ is in one-to-one correspondence with the projective space by the bijection $$ P(\mathbb{C}^k) \ni x' \mapsto \pi_{x'} \in D_{x'} $$ with $\pi_{x'}$ the orthogonal projector on the corresponding ray in $\mathbb{C}^k$.
Claim. $$\operatorname{tr}(\pi_{x'}\pi_{y'}) = |\langle y,x\rangle|^2$$
I am not sure why this is true.
It's a straightforward computation, assuming that $x,y$ are unit vectors. The projection $\pi_{x'}$ is the operator $$ \pi_{x'}z=\langle z,x\rangle\,x. $$ Then $$ \pi_{x'}\pi_{y'}z=\langle z,y\rangle\pi_{x'}y=\langle z,y\rangle\langle y,x\rangle \,x. $$ In particular, $$ \pi_{x'}\pi_{y'}x=|\langle x,y\rangle|^2\,x. $$ Now form an orthonormal basis $\{x,e_2,\ldots,e_n\}$, and calculate the trace along that basis: $$ \operatorname{tr}(\pi_{x'}\pi_{y'})=|\langle x,y\rangle|^2\langle x,x\rangle=|\langle x,y\rangle|^2. $$