Understanding choice of $\lambda$ in proof of Cauchy-Schwarz inequality relying on the observation $0\le (x-\lambda y|x-\lambda y)$. In Luenberger book Cauchy-Schwarz Inequality is defined like this: For all $x,y$ in an inner product space $|(x|y)| \le \|x\|\|y\|$. Equality holds if and only if $x = \lambda y$ or $y = \theta$. 
Proof starts for all scalars $\lambda$, 
$$
0 \le (x-\lambda y | x-\lambda y) = 
(x|x) - \lambda(y|x) -
\bar{\lambda}(x|y) + |\lambda|^2 (y|y)
$$
I understand this expansion. But then, it will select a particular $\lambda  = (x|y)/(y|y)$, and obtains 
$$
0 \le (x|x)  - \frac{|(x|y)|^2}{(y|y)}
$$
I dont understand how he chose that particular $\lambda$. I guess I understand why, he chose it to get rid of it in the main equation, but is it okay to chose any $\lambda$ that will clean up the equation like this?
 A: 
I dont understand how he chose that particular $\lambda$. I guess I understand why, he chose it to get rid of it in the main equation, but is it okay to chose any $\lambda$ that will clean up the equation like this?

Yes, the inequality that you display holds for all $\lambda$ and so "it is okay
to choose any $\lambda$" that you like.  Luenberger's choice (it might well be the
one used originally by Cauchy and/or Schwarz) "cleans up the equation" as you
note, and provides motivation for its use.  But if you have another value for
$\lambda$ in mind that allows you to reach the conclusion
$$0 \le (x|x)  - \frac{|(x|y)|^2}{(y|y)},$$
(which is just a re-arrangement of the Cauchy-Schwarz Inequality), by all means, go for it.
See Appendix B of this Lecture Note for a more prolix proof of 
the Cauchy-Schwarz Inequality than the one in the Luenberger book.
A: As said before, we always have $$0\leq\|x-\lambda y\|^2=(x-\lambda y|x-\lambda y)$$
Of course the choice $\lambda=\frac{(x|y)}{\|y\|^2}$ is neither arbitrary or accidental luck. Geometrically the specific   $\lambda$ chosen is the one that gives the orthogonal projection of $x$ along the vector $y$. 
The product $(x|y)$ removes the part of $x$ that is orthogonal to $y$, and dividing by $\|y\|^2$ normalizes $y$. 
Consider the picture below where 


*

*the black arrow is to picture $x$

*the blue arrow is to picture $y$

*the red arrow is to picture $\lambda y$ 

*the green arrow is to picture $x-\lambda y$

A: You have a wrong idea. Actually, you don't need to select $\lambda$. For every $\lambda$,
$0 \le (x-\lambda y | x-\lambda y)$, that means
$0 \le  (x|x)-\lambda(y|x)-\bar{\lambda}(x|y) + |\lambda|^2 (y|y)$,Consider it a function with the independent variable $\lambda$. So if $\lambda$ is R
$\Delta= 4(x|y)^2-4(x|x)(y|y) \le 0$. If $\lambda is C$, you need to use other functions.
