# Orthogonal Projection in Subespace Proof

Let $$M$$ be a subspace of $$R^n$$ and $$z\notin M$$. Show that the orthogonal proyection of $$z$$ in $$M$$ is $$\bar x$$ if and only if:

$$(z-\bar x,x)=0,$$ $$\forall x \in M$$

How can i prove it? I know that for a convex, closed and not empty $$C \subset R^n$$, there is an only $$\bar x \in C$$ orthogonal projection of $$z$$ in $$C$$, that:

$$(x-\bar x,\bar x-z)\geq 0,$$ $$\forall x \in C$$

But i dont know how can i used it for the proof.

• Are you aware of the fact that z can be written as a sum of a vector in M and a vector in the orthogonal complement of M in a unique way? – Itamar Vigi Aug 16 at 18:42
• No, because this is a proof by steps, and the orhogonal complement is defined later – JudeRyder Aug 16 at 18:56