# Intuition about the Cauchy-Schwarz inequality and optimization problems

I'm trying to develop intuition about the Cauchy-Schwarz inequality.

Suppose I have positive real vectors x and y. The values of x are already determined and I want to find the values of y that maximize $\sum_i x_iy_i$ subject to $\sum_i y_i^2 \leqslant c$, where $c$ is some constant. For these kinds of problems, I'm usually pointed to Cauchy-Schwarz.

Using the Cauchy-Schwarz inequality, I can write the following:

$(\sum_i x_iy_i)^2 \leqslant (\sum_i x_i^2)(\sum_i y_i^2)$

At this point I'm unsure of how to proceed. In a related question that I asked here, it was suggested that I find the values for which equality holds in Cauchy-Schwarz; I am still not sure why, though. Does equality in Cauchy-Schwarz suggest that the left-hand side has been maximized? If so, I do not see why.

In this case, equality holds when there is some constant $k$ such that $x_i/y_i = k$ for all $i$. Once I've defined $y_i$ in such a way that equality holds in Cauchy-Schwarz, I would substitute that expression into $\sum_i y_i^2 = c$ and solve for the value of interest in terms of $c$. This will yield the parameters that maximize $\sum_i y_i^2$ (and thus, maximize $\sum_i x_iy_i$) subject to the upper bound $c$.

Does this approach make sense and, if so, why is it that we use the values of $y_i$ where equality holds in Cauchy-Schwarz? I don't yet understand the implications of equality in Cauchy-Schwarz.