Intuition on proof of Cauchy Schwarz inequality To prove Cauchy Schwarz inequality for two vectors $x$ and $y$ we take the inner product of $w$ and $w$ where $w=y-kx$ where $k=\frac{(x,y)}{|x|^2}$ ($(x,y)$ is the inner product of $x$ and $y$) and use the fact that $(w,w) \ge0$ . I want to know the intuition behind this selection. I know that if we assume this we will be able to prove the theorem, but the intuition is not clear to me.

My favorite proof is inspired by Axler and uses the Pythagorean theorem (that $\|v+w\|^2 =\|v\|^2+\|w\|^2$ when $(v,w)=0$).  It motivates the choice of $k$ as the component of $y$ in an orthogonal decomposition (i.e., $kx$ is the projection of $y$ onto the space spanned by $x$ using the decomposition $\langle x\rangle\oplus \langle x\rangle^\perp$).  For simplicity we will assume a real inner product space (a very small tweak makes it work in both cases).
The idea is that we want to show $$\left|\left(\frac{x}{\|x\|},y\right)\right| = |(\hat{x},y)| \leq \|y\|,$$
where I have divided both sides by $\|x\|$ and let $\hat{x}=x/\|x\|$.  If we interpret taking an inner product with a unit vector as computing a component, the above says the length of $y$ is at least the component of $y$ in the $x$ direction (quite plausible).
Following the above comments we will prove this statement by decomposing $y$ into two components: one in the direction of $x$ and the other orthogonal to $x$.  Let $y=k\hat{x}+(y-k\hat{x})$ where $k = (\hat{x},y)$.  We see that
$$(\hat{x},y-k\hat{x}) = (\hat{x},y) - (\hat{x},k\hat{x}) = k - k(\hat{x},\hat{x})=0,$$
showing $\hat{x}$ and $y-k\hat{x}$ are orthogonal.  This allows us to apply the Pythagorean theorem:
$$\|y\|^2 = \|k\hat{x}\|^2+\|y-k\hat{x}\|^2 = |k|^2 + \|y-k\hat{x}\|^2 \geq |k|^2,$$
since norms are non-negative.  Taking square roots gives the result.
As a final comment, note that
$$k\hat{x} = (\hat{x},y)\hat{x} = \left(\frac{x}{\|x\|},y\right)\frac{x}{\|x\|} = \frac{(x,y)}{\|x\|^2}x$$
matches your formulation.
