Prove there is a unique $x_0 \in M$ such that $\|x_0 - z\| = \inf_{x \in M} \|x-z\|$ and show $z-x_0 \perp M$ Prove there is a unique $x_0 \in M$ such that $$\|x_0 - z\| = \inf_{x \in M} \|x-z\|$$ and show $z-x_0 \perp M$.
Here, $X$ is a finite dimensional inner product space and $M$ is a proper, nonempty closed linear subspace of $X$ and $z\in X$. 
I've been thinking about this for a bit and I'm not really sure what to do with it. I feel like $x_0$ should be in $M$ because $M$ is closed but I'm not really sure. Any ideas or hints that could help me figure this out? 

Given $m,x_1\in M$, and $\alpha=m\cdot (x_1-z)\neq 0$, let $$x_2=x_1-\frac{\alpha}{\|m\|} m$$
Then $x_2\in M$, and 
$$\begin{align}
(x_2-z)\cdot(x_2-z) &= (x_1-z)\cdot(x_1-z)-2(x_1-z)\cdot\left(\frac{\alpha}{\|m\|}m\right) + \alpha^2\\
&=\|x_1-z\|^2 -\alpha^2 < \|x_1-z\|^2
\end{align}$$
So if $x_0$ exists, $z-x_0$ must be orthogonal to all elements of $M$.
If $x_1$ and $x_0$ are two elements of $M$ with the requested property, then:
$$(x_1-x_0)\cdot m = ((x_1-z)-(x_0-z))\cdot m = 0$$ for all $m$. But $x_1-x_0\in M$, and $x_1-x_0$ is perpendicular to every element of $M$. This means that $(x_1-x_0)\cdot(x_1-x_0)=0$, so $x_1=x_0$. 
So you are left proving that such an element $x_0$ exists, and then we'll know it is unique and $z-x_0\perp M$.
For any $n>0$, find $x_n\in M$ so that $$\|z-x_n\|< \frac{1}{n} + \inf_{x\in M} \|z-x\|$$ This $x_n$ exists by definition of $\inf$. Show that $\{x_1,\dots\}$ is bounded, and thus must have a convergent sub-sequence. Call the value it converges to $x_0$, and show that $\|z-x_0\|< \frac{1}{n} + \inf_{x\in M} \|z-x\|$ for all $n$.
