12

Due to the complains for more clarity down below I've cut my post into segments. Feel free to skip right to Definitions, Algorithm & Conjecture. If this is not clear enough, then I'm afraid I can't help it.

Story

I'm taking a course on linear algebra and recently we were covering congruence of matrices. By Sylvester's law of inertia any two real symmetric matrices are congruent if they have the same signatures. We were advised to calculate signatures by considering matrices as bilinear forms and finding their orthogonal bases, which from my point of view is extremely tedious and requires painstaking work, both with regard to memorization and computation. So I was looking out for a better way to do this and by Googling I discovered that simultaneous row and column transformations preserve the signature, which turns out to be quite simple to understand once you consider elementary operations as matrices: $$ \boldsymbol{A'} = \boldsymbol{EAE}^T $$ That is way easier! However, as an extremely lazy person I still wasn't satisfied and here's where the fun part begins:

I began looking at the elementary operations and how they affect the outcome. Multiplying a row by a negative constant might trivially change the signature (just consider identity matrix). After a while I found an example of how interchanging rows might also affect it. And adding a row multiplied by $-2$ to itself is equivalent to multiplying it by a negative scalar. Thus I was left with adding to the row a different row multiplied by a constant and I couldn't find a counterexample for this one. More than that! Using only this operation I got through my previous assignment and by turning a matrix into a row echelon form I was able to get a correct signature in every exercise. It also helped me spot a mistake in my simultaneous row and column operations on the recent test. By this method I calculated 11 correct signatures - it would be very odd if this was just an accident!

I know that chances of me discovering something new in math are infinitesimal but I couldn't resist the clickbaity title. I hope you'll forgive me. But I'm genuinely curious about this one. I tried talking with my professor about it but he seemed uninterested, or maybe I did a poor job explaining it. He just dismissed the entire problem by saying that reduction to a row echelon form does not preserve the signature.

Did I stumble upon some already known algorithm? Why then would no one talk about it at uni? I tried thinking about how to prove this but nothing comes to mind. Perhaps I miss some obvious counterexamples? If so, why did it work in all of the previous exercises?

Definitions

We use this definition of congruence and this definition of signature.

Congruence:We say that two squrare matrices A and B over some field are congruent if there exists an invertible matrix P such that: $$\boldsymbol{A} = \boldsymbol{P}^T \boldsymbol{B P}$$

Signature: A real, nondegenerate $n\times n$ symmetric matrix A, and its corresponding symmetric bilinear form $\boldsymbol{G}(v,u) = v^T \boldsymbol{A} u$, has signature $\boldsymbol{(p,q)}$ (or $\boldsymbol{p-q}$ in a different notation) if there is a nondegenerate matrix C such that $ \boldsymbol{CAC}^T $ is a diagonal matrix with p 1s and q (-1)s.

Algorithm

  1. Using only this operation - adding a row multiplied by a constant to another row - get a matrix to its upper-triangular form.
  2. Let $p$ be a number of positive entries on the diagonal and $q$ be a number of negative ones. Signature of a matrix is equal to $(p,q)$.

Conjecture

The aforementioned Algorithm provides a correct signature for all nondegenerate symmetric square matrices.

Further questions

Why would that be? How to prove it? Any ideas for counterexamples? Does it hold for $3 \times 3$ matrices and below but fails for bigger matrices, as suggested by Ben Grossmann in the comments? Any counterexamples of this sort? In this case - why would it work for n = 3?

Examples

$$ \boldsymbol{A}= \begin{bmatrix} 8 & 8 & 5\\ 8 & 0 & 4\\ 5 & 4 & 3 \end{bmatrix} \overset{r_2 \to r_2-r_1}{\longrightarrow} \begin{bmatrix} 8 & 8 & 5\\ 0 & -8 & -1\\ 5 & 4 & 3 \end{bmatrix} \overset{r_3 \to r_3-\frac{5}{8}r_1}{\longrightarrow} \begin{bmatrix} 8 & 8 & 5\\ 0 & -8 & -1\\ 0 & -1 & -\frac{1}{8} \end{bmatrix} \overset{r_3 \to r_3-\frac{1}{8}r_2}{\longrightarrow} \begin{bmatrix} 8 & 8 & 5\\ 0 & -8 & -1\\ 0 & 0 & 0 \end{bmatrix} $$

And we already see that the signature is (1,1).

Let $x \in \mathbb{R}$ For which values of $x$ the signature of B equals $2$?

$$ \boldsymbol{B} = \begin{bmatrix} 1 & 0 & 1\\ 0 & 2 & 3\\ 1 & 3 & x \end{bmatrix} \overset{r_3 \to r_3-r_1}{\longrightarrow} \begin{bmatrix} 1 & 0 & 1\\ 0 & 2 & 3\\ 0 & 3 & x-1 \end{bmatrix} \overset{r_3 \to r_3-\frac{3}{2}r_2}{\longrightarrow} \begin{bmatrix} 1 & 0 & 1\\ 0 & 2 & 3\\ 0 & 0 & x-\frac{11}{2} \end{bmatrix} $$

And the answer is for $x = \frac{11}{2}$ : $(2,0) = 2$.

Let $t,s \in \mathbb{R} $

$$ \boldsymbol{C}= \begin{bmatrix} 0 & 0 & 0 & 0 & t^2\\ 0 & -1 & 0 & 1 & 0\\ 0 & 0 & 1 & s & 0\\ 0 & 1 & s & s^2-1 & 0\\ t^2 & 0 & 0 & 0 & 0\\ \end{bmatrix} \underset{r_5 \to r_5-r_1}{\overset{r_1 \to r_1+r_5}{\longrightarrow}} \begin{bmatrix} t^2 & 0 & 0 & 0 & t^2\\ 0 & -1 & 0 & 1 & 0\\ 0 & 0 & 1 & s & 0\\ 0 & 1 & s & s^2-1 & 0\\ 0 & 0 & 0 & 0 & -t^2\\ \end{bmatrix} \underset{r_4 \to r_4-sr_3}{\overset{r_4 \to r_4+r_2}{\longrightarrow}} \begin{bmatrix} t^2 & 0 & 0 & 0 & t^2\\ 0 & -1 & 0 & 1 & 0\\ 0 & 0 & 1 & s & 0\\ 0 & 0 & 0 & 0 & 0\\ 0 & 0 & 0 & 0 & -t^2\\ \end{bmatrix} $$

Singature is (2,2) for $t\not= 0$ and (1,1) for $t = 0$. I achieved the same result with simultaneous row and column operations, it took twice as long.

Figment
  • 257
  • by "signature" do you mean the number of positive and negative eigenvalues? – Atticus Stonestrom Apr 18 '21 at 00:00
  • 2
    If I'm not mistaken, it looks like you're using elementary row/column operations to diagonalize a matrix $A$. This falls into a class of problems known as "eigenproblems", and there are hundreds of different algorithms for solving them, including many algorithms based on elementary row/column operations. If you're not familiar with them, you may want to look into singular value decompositions (SVDs), Schur decompositions, and QZ/QR decompositions. These aren't really designed for computation by hand, but the sites describing them often have useful tricks for by-hand calculations. Good luck! – COTO Apr 18 '21 at 00:03
  • 1
    The "signature" of a matrix only applies to symmetric matrices. It's not clear what you mean by the "signature", then, if you allow operations like switching rows or multiplying rows by constants. For instance, $$ \pmatrix{1&2\2&3} \to \pmatrix{2&3\1&2},\ \pmatrix{1&2\2&3} \to \pmatrix{-1&-2\2 & 3}. $$ In both cases, the resulting matrix is not symmetric, so it doesn't make sense to talk about its "signature". – Ben Grossmann Apr 18 '21 at 10:17
  • I've just added definitions and a couple of examples for clarity. – Figment Apr 18 '21 at 10:29
  • @BenGrossmann I explicitly stated that we do not allow interchanging rows or multiplying by a negative constant. – Figment Apr 18 '21 at 10:32
  • @Figment No, you said that these operations "might affect the signature". Thank you for clarifying what you meant – Ben Grossmann Apr 18 '21 at 10:35
  • @AtticusStonestrom Thanks for your comment! I've just added a definiton of singature that we're using. It's somewhat convoluted but it seems to me that the two are equivalent. I also added 3 examples. The example you gave is a nice try but:
    1. I would argue that it falls under "subtracting a row from itself" case, just in a smarter way, as there are two rows but they're identical.
    2. This is a degenerate matrix and as such does not have a signature according to the definition I just added.
    – Figment Apr 18 '21 at 10:43
  • 1
    @Figment Consider the second matrix in your first example: $$ M = \pmatrix{8 & 8 & 5\ 0 & -8 & -1\ 5 & 4 & 3}. $$ This matrix is not symmetric, so there can be no invertible matrix $P$ such that $P^TMP$ is symmetric, and certainly no $P$ such that $P^TMP$ is a diagonal matrix of $0$'s and $\pm 1$'s. As such, it doesn't make sense to say that this matrix has a "signature" by your definition. With that said, you'll have to clarify what exactly you mean by "signature" in this case. – Ben Grossmann Apr 18 '21 at 10:50
  • @Figment Interestingly, this matrix does have real eigenvalues, of which one is positive, one is negative, and one is zero, which matches the signature we're looking for. – Ben Grossmann Apr 18 '21 at 10:51
  • @BenGrossmann Yes, Ben. This is exactly what I noticed and my conjecture is that this matching is preserved for all nondegenerate symmetric matrices. And my questions are: Is this a known fact? Some algorithm that I'm not aware of? How could I prove it? – Figment Apr 18 '21 at 11:21
  • @Figment You should make your conjecture explicit in your post. I suspect that your observation in these cases can be explained by tracing through the steps of the corresponding simultaneous row and column transformations. I also suspect that your conjecture holds for $3 \times 3$ matrices (and smaller) but fails more generally – Ben Grossmann Apr 18 '21 at 11:28

1 Answers1

5

Very nice question and observation! The fact that your method works for the examples provided is not a coincidence and is indeed quite general.

First, let me give you an example which shows that your conjecture cannot hold as stated. Consider the following sequence of operations:

$$ \underbrace{\begin{bmatrix} -1 & 0 \\ 0 & -1 \end{bmatrix}}_{A_1} \xrightarrow{R_1 = R_1 - R_2} \underbrace{\begin{bmatrix} -1 & 1 \\ 0 & -1 \end{bmatrix}}_{A_2} \xrightarrow{R_2 = R_2 + 2R_1} \underbrace{\begin{bmatrix} -1 & 1 \\ -2 & 1 \end{bmatrix}}_{A_3} \xrightarrow{R_1 = R_1 - R_2} \underbrace{\begin{bmatrix} 1 & 0 \\ -2 & 1 \end{bmatrix}}_{A_4} \xrightarrow{R_2 = R_2 + 2R_1} \underbrace{\begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}}_{A_5}. $$

