Prove that if $V$ is an inner product space, then $|\langle x,y\rangle| = \Vert x \Vert\Vert y\Vert$ if and only if one of the vectors $x$ or $y$ is a multiple of the other.
I am given a hint to let $a= \frac{\langle x,y\rangle}{\|y\|^2}$, and let $z = x - ay$, then prove $y$ and $z$ are orthogonal and $|a|= \frac{\|x\|}{\|y\|}$. I don't know how they come up with this, what was the original idea?
This is orthogonal projection of $x$ onto $y$. Assume that $y\neq 0$.
The goal is to decompose $x$ into a sum $x=w+z$ of two vectors, $w$ being parallel to $y$ and $z$ perpendicular to $y$. Since $w$ is parallel to $y$, we have $w=a y$ for some real number $a$. And note that, once $w$ (that is $a$) is known, we can compute $z$ by the formula
$$z=x-ay$$
We only need to compute $a$. But, if $x=w+z$, then $\langle x,z\rangle = a\langle y,y\rangle+\langle z,y\rangle = a\left\| y\right\|^2$ so
$$ a = \frac{\langle x,y\rangle}{\left\|y \right\|^2} $$
Finally, $x$ is parallel to $y$ if and only if $x=w$, which is equivalent to $z=0$.