Given a vector $x\in \Bbb R^n$ it is easy to see that $A:=\dfrac{xx^t}{x^tx}$ is symmetric and idempotent. i.e. $A^t=\dfrac{(xx^t)^t}{x^tx}=\dfrac{((x^t)^t(x)^t)}{x^tx}=A$ and $A^2=\dfrac{xx^txx^t}{x^txx^tx}=\dfrac{xx^t}{x^tx}=A$. and this matrix is same as the matrix of $z:=\alpha x$ for all $\alpha\neq 0$.
I want to see the 2-dimensional case. e.g. Given two non-colinear vectors $x,y\in \Bbb R^n$, the matrix $B:=\dfrac{xx^t}{x^tx}+\dfrac{yy^t}{y^ty}$ is clearly symmetric. But is it also idempotent and independent of the vectors $x,y\in \text{plane}(x, y)$? (I think it is not because of the sum or subtraction of two idempotent matrices is not idempotent most of times.) i.e. $B^2=B$ and $B=\dfrac{ww^t}{w^tw}+\dfrac{zz^t}{z^tz}$ for all non-colinear vectors $w, z\in \text{plane}(x, y)\subset \Bbb R^n$.
My try: $B^2=B+\dfrac{xx^tyy^t}{x^txy^ty}+\dfrac{yy^txx^t}{x^txy^ty}$ that seems it has some extra terms. So my construction is not working.
How to construct a symmetric and idempotent matrix from given two non-colinear vectors $x,y\in \Bbb R^n$?
When $x$ and $y$ are linearly independent, $u=\frac{x}{\|x\|}+\frac{y}{\|y\|}$ and $v=\frac{x}{\|x\|}-\frac{y}{\|y\|}$ form an orthogonal basis of the linear span of $x$ and $y$. Therefore $B=\frac{uu^T}{u^Tu}+\frac{vv^T}{v^Tv}$ is an orthogonal projection onto the linear span of $x$ and $y$. Unfortunately, this method does not generalise to three or more vectors.
For a truly general construction, use Moore-Penrose pseudoinverse. For any complex matrix $A$, $AA^+$ is the orthogonal projection onto the column space of $A$. In particular, when $A$ is a real matrix of full column rank, we have $AA^+=A(A^TA)^{-1}A^T$.