TITLE: Why is the set of matrices with determinant zero not a subspace?
QUESTION [8 upvotes]: I'm reading my linear algebra textbook, and it says word for word: The following set is not a subspace: 

the set of all $2\times 2$ matrices $B$ such that $\det(B)=0$. 

I just need help trying to understand what that means.

REPLY [17 votes]: Let $\mathcal M_n$ be the vector space of $n\times n$ matrices and let
$$
S_n=\{A\in \mathcal M_n:\det A=0\}
$$
Then $S_n$ is not a subspace of $\mathcal M_n$. Indeed, let
\begin{align*}
A&=
\begin{bmatrix}
1 & 0 & \cdots & 0 \\
0 & 0 & \cdots & 0 \\
\vdots & \vdots & \ddots & \vdots \\
0 & \cdots & 0 & 0
\end{bmatrix}
&
B &=
\begin{bmatrix}
0 & 0 & \cdots & 0 \\
0 & 1 & \cdots & 0 \\
\vdots & \vdots & \ddots & \vdots \\
0 & \cdots & 0 & 1
\end{bmatrix}
\end{align*}
Then $A,B\in S$ but $\det(A+B)=1$ so $A+B\notin S_n$.
In particular, when $n=2$, the subset $S_2$ is not a subspace of $\mathcal M_2$ because
\begin{align*}
A&=\begin{bmatrix}1&0\\0&0\end{bmatrix} & B &= \begin{bmatrix}0&0\\0&1\end{bmatrix}
\end{align*}
are elements of $S_2$ but $\det(A+B)=1$ so $A+B\notin S_2$.
Extra Credit. Is the subset 
$$
\mathfrak{sl}_n=\{A\in\mathcal M_n:\DeclareMathOperator{trace}{trace}\trace A=0\}
$$
of $\mathcal M_n$ a subspace of $\mathcal M_n$?