A linear space of degenerate matrices. Denote by $M_n(\mathbb{R})$ the set of all $n$ by $n$ real matrices. It's a linear space over $\mathbb{R}$.


*

*Can we find a nontrivial vector subspace in which all the matrices are degenerate?


*If possible, what is the maximum possible dimension of this subspace?

I thought about the set of upper triangular matrices, where all the the numbers at a certain position on the diagonal line of all matrices are always zero. This meets the requirements, but I don't how to deal with the 'maximum' problem.
Any hints? Thank you in advance.
 A: I claim that the maximum dimension of a subspace of singular matrices of $M_n(\mathbb{R})$ is $n^2 - n$.
This number is achieved, for example, for the subspace of matrices having the first row equal to the zero vector. 
Now assume by contradiction that there were a subspace $S$ of singular matrices of dimension $n^2 - n + 1$. 
Firstly, there must be an element of $S$ having a nonzero entry in the first row and having all rows from $2$ to $n$ equal to $0$, by dimension considerations. To see why this is true, let A be the subspace of matrices of the form:
\begin{bmatrix}
    * & * & * & \dots  & * \\
    0 & 0 & 0 & 0  & 0 \\
    \vdots & \vdots & \vdots & \ddots & \vdots \\
    0 & 0 & 0 & 0  & 0 
\end{bmatrix}
Then $$\dim(A \cap S) = \dim(A) + \dim(S) - \dim(A + S) \geq n + n^2 - n + 1 - n^2 \geq 1$$ so there must be a nonzero matrix $X$ in $A \cap S$. 
Thus $X$ looks like: 
\begin{bmatrix}
    a_{11} & * & * & \dots  & * \\
    0 & 0 & 0 & 0  & 0 \\
    \vdots & \vdots & \vdots & \ddots & \vdots \\
    0 & 0 & 0 & 0  & 0 
\end{bmatrix}
WLOG assume $a_{11} \neq 0$ (otherwise permute the elements of the first row and apply below verbatim). 
Consider next the subspace $M$ of $M_n(\mathbb{R})$ of matrices of the form: 
\begin{bmatrix}
    0 & 0 & 0 & \dots  & 0 \\
    0 & * & * & *  & * \\
    \vdots & \vdots & \vdots & \ddots & \vdots \\
    0 & * & * & * & * 
\end{bmatrix}
 (it's like an embedding of $M_{n-1}(\mathbb{R})$ into $M_n(\mathbb{R})$). 
Now $$\dim(S \cap M) = \dim(S) + \dim(M) - \dim(S + M) \geq n^2-n+1 + (n-1)^2 - n^2 = n^2 - 3n + 2 > (n-1)^2 -(n-1) + 1$$ so by our induction hypothesis it follows that $S \cap M$ contains a matrix $Y$ which when viewed as an $(n-1)$ by $(n-1)$ matrix is invertible (and also Y has the first row equal to $0$ in $M_n(\mathbb{R})$. But then $X+Y$ will have a nonzero determinant, contradiction.
Also, after solving this problem I found a more general problem (that implies it) here.
