Finding the dimension of a given vector space

All entries except the lower and upper right can be chosen freely, and no matter what you chose them to be, there exists exactly one value for each of those two spots which gives you a matrix on the form you want. This gives $n^2 - 2$.

Roughly speaking, when you have a vector space over $\mathbb R$, $\mathbb C$, or other fields, each equation relating the coordinates will lower the total dimension by one. In this case you have two equations relating coordinates in a vector space of dimension $n^2$ (forgetting for a moment that it is a matrix, and just look at it as an $n^2$-dimensional vector).


Assuming $n\geq2$, you have $n^2$ variables (the entries) and 2 linear equations, which are independent. Hence you have $n^2-2$ free variables. Your space is the space of solutions to those equations, so the dimension of this space will be $n^2-2$