# Cauchy Schwarz Inequality for numbers

The CS inequality is given by

$$x_1y_1 + x_2y_2 \leq \sqrt{x_1^2 + x_2^2}\sqrt{y_1^2 + y_2^2}$$

I read that if $x_1 = cy_1$ and $x_2 = cy_2$, then equality holds.

But I reduced the above to $c \leq \sqrt{c^2} = |c|$. So isn't this only true if $c > 0$?

• The inequality is usually stated with the expression on the left hand side replaced by its absolute value. Without this precaution, you need that either ($x_1=cy_1$, $x_2=cy_2$, and $c\ge 0$), or $y_1=y_2=0$. – Andrés E. Caicedo Jun 27 '13 at 0:02
• Right, I stole this one from Spivak and was pondering over it for 2 hours as to why he lets his constant run free. – Hawk Jun 27 '13 at 0:13

Assume $x_1,\dots,y_2$ are real numbers. We have $$(x_1^2+x_2^2)(y_1^2+y_2^2)-(x_1y_1+x_2y_2)^2=(x_1y_2-x_2y_1)^2.$$ This is the case $n=2$ of an identity due to Lagrange.

(See more on this, positive polynomials, sums of squares of polynomials, and Hilbert's 17th problem, in this old blog post of mine.)

This means that $|x_1y_1+x_2y_2|\le\sqrt{x_1^2+y_1^2}\sqrt{y_1^2+y_2^2}$, with equality iff $$\det\left(\begin{array}{cc}x_1&y_1\\ x_2&y_2\end{array}\right)=0,$$ that is, iff either there is a constant $c$ such that $x_1=cy_1$ and $x_2=cy_2$, or else $y_1=y_2=0$.

Since $a\le|a|$ for any real number $a$, it follows that $x_1y_1 + x_2y_2 \leq \sqrt{x_1^2 + x_2^2}\sqrt{y_1^2 + y_2^2}$, with equality as above, except that now we further need $c\ge 0$.

$c\le|c|$ ins't restricts to $c>0$

• That's not my question. I know this inequality holds, but it is equality is what I am asking. – Hawk Jun 27 '13 at 0:11

Suppose $(x_1,x_2)=c(y_1,y_2)$, then \begin{align} x_1y_1+x_2y_2&=cy_1^2+cy_2^2\\ x_1^2+x_2^2&=c^2y_1^2+c^2y_2^2 \end{align} Therefore, \begin{align} x_1y_1+x_2y_2 &=\frac{c}{|c|}\sqrt{x_1^2+x_2^2}\sqrt{y_1^2+y_2^2}\\ &=\pm\sqrt{x_1^2+x_2^2}\sqrt{y_1^2+y_2^2} \end{align} Thus, the equality only holds for $c\ge0$.

However, the inequality $$|x_1y_1+x_2y_2|\le\sqrt{x_1^2+x_2^2}\sqrt{y_1^2+y_2^2}$$ holds, and this equality holds if $(x_1,x_2)=c(y_1,y_2)$ for any $c$.