How is the group $O(p,q)$ defined wrt quadratic forms? Given a symmetric matrix $Q$ defining a quadratic form with signature $(p,q)$, the group of matrices $X$ which preserve $Q$, i.e.
$$
Q(Xu, Xv) = Q(u,v),
$$
is denoted $O(p,q)$.
So, I understand that, for instance, for a non-degenerate indefinite binary quadratic form $Q$, the group of matrices preserving the form is $O(1,1)$, and this is a group of dimension $1$.
However, I am confused because surely the group of matrices preserving a quadratic form depends on the quadratic form? For instance the matrices preserving 
$$
A = \begin{pmatrix}
  1 & 1 \\
  1 & -1 \\
\end{pmatrix} \quad \quad \text{and} \quad \quad B = \begin{pmatrix}
  1 & 1 \\
  1 & -2 \\
\end{pmatrix}
$$
are going to be different - in this case
$\begin{pmatrix}
  1 & 2 \\
  2 & 5 \\
\end{pmatrix}$
preserves $A$ but not $B$.
With this in mind, how is $O(p,q)$ defined? I can find no explanation suggesting $O(p,q)$ depends on the choice of $Q$, but if it is the same group regardless of the choice of $Q$, then what differentiates, say, $O(1,1)$ from $GL_2(\mathbb{N})$?
 A: If $A \in \operatorname{GL}_n(\mathbb{R})$ is a matrix representing a bilinear form, then the group of transformations preserving this form is $\mathscr{O}(A) = \{ X \in \operatorname{GL}_n(\mathbb{R}): X^t A X = A\}$.
Now let $A, B \in \operatorname{GL}_n(\mathbb{R})$ be two matrices representing a quadratic form with signature $(p,q)$ (where $p+q = n$). Then Sylvester's law of inertia tells you that $A = P^tBP$ for some $P \in \operatorname{GL}_n(\mathbb{R})$. 
I leave it an exercise for you to show that $\mathscr{O}(A) = P^{-1} \mathscr{O}(B) P$.
That is, the groups $O(p,q)$ you get with different forms are usually not the same, but they will be conjugate in $\operatorname{GL}_n(\mathbb{R})$.
A: $O(p,q)$ depends of the choice of the signature of the quadratic form $Q(x)=\sum_{i=1}^{i=p}x_i^2-\sum_{i=p+1}^{i=n}x_i^2$ with $p+q=n$. Here the signature is $(p,q)$. You can always find a basis where the quadratic form has that expression. Two quadratic forms with the same signature yields to the same automorphisms group.
A: Suppose we write $D_{pq}$ as the $n$ by $n$ diagonal matrix, with $n = p+q,$ with the first $p$ diagonal elements equal to $+1,$ then $q$ diagonal elements $-1.$
Theorem. Over the REAL NUMBERS, any symmetric matrix $A$ with $p$ positive eigenvalues and $q$ negative eigenvalues can be written as
$$ A = P^T D_{pq} P $$
where $\det P \neq 0.$ Taking $Q = P^{-1},$ we could also write
$$ Q^T A Q =  D_{pq} . $$
This relationship is called congruence. It is the correct way to modify quadratic forms. The theorem is Sylvester's Law of Inertia.
IF  $$ R^T AR = A, $$ then
$$  (P R Q)^T D_{pq} (P R Q) =  D_{pq} . $$
IF  $$ S^T  D_{pq} S =  D_{pq}, $$ then
$$  (QSP)^T A (QSP) =  A . $$
