# Number of connected components of the set of invertible matrices over the reals when some of the matrix entries are fixed

Let $$\mathcal{M} = \text{GL}(n, \mathbb{R})$$ denote the set of $$n \times n$$ invertible matrices over $$\mathbb{R}$$. We know that $$\text{GL}(n, \mathbb{R})$$ has exactly 2 connected components. I have recently been faced with the question of how many connected components are there when some of the entries of the invertible matrix are predetermined (assume that the entries that are fixed are such that there is at least 1 invertible matrix of this form). Does anybody know if the answer to this problem is known in general?

For example, suppose we are dealing with invertible matrices which are block diagonal with $$k$$ blocks. Then the set of invertible matrices whose entries are fixed to be zero, except at these $$k$$ diagonal blocks, is $$2^k$$.

I think in the complex setting ($$\mathbb{R}$$ replaced by $$\mathbb{C}$$) there is only 1 connected component because of an abstract theorem about analytic functions, which says that the zero set of a non-constant analytic function defined on a connected open subset $$\mathcal{U}$$ of $$\mathbb{C}^m$$ does not disconnect $$\mathcal{U}$$.

EDIT: If it helps at all or makes things simpler, I'm interested in the particular case when the entries of the matrix that are fixed form a block submatrix, and moreover this fixed block is zero.

Neat question! $$2^n$$ (for diagonal matrices) is indeed an upper bound, but the answer might not be a power of 2.
To see the upper bound: start by throwing out, WLOG, any entries from your set that don't change the determinant. Now changing a single entry affects the determinant as some linear and generically non-constant function. Also, if you change two coordinates in the same row or column, the determinant will change by a linear function which is not constant in either variable. This means that you can fix one of the two entries to be some generic constant without decreasing the number of connected components (check this!). Thus you reduce to finding an upper bound when your set of entries has no two entries in the same row or column, so there are at most $$n$$ of them. Finally you can use linearity in each variable again to inductively see that you cannot have more connected components than two to the number of entries.
To see that the number is not necessarily a power of two, look at $$2\times 2$$ matrices with ones on the diagonal. Degenerate matrices with this property form a hyperbola in the plane, and the complement has 3 components. In general you will end up asking about the number of connected components in the complement to a general equation in $$k$$ variables which is at most linear in each component. I suspect classifying all the possibilities is open and quite hopeless (this type of question in real algebraic geometry often is), though someone else may be able to say more.