Multiplication of n dimensional skew-symmetric matrix and projection matrix. Problem is related to the  question
I checked that
if we take any non-zero skew-symetric matrix in 2D and multiply it by a projection matrix for any vector of standard basis we obtain  non-zero matrix $A$ with property $A^2=0$.
The same was checked by me for 3D and 4D...
My questions are:


*

*Is the statement above true for any dimension n?  

*If so how to prove it?    

*Is it the only method (for $n$-dimension)  of generating similar matrices or can be  devised other general procedure (not equivalent) for n-dimension?

 A: EDIT: See addendum for the general case.
In what follows, let $R(C)$ denote the column space or range of a matrix $C$, let $N(C)$ denote its null space or kernel, and let $r(C) = \dim R(C) = \dim R(C^T)$ denote its rank.
I claim that the best result you can get along these lines is the following:

Let $A \in \mathbb{R}^{n \times n}$. Then the following are equivalent:
  
  
*
  
*$A^2 = 0$ and $r(A) = 1$;
  
*$A = BP$ for $B\in \mathbb{R}^{n \times n}$ satisfying $B^T = -B$ and $P \in \mathbb{R}^{n\times n}$ satisfying $P^2 = P^T = P$, $r(P)=1$, and $BP \neq 0$;
  
*$A = vw^T$ for non-zero $v,w \in \mathbb{R}^n$ with $v^Tw = 0$.
  

Before continuing with the proof, let me make some comments:


*

*Your proposed construction, when it does work, is a special case of 2., but you do need to be careful: if
$$
 B = \begin{pmatrix}0&-1&0\\1&0&0\\0&0&0\end{pmatrix}, \quad P = \begin{pmatrix}0&0&0\\0&0&0\\0&0&1\end{pmatrix},
$$
then $BP = 0$ precisely because $P = e_3 e_3^T$ and $Be_3 = 0$.

*A correct version of the result you're seem to be after is that 1. and 2. are equivalent; however, the actual heart of the matter is that 1. and 3. are equivalent. 

*In 1., the condition $r(A) = 1$, which is automatic for non-zero $A \in \mathbb{R}^{2 \times 2}$ with $A^2 = 0$, is non-trivial for larger square matrices $A$ with $A^2 = 0$, as is demonstrated by the $4 \times 4$ matrix
$$
 A = \begin{pmatrix}0&1&0&0\\0&0&0&0\\0&0&0&1\\0&0&0&0\end{pmatrix}
$$
which is a rank $2$ matrix with $A^2 = 0$.


At last, let's turn to the proof. Let's first see that 2. and 3. are equivalent. On the one hand, suppose that $A = BP$ for $B\in \mathbb{R}^{n \times n}$ satisfying $B^T = -B$ and $P \in \mathbb{R}^{n\times n}$ satisfying $P^2 = P^T = P$, $r(P)=1$, and $BP \neq 0$. Since $P$ is a rank $1$ matrix, we can write $P = ww^T$ for $w$ any unit vector spanning the $1$-dimensional subspace $R(P)$. Then $A = BP = Bww^T = vw^T$, where $v := Bw \neq 0$ since $A = BP \neq 0$ and where $v^T w = 0$ since
$$
 v^T w = (Bw)^T w = w^T B^T w = -w^T B w = -w^T v = -v^T w.
$$
On the other hand, suppose that $A = vw^T$ for non-zero $v,w \in \mathbb{R}^n$ with $v^Tw = 0$. Then we can write $A = BP$ for $B = vw^T-wv^T$ and $P = \frac{1}{\|w\|^2}ww^T$, which satisfy our requirements.
Finally, let's turn to the very heart of the matter, the equivalence of 1. and 3. On the one hand, suppose that $A^2 = 0$ and $r(A) = 1$. Since $A$ has rank $1$, we can write it as $A = vw^T$ for $w$ any unit vector spanning the $1$-dimensional subspace $N(A)^\perp = R(A^T)$ and $v = Aw$; since $A^2 = 0$, it follows that $R(A) \subset N(A) = R(A^T)^\perp$, and hence that $v = Aw \in R(A)$ is perpendicular to $w \in R(A^T)$. On the other hand, suppose that $A = vw^T$ for non-zero $v,w \in \mathbb{R}^n$ with $v^Tw = 0$. Since $w^Tv = v^Tw=0$, it follows that $A^2 = vw^Tvw^T = v(w^Tv)w^T = v0w^T = 0$; since $A = vw^T$, it follows that $R(A) = \operatorname{Span}\{v\}$, so that $r(A) = 1$.
ADDENDUM: If you're interested in the general case, here's what's going on:

