Prove that the group $\langle U\rangle\leq G$ is open and closed in $G \subset GL_n\mathbb R$. Let $G  \subset GL_n\mathbb{R}$ be a closed subgroup and $U \subset G$
open with respect to the subspace topology. Prove that the group $\langle U \rangle$
generated by $U$, i.e. the smallest subgroup of $G$ containing $U$, is open
and closed in $G$.
 A: If $U=\emptyset$, then $\langle U\rangle=\{e\}$ need not be open in $G$. So assume $U$ is a non-empty open subset of $G$.
Step 1: $\langle U\rangle $ is open in $G$. As is well-known, $\langle U\rangle $ is the intersection of all subgroups of $G$ containing $U$. But it is also given by
$$
\langle U\rangle =\{g_1\cdots g_n\,;\, n\geq 1, g_j\in S=U\cup U^{-1}\}=\bigcup_{n\geq 1}\bigcup_{g\in S^{n-1}}gS
$$
where $S^0=\{e\}$. Since $U^{-1}$ is homeomorphic to $U$ under $g\longmapsto g^{-1}$, it is open, whence $S$ is open. Thus $gS$ is open for every $g$ since it is homeomorphic to $S$ under $h\longmapsto gh$ whose inverse is $h\longmapsto g^{-1}h$. Therefore $\langle U\rangle$ is open as union of open sets.
Step 2: in general, every open subgroup $H$ of a topological group $G$ is also closed. Indeed, take $\{g_i\,;\, i\in I\}$ a system of representatives for all the nontrivial left cosets $gH$ of $G/H$. Then the complement of $H$ in $G$
$$
G\setminus H=\bigcup_{i\in I}g_iH
$$
is open since every $g_iH$ is homeomorphic to $H$, whence open. So $H$ is closed.
Note: any subgroup $G$ of the topological group $GL_n(\mathbb{R})$ is a topological group with respect to the induced topology. So it suffices to assume $U$ is open in $G$ with respect to that topology for the above argument to work. We do not need to assume that $G$ be closed. But if we do, it follows that moreover $\langle U\rangle$ is closed in $GL_n(\mathbb{R})$.
Note: if $G$ is connected, it follows that $\langle U\rangle =G$ for every non-empty open subset $U$ of $G$.
