How to prove that every Lie group is the semidirect product of a connected Lie group and a discrete group?

Every Lie group is the direct product of a connected Lie group and a discrete group.

I think the component of the identity could be useful.

-
What did you try? –  Bruno Joyal Feb 27 '13 at 23:30
Show the connected component you described is a normal subgroup first. –  Thomas Andrews Feb 27 '13 at 23:35
Someone edited my question. I want to show that every Lie group is the semidirect product of a connected Lie Group and a discrete group –  Gsanm Feb 28 '13 at 1:16
Please edit your question appropriately. There was no version which said something about a semi-direct product. –  Martin Brandenburg Feb 28 '13 at 5:06

For every topological group $G$ with identity component $G^0$ it is well-known and easy to prove that $G^0$ is a normal, in fact characteristic, closed subgroup. If $G$ is locally connected, $G^0$ is open, which implies that the quotient group $G/G^0$ is discrete. The Lie algebra of $G$ is isomorphic to the Lie algebra of $G/G^0 \times G^0$, hence these Lie groups are locally isomorphic. It is not hard to see that the isomorphisms glue to a global isomorphism, since the decomposition into a product of a connected and a discrete Lie group is essentially unique.
What about, for example, $O(2n+1)$? As a manifold, it's diffeomorphic to $SO(2n+1) \times \mathbb{Z}/2$, but not as a group (since $O(2n+1)$ has trivial center but $SO(2n+1)\times \mathbb{Z}/2$ doesn't). Or am I missing something stupid? –  Jason DeVito Feb 28 '13 at 0:13
Why does $O(2n+1)$ has trivial center? If your counterexample is correct, you should add it as an answer (or "anti-answer" ;)). –  Martin Brandenburg Feb 28 '13 at 1:04
Ha! I got it backwards. $-I \in O(2n+1)$, and in fact $O(2n+1)\cong SO(2n+1)\times\mathbb{Z}/2$ (as Lie groups). On the other hand, $O(2n)$ is not Lie isomorphic to $SO(2n)\times\mathbb{Z}/2$. For example, when $n=1$, $SO(2)\times\mathbb{Z}/2$ is abelian, but generally reflections and rotations don't commute. (I'm not going to add this as an aswer because the OP has now added a correction asking for a semi-direct product instead of direct product. I'm not sure how to prove it.) –  Jason DeVito Feb 28 '13 at 3:25