Solution (source code)

= Solution

The zero <matrix> has the required pattern, and <matrix addition> and <scalar multiplication> preserve every prescribed zero entry. This proves the <vector subspace> condition. A <basis> consists of the <matrix units>
$$
\{E_{ii}:1\le i\le n\}\ \cup\ \{E_{i,i+1},E_{i+1,i}:1\le i<n\}.
$$
They independently select every permitted entry of a <tridiagonal matrix>, so \b[the <dimension> is $n+2(n-1)=3n-2$] for $n\ge1$.