The matrix $A_1$ is symmetric with signature $(0,2)$. The matrix $A_2$ is not symmetric nor diagonalizable but still has $-1$ as a double root of the characteristic polynomial so you might say it still has the "correct signature". The matrix $A_3$ however has eigenvalues $\pm i$. The matrix $A_4$ is not diagonalisable but now has $1$ as a double root of the characteristic polynomial. Finally, the matrix $A_5$ is symmetric with signature $(2,0)$.

You might object and say that this sequence of operations is "silly" but this means that if you start with an arbitrary symmetric matrix, perform arbitrary row addition operations until you get some upper triangular matrix, the signature can't always be read from the diagonal entries.

So why did you get the correct answers? Let's consider first what happened in your first and second example and try to formalize it. You started with a symmetric matrix $A$ and using only the operation of adding a multiple of a row to another row brought $A$ into an upper triangular matrix $U$. More precisely, you did not use a completely arbitrary sequence of row operations but did them in the "standard way" which usually appears in Gaussian elimination. For the $3 \times 3$ examples, you have first used $R_2 = R_2 + cR_1, R_3 = R_3 + c'R_1$ to eliminate all the elements below the diagonal in the first column. Then you used $R_3 = R_3 + c''R_2$ to eliminate all the elements below the diagonal in the second column. Each row operation corresponds to a multiplication of $A$ by an elementary matrix $P$. So you have made a sequence of operations