Let $A \in \mathbb{R}^{n \times n}$. Then $A^2 = 0$ if and only if $A = \sum_{i=1}^{k} v_i w_i^T$, where $v_1,\dots,v_k,w_1,\dots,w_k \in \mathbb{R}^n$ satisfy $\{v_1,\dotsc,v_k\} \subset \{w_1,\dotsc,w_k\}^\perp$.

On the one hand, suppose that $A = \sum_{i=1}^{k} v_i w_i^T$, where $v_1,\dots,v_k,w_1,\dots,w_k \in \mathbb{R}^n$ satisfy $\{v_1,\dotsc,v_k\} \subset \{w_1,\dotsc,w_k\}^\perp$. Then, by our choice of the $v_i$ and $w_j$,
$$
 A^2 = \left(\sum_{i=1}^k v_i w_i^T\right)\left(\sum_{j=1}^k v_j w_j^T\right) = \sum_{i,j=1}^k v_i w_i^T v_j w_j^T = \sum_{i,j=1}^k v_i (w_i^T v_j) w_j^T = \sum_{i,j=1}^k v_i 0 w_j^T = 0.
$$
On the other hand, suppose that $A^2 = 0$, so that $R(A) \subset N(A)$; observe that by the rank-nullity theorem, $r(A) \leq n - r(A)$, and hence $r(A) \leq n/2$. Choose an orthonormal basis $\{w_1,\dotsc,w_{r(A)}\}$ for $N(A)^\perp = R(A^T)$, so that the orthogonal projection of any $x \in \mathbb{R}^n$ onto $N(A)^\perp$ is
$$
 \operatorname{Proj}_{N(A)^\perp}(x) = \sum_{i=1}^{r(A)} w_i w_i^T x.
$$
Then, for any $x \in \mathbb{R}^n$,
$$
 Ax = A\operatorname{Proj}_{N(A)^\perp}(x) = A\sum_{i=1}^{r(A)} w_i w_i^Tx = \sum_{i=1}^{r(A)}(Aw_i)w_i^Tx,
$$
so that $A = \sum_{i=1}^{r(A)} v_i w_i^T$ for $v_i := Aw_i$, where
$$
 \{v_1,\dotsc,v_{r(A)}\} \subset R(A) \subset (N(A)^\perp)^\perp = \{w_1,\dotsc,w_{r(A)}\}^\perp
$$
as required.
This now gives you a complete algorithm for constructing any square matrix $A \in \mathbb{R}^{n \times n}$ such that $A^2 = 0$:


*

*Choose $k$ vectors $w_1,\dotsc,w_k \in \mathbb{R}^n$, where $k \leq n/2$.

*Find $k$ vectors $v_1,\dotsc,v_k \in \{w_1,\dotsc,w_k\}^\perp$.

*Set $A = \sum_{i=1}^k v_k w_k^\perp$.


In particular, given any orthonormal basis $\{e_1,\dotsc,e_n\}$ of $\mathbb{R}^n$, e.g., the standard basis, you can do the following:


*

*Choose $k$ vectors $e_{i_1},\dotsc,e_{i_k}$ from the orthonormal basis, where $k \leq n/2$.

*Choose $k$ vectors $v_1,\dotsc,v_k \in \operatorname{Span}\{e_j \mid j \notin \{i_1,\dotsc,i_k\}\}$.

*Set $A = \sum_{j=1}^k v_j e_{i_j}^T$.


Indeed, a closer look at the proof above shows that every $A \in \mathbb{R}^{n \times n}$ with $A^2 = 0$ can be constructed in this refined way.
