I have a statement which I'd have needed to solve a textbook exercice. I found a way around it, but I'm still curious about it - it seems reasonable, but I can't find the right argument for it. Here it is.
Let $a_1, \ldots, a_n, b_1, \ldots, b_n$ be non-negative real numbers. If $$ \sum_{i = 1}^n a_i b_i = \sum_{i = 1}^n a_i^2 = \sum_{i = 1}^n b_i^2 $$
then $a_i = b_i$ for each $1 \leq i \leq n$.
Also, does that work if we drop the second equality?