$$ A \rightarrow P_1 A \rightarrow P_2 P_1 A \rightarrow \dots \rightarrow \underbrace{ \left( P_k \cdots P_1 \right)}_{L} A=U. $$

Since you performed your operations in the "standard way", the matrix $L$ which encodes all the operations is lower triangular with $1$'s on the diagonal. Let's multiply the equation $LA = U$ by $L^T$ on the right to get $LAL^T = UL^T$. Now here comes the magic. Both $U$ and $L^T$ are upper triangular where $L^T$ has $1$'s on the diagonal. But the equation $LAL^T = UL^T$ shows that $UL^T$ is also symmetric and so it must be diagonal! Hence $A$ is congruent to a diagonal matrix whose entries are the diagonal entries on $U$.

This explains why you got the correct answer in the first two examples. Note that it doesn't matter if $A$ is nondegenerate or not (both your examples are degenerate/possibly degenerate). However, this is not a general algorithm because if $a_{11} = 0$ you obviously can't use it to cancel all the entries below. In Gaussian Elimination, you can pivot by using row swap to make this element non-zero. However, this might change the signature of the matrix. In your case you can use a simultaneous row-column operation to make $a_{11}$ non-zero and then proceed with your algorithm but then it might be the case that $a_{22}$ is zero and then you are "stuck" because you only performed "half the operations" so there is no reason that the "signature" will be preserved.

The third example is more interesting because this is precisely the case where you need pivoting. If you keep track of the elementary operations you used, you will see that $P_k \cdots P_1$ is not lower triangular anymore (even though it is "almost" lower triangular) so my argument fails but you still got the correct answer. I'm not sure if it is coincidental or not and will try to analyze it more carefully when I have the time.

levap
  • 67,610
  • 1
    +1. I woke up with exactly the same counterexample. Indeed it seems to me that if we start with a non-singular $A$ then pre-multiplying by transvections we can reduce it to the diagonal $\text{Diag}(\det A, 1,1,\dots,1)$. As stated the question seems to me to be about the orbits of $SL(n,\mathbb{R})$ on $M_{n\times n}(\mathbb{R})$ (at least the orbits containing a symmetric matrix), and what I've said is a partial answer. If we only look at the lower unitriangular group I haven't a clue. – ancient mathematician Apr 20 '21 at 08:05
  • @ancientmathematician: Thanks! It was actually non-trivial for me to find this example. I also thought about it in terms of orbits and then remembered that the row addition operations generate $\operatorname{SL}(n,\mathbb{R})$. This means that if start with a matrix $A$ with $\det(A) > 0$ then by pre-multiplying it with transvections we can reduce it to a diagonal matrix with positive entries on the diagonal, hence the counterexample. – levap Apr 20 '21 at 08:24
  • Thank you! That's exactly what I was looking for! I do not object as I realised 2 days ago that my initial conjecture was false - consider: $$ \begin{bmatrix} 2&1\ 1&2 \end{bmatrix} \overset{r_1\to r_1-3 r_2}{\longrightarrow} \begin{bmatrix} -1&-5\ 1&2 \end{bmatrix} \overset{r_2 \to r_2 + r_1}{\longrightarrow} \begin{bmatrix} -1&-5\ 0&-3 \end{bmatrix}$$ Since then I was trying to fix the algorithm but precision is not my strongest side and I didn't have much free time to think about it either. I just had an intuition and a strong feeling that there is something to it. – Figment Apr 20 '21 at 17:19
  • The problem of $0$s on the diagonal can be fixed "artificially" by adding $j$-th row with a non-zero entry to the current row and doing the same operation for columns: $\boldsymbol{A'} = \boldsymbol{EAE}^T$, and then proceeding with "regular" elimination (A is symmetric so it always works). $$ $$ But I think in such cases the algorithm can be reajusted as in my 3rd example:
    1. If $a_{j,j}=0$ - take the first row with non-zero entry in $j$th column and add it to $j$th row. [If all entires in the column are $0$s - skip this step]
    2. Proceed with the regular algorithm.
    – Figment Apr 20 '21 at 17:38