When does the Cauchy-Schwarz inequality become an equality? For two vectors $|f\rangle$ and $|g\rangle$, the Cauchy-Schwarz inequality becomes an equality when $$|h\rangle=|f\rangle-\frac{\langle f|g\rangle}{\langle g|g\rangle}|g\rangle$$ is a null vector. This happens when $|f\rangle$ is linearly dependent on $|g\rangle$ i.e. $|f\rangle=\alpha|g\rangle$ where $\alpha$ is a complex number.
But if we substitute this into the expression of $|h\rangle$ above we get, $$|h\rangle=\alpha|g\rangle-\alpha^*\frac{\langle g|g\rangle}{\langle g|g\rangle}|g\rangle=(\alpha-\alpha^*)|g\rangle$$ which is nonzero unless $\alpha$ is real.
What is wrong with my argument?
 A: Your vector $|h\rangle$ is meant to be the coprojection of $f$ onto the span of $g$. For it to be that, when you take the inner product of $f$ with $g$, $f$ must appear in the linear position, not the conjugate-linear position. Which position that actually is varies somewhat among authors, but generally in bra-ket notation the inner product is linear in the kets, i.e. in the second position, which seems to be how you're doing it.
In other words you should have had $|h\rangle=|f\rangle-\frac{\langle g|f\rangle}{\langle g|g\rangle}|g\rangle$, and then the problem disappears.
A: The Cauchy-Schwarz inequality does become an equality when your condition is satisfied (provided the vectors are of the proposed form $|f\rangle=\alpha|g\rangle$), but not only when it is. The equality is trivial if $|f\rangle$ or  $|g\rangle$ are null vectors, so let us assume they aren't. The condition we need is $$\langle f|f\rangle=\frac{\langle f|g\rangle \langle g|f\rangle}{\langle g|g\rangle}$$ which only requires $|f\rangle=\alpha|g\rangle$ just as you stated (to prove this condition from the above equation you may write $|f\rangle-\alpha|g\rangle=|u\rangle$ and then prove that $|u\rangle$ is zero). In fact, if you let $\langle g|$ act on the vectors from your first equation, you will find that $\langle g|h\rangle=\langle g|f\rangle - \langle f|g\rangle$, so $|h\rangle$ is only a null vector if $\langle g|f\rangle$ is a real number, which is why your assumption leads to real $\alpha$.
