Using Cartan decomposition to prove $SO(p,q)$ has two connected components

I think what went wrong is that for $SO(p,q)$ you cannot identify $K$ with $SO(p)\times SO(q)$, but with $S(O(p)\times O(q))=\{(A,B)\in O(p)\times O(q):\det(A)\det(B)=1\}$, which has two connected components. This is exactly the general version of the fact observed in the answer of @JohnHughes for $p=q=1$.


Did you work out your claims in detail for $p = q = 1$?

In that case, the elements of $G$ are of the form $$ \begin{bmatrix} k\cosh t & \sinh t \\ k\sinh t & \cosh t \end{bmatrix} $$ where $k = \pm 1$, but $K$ contains both the identity and matrix and $\begin{bmatrix} -1 & 0 \\ 0 & 1 \end{bmatrix} $ , so $K$ is not the same as $SO(1) \times SO(1)$, which contains only the identity.

(I might be messing something up here -- this is way outside my domain -- but I'm guessing that you forgot the possibility of orientation-reversing items within $K$. )