Theorem: If $y \in V$ and $W \subset V$ is a subspace, then $||y-x|| \geq ||y- proj_w y||$ for all $x \in W$. Equality holds if and only if $x=proj_w y$.
Proof: Write $y=proj_w y+z$, where $z \in W^{\bot}$. Then \begin{align} &||y-x||^2 \\ & =||proj_w y+z-x||^2 \\ & =||(proj_w y-x)+z||^2 \\ &=||proj_w y-x||^2+||z||^2 \\& \geq ||z||^2=||y-proj_w y||^2 \end{align}
Taking a square root, if $||y-x||=||y-proj_w y||$, then $||z||^2=||y-x||^2=||proj_w y-x||^2+||z||^2 \Rightarrow x=proj_w y$
Question: I am lost on taking a square root part, and how they arrive at $x=proj_w y$?
Since \begin{equation} \begin{array}{l} \|y-x\|^{2} &=\left\|\operatorname{proj}_{w} y+z-x\right\|^{2} \\ &=\left\|\left(\operatorname{proj}_w y-x\right)+z\right\|^{2} \\ &=\| \operatorname{proj}_w y-x \|^{2}+\| z\|^{2} \\ & \geq\|z\|^{2}=|| y-\operatorname{proj}_{w} y||^{2}, \end{array} \end{equation} the equality in $\| \operatorname{proj}_w y-x \|^{2}+\| z\|^{2} \geq\|z\|^{2}$ will be held only when $\| \operatorname{proj}_w y-x \|^{2} = 0$, thus $\operatorname{proj}_w y = x$.