<s>[INST] Proving Schwarz inequlity. Is the following proof correct?
The Schwarz inequality states:
$$
x_1 \cdot y_1 + x_2 \cdot y_2 \leq \sqrt{(x_1^2+x_2^2)\cdot(y_1^2+y_2^2)}
$$
From
$$
(x_1^2+x_2^2)\cdot(y_1^2+y_2^2)
$$
We can deduce:
$$
(x_1^2+x_2^2)\cdot(y_1^2+y_2^2) = (x_1y_1+x_2y_2)^2 + (x_1y_2-x_2y_1)^2
$$
We can rewrite it in form:
$$
(x_1y_2-x_2y_1) = \sqrt{(x_1^2+x_2^2)\cdot(y_1^2+y_2^2) - (x_1y_1+x_2y_2)^2}
$$
Meaning that 
$$
(x_1^2+x_2^2)\cdot(y_1^2+y_2^2) - (x_1y_1+x_2y_2)^2 \geq 0
$$
From which the Schwarz inequality can be easily deduced.
$$
\sqrt{(x_1^2+x_2^2)\cdot(y_1^2+y_2^2)} \geq x_1y_1+x_2y_2
$$
 [/INST] Yes it is correct even if from here 
$$(x_1^2+x_2^2)\cdot(y_1^2+y_2^2) = (x_1y_1+x_2y_2)^2 + (x_1y_2-x_2y_1)^2$$
we can deduce directly that 
$$(x_1^2+x_2^2)\cdot(y_1^2+y_2^2) - (x_1y_1+x_2y_2)^2=(x_1y_2-x_2y_1)^2 \geq 0$$
This proof is nice but it is limited to n=2, for a general proof we can start from
$$\sum x_iy_i\le \sqrt{\sum x_i^2\sum y_i^2}$$
and observe that WLOG for homogenity we can rescale $x$ and $y$ such that $\sum x_i^2=\sum y_i^2=1$ and thus we need to prove that
$$\sum x_iy_i\le 1$$
then observe that
$x_iy_i\le \frac12(x_i^2+y_i^2)\iff (x_i-y_i)^2\ge 0$
then
$$\sum x_iy_i\le \frac12 \sum (x_i^2+y_i^2) =\frac12 (\sum x_i^2+\sum y_i^2)=1$$
</s>