For each $A\in O(p,q)$, we may write
$$A=\begin{bmatrix}A_{11} &A_{12}\\A_{21}&A_{22}\end{bmatrix}.$$
Then it is said that $\det(A_{11})\neq 0$ and $\det(A_{22})\neq 0$.
Furthermore, the map $$O(p,q)\rightarrow{\{-1,1}\}^2,\quad A\mapsto(\operatorname{sgn}(\det(A_{11})), \operatorname{sgn}(\det(A_{22})))$$ is a surjective homomorphism.
I see that one can prove that this map is a surjective homomorphism by exploiting continuity and the topology of $O(p,q)$.
However, I am looking for a proof in which one uses matrix algebra and the determinant function.
Thank you.
A matrix $M$ lies in $O(p,q)$ if, by definition, $M^t D M=D$, where $D=\pmatrix{ I_p & 0 \cr 0 & -I_q}.$
Assume further that $M$ is block diagonal, so $A_{12}=A_{21}=0$.Then $M$ lies in $O(p,q)$ if and only if $A_{11}^tA_{11}=I_p$ and $A_{22}^tA_{22}=I_q$, that is $A_{11}\in O(p)$ and $A_{22}\in O(q)$.
But it is known (and very easy anyway) to find matrices in $O(n)$ with determinant $1$ and $-1$ for any $n\geq 1$, so you get the desired surjectivity.