292020/28: Sign errors in an inconsistent linear system
29.1Problem
In the beginning of the 1970s, when the predecessor of the Ortvay Competition was established by Géza Tichy and János Major, referred to as Physics Students Problem Solving Competition, there was no internet, and not even simple possibility of using copy machine. To this end, the problems were posted on the announcement dashboard, and those standing in front could take notes in handwriting. (Later technological improvements enabled mimeography of typewriter text and handwritten formulas).
In the autumn of 1970, just few days before the starting of the very first (then not yet called Ortvay) competition there were 36 physicst students (back then, the classes were just that large) crowding in front of the freshly announced problem in the subject of ‘Vector calculus’, starting in that year. The problem to be noted and solved (with Gaussian elimination) was an inhomogeneous system of six linear equations with six unknown variables. The system of equations was special, with all coefficients and all constant terms being integers of one digit, with either positive or negative sign, but zero was not among these. The teacher of the subject wished to simplify the problem to allow more students to compete, therefore the original problem was inconsistent: it could have been easily proven by Gaussian elimination that no solution exists.
However, overcrowded corridors do not favour precise information transfer… while attempting to copy the system of equations, every single student made a mistake, such that each one of them wrongly noted exactly one sign of a coefficient (miraculously, all of a different one). Fortunately the constant terms on the right side of the equations were all copied correctly. As a result, an intentionally simple problem instead led to long and complicated calculations, causing a lot of upset feelings (it would have been more interesting to deal with the competition problems).
The teacher was shocked to see the multiple pages of nasty calculations. He only got a bit relieved when one of the solutions led to the consequence that the equation system is inconsistent (in spite of the fact, as we know, that also this student had one sign incorrect).
Our question is this: what is the probability, that there is one student among the 36, which gets to this conclusion, despite the sign error?
Certainly one can assume, that physics students (though not strong at copying) never make errors during the actual calculation, neither principal, nor numerical. (‘cause physicist’s the BEST, the BEST, the BEST!’ — as The Physicists’ March sounds).
29.2Explanation
The teacher’s system has six equations \(E_1,\dots,E_6\) in six unknowns,
\[ E_i:\quad a_{i1}x_1 + a_{i2}x_2 + \dots + a_{i6}x_6 = b_i, \qquad i = 1,\dots,6, \]where all \(a_{ij}\) and \(b_i\) are integers from \(\{-9,\dots,-1,1,\dots,9\}\), and the system has no solution. Each student changes the sign of one coefficient \(a_{ij}\), and no two students change the same one. There are exactly \(6\times 6 = 36\) coefficients and 36 students, so every coefficient is copied with the wrong sign by exactly one student. Nothing in the copying is therefore left to chance: once the teacher’s system is fixed, the 36 copies are fixed, and each copy either has a solution or does not. We call a copy without a solution an inconsistent copy. The question asks whether at least one of the 36 copies is inconsistent, and the only uncertainty is in the teacher’s system.
What we know about that system is stated in the problem: its numbers are nonzero digits, it has no solution, and the contradiction is easy to find. The Hungarian original is more specific: Gaussian elimination leads to a contradiction “after a few steps”, and the student whose copy was inconsistent also reached the contradiction after a few steps. We read this as follows: the contradiction is obtained from some of the equations before all six have been used, so that a group of at most five equations already has no solution. Under this reading we prove that at least six of the copies are inconsistent, so the probability asked for is 1. We also show that the reading is needed: there are systems with nonzero digits and no solution for which all 36 copies have a solution.
29.3Theory
Combinations of equations. If we multiply each equation \(E_i\) by a number \(u_i\) and add the results, we obtain a new equation, written \(\sum_i u_i E_i\):
\[ \sum_{j=1}^{6}\Bigl(\sum_{i=1}^{6} u_i a_{ij}\Bigr)x_j = \sum_{i=1}^{6} u_i b_i . \]Every solution of the system satisfies every such combination. If for some numbers \(u_i\) all six coefficients \(\sum_i u_i a_{ij}\) on the left are zero but the right side \(\sum_i u_i b_i\) is not, the combination reads \(0 = c\) with \(c \ne 0\), and the system has no solution.
Gaussian elimination. Gaussian elimination repeatedly subtracts a multiple of one equation from another (and swaps equations) until the system has a staircase form, from which the solution is read off from the bottom up. Each step replaces an equation by a combination of the original equations. If the system has no solution, the procedure ends with an equation of the form \(0 = c\), \(c \ne 0\), and this equation is \(\sum_i u_i E_i\) for some numbers \(u_i\). Together with the previous paragraph this gives a complete test: a system has no solution exactly when some combination of its equations reads \(0 = c\) with \(c \ne 0\). We say that equation \(E_i\) is used in such a combination if \(u_i \ne 0\). We write \(k\) for the smallest number of the original equations that by themselves have no solution. A single equation with nonzero coefficients always has solutions, so \(k \ge 2\).
Rank and columns. The rank \(r\) of the coefficient matrix \(A = (a_{ij})\) is the largest number of its rows that are linearly independent, that is, none of them is a combination of the others. The largest number of linearly independent columns is the same number \(r\). We can also read the system by columns: with \(\vv a_j\) the \(j\)-th column of \(A\), it says \(x_1\vv a_1 + \dots + x_6\vv a_6 = \vv b\), so it has a solution exactly when \(\vv b\) is a combination of the columns. The system has a unique solution when \(r = 6\). When \(r = 5\), the combinations of equations with zero left side are all multiples of one of them, which we call \(\vv u = (u_1,\dots,u_6)\), and the solutions \(\vv v\) of \(A\vv v = 0\) are all multiples of one nonzero vector \(\vv v\). The equation \(A\vv v = 0\) says that the columns are linearly dependent, \(v_1\vv a_1 + \dots + v_6\vv a_6 = 0\), and \(v_j = 0\) means that column \(j\) is not used in this dependency. We use one more standard fact, the Kronecker–Capelli theorem: a system has a solution exactly when the matrix \((A\,|\,\vv b)\), which has \(\vv b\) as a seventh column, has the same rank as \(A\). Adding one column raises the rank by at most one, so for a system without a solution the rank of \((A\,|\,\vv b)\) is \(r + 1\).
Determinant and cofactors. A system with a square matrix has a unique solution exactly when the determinant \(\det A\) is not zero. Expanding the determinant along row \(i\) gives \(\det A = \sum_j a_{ij}C_{ij}\), where the cofactor \(C_{ij}\) is \((-1)^{i+j}\) times the determinant of the \(5\times 5\) matrix left after deleting row \(i\) and column \(j\). \(C_{ij}\) does not contain \(a_{ij}\). Changing the sign of \(a_{ij}\) therefore changes the determinant by \(-2a_{ij}C_{ij}\). The teacher’s system has no solution, so \(\det A = 0\), and the copy with the sign of \(a_{ij}\) changed has the determinant
\[ \det A' = -2\,a_{ij}\,C_{ij} . \tag{195}\]Since \(a_{ij} \ne 0\), the copy has a unique solution, found after a long calculation, unless the cofactor \(C_{ij}\) is zero. For digits without special structure the cofactors are usually not zero, which is why most students calculated for pages.
29.4Solutions
29.4.1Combinations of equations
An error in an unused equation. Let \(\sum_m u_m E_m\) be a combination that reads \(0 = c\) with \(c \ne 0\), and let equation \(E_i\) be unused, \(u_i = 0\). A student whose sign error is in \(E_i\) has copied all the other equations correctly. The same combination of the copied equations does not contain the wrong equation, so it is the same equation \(0 = c\), and the copy has no solution. The student finds this with the same few elimination steps that the teacher intended, which agrees with the story. Each equation has six coefficients, so each unused equation gives six inconsistent copies.
The answer. Take a smallest group of \(k\) equations that has no solution, and the combination of these equations that reads \(0 = c\). In this combination the other \(6 - k\) equations are unused. If elimination reaches the contradiction before all six equations are used, then \(k \le 5\), and at least
\[ 6\,(6 - k) \ge 6 \]of the 36 copies are inconsistent. The probability that a student among the 36 finds no solution is therefore 1, whatever the digits are. The simplest systems of this kind have \(k = 2\): two equations with opposite left sides and right sides that are not opposite. The sum of the two equations reads \(0 = c\), and the 24 students whose errors are in the other four equations find the contradiction. Such a system, generated at random with the script, is drawn in Figure 57(a); the sum of its first two equations reads \(0 = -6\).
Errors in used equations. A copy with the error in a used equation can also be inconsistent. In Figure 57(b) the first three equations are used, and the copies with an error in their first column are inconsistent as well.
Smallest inconsistent groups. For any system without a solution, \(k \le r + 1\), where \(r\) is the rank of \(A\). Indeed, the matrix \((A\,|\,\vv b)\) has rank \(r + 1\), so we can choose \(r + 1\) equations whose rows in \((A\,|\,\vv b)\) are linearly independent. In these equations the rows of \(A\) alone have rank at most \(r\), so by the Kronecker–Capelli theorem these \(r + 1\) equations have no solution. It follows that \(k = 6\) is possible only for \(r = 5\), the largest rank of a matrix with zero determinant. Then every combination with zero left side is a multiple of \(\vv u\), and no \(u_i\) is zero, since otherwise the five equations other than \(E_i\) would have no solution.
Copies when all six equations are used. Let \(k = 6\) and suppose that the copy with the sign of \(a_{ij}\) changed has no solution. We write \(A'\) for the copied coefficient matrix. Its determinant is zero, so there is a nonzero vector \(\vv x\) with \(A'\vv x = 0\). The matrix \(A'\) differs from \(A\) only by \(-2a_{ij}\) in row \(i\), column \(j\), so
\[ A\vv x = 2a_{ij}x_j\,\vv e_i , \]where \(\vv e_i\) has 1 in position \(i\) and zeros elsewhere. We take the combination \(\vv u\) of the six rows of this equation. On the left, \(\sum_m u_m (A\vv x)_m = \sum_j \bigl(\sum_m u_m a_{mj}\bigr)x_j = 0\), because the combination \(\vv u\) has zero left side. On the right we get \(2a_{ij}x_j u_i\). Since \(a_{ij} \ne 0\) and \(u_i \ne 0\), this forces \(x_j = 0\). Then \(A\vv x = 0\), so \(\vv x\) is a nonzero multiple of \(\vv v\), and \(v_j = 0\). When all six equations are used, a copy can be inconsistent only if the column of its error is not used in the dependency of the columns. By (195) the copy has zero determinant exactly when \(C_{ij} = 0\), so for \(k = 6\) a cofactor can vanish only in a column with \(v_j = 0\).
Conversely, if \(v_j = 0\), then \(A'\vv v = A\vv v = 0\), so the determinant of \(A'\) is zero. The five columns other than column \(j\) then span a space of dimension 4, and the copy has a solution only if its changed column \(j\) is a combination of these columns and \(\vv b\). This is one linear condition on the digits, and in the random systems described below it never held. So in practice either all six copies with an error in column \(j\) are inconsistent, or none is.
A system with no inconsistent copy. The system with the matrix \((A\,|\,\vv b)\)
\[ \left(\begin{array}{rrrrrr|r} -4 & 9 & 7 & -1 & -7 & 7 & -3\\ -8 & -5 & 5 & -7 & 5 & 1 & 8\\ 8 & 5 & -9 & -7 & -5 & -6 & 8\\ 4 & -1 & -6 & 5 & 6 & -1 & 8\\ -7 & 6 & 3 & -6 & -8 & 7 & 5\\ 7 & 2 & -6 & -4 & 7 & -6 & -8 \end{array}\right) \]satisfies all conditions of the problem except the easy contradiction. The left side of \(E_6\) is that of \(E_1 + E_2 + E_3 + E_4 - E_5\), while the right sides give \(-3 + 8 + 8 + 8 - 5 = 16 \ne -8\), so the combination \(E_1 + E_2 + E_3 + E_4 - E_5 - E_6\) reads \(0 = 24\). The rank of \(A\) is 5, and no group of fewer than six equations is without a solution, so \(k = 6\). The columns satisfy \(A\vv v = 0\) with
\[ \vv v = (7908,\ -4595,\ 1778,\ -3393,\ -86,\ 8078), \]which has no zero entry. By the result above, none of the 36 copies is inconsistent; indeed all 36 cofactors are nonzero, and every student finds a unique solution. Gaussian elimination reaches the contradiction in this system only after all six equations have been combined, which is not the easy problem of the story. The answer 1 therefore depends on the condition that the contradiction appears after a few steps.
29.4.2Exact check on random systems
With the script we draw random systems with a contradiction among \(k\) equations, for \(k = 2,\dots,6\). The left side of equation \(k\) is \(\pm E_1 \pm \dots \pm E_{k-1}\) with random signs, drawn again until all its coefficients are nonzero digits; its right side is a random nonzero digit different from the same combination of \(b_1,\dots,b_{k-1}\). All other coefficients and right sides are independent random nonzero digits. For each system we find \(k\) by testing all groups of equations, form the 36 copies, and decide for each copy whether it has a solution, by comparing the ranks of \(A'\) and \((A'\,|\,\vv b)\) in exact rational arithmetic. The results are listed in Table 23.
| \(k\) | systems | inconsistent copies per system | systems with an inconsistent copy |
|---|---|---|---|
| 2 | 200 | 24 | 200 |
| 3 | 200 | 18 | 200 |
| 4 | 200 | 12 | 200 |
| 5 | 200 | 6 | 200 |
| 6 | 1000 | 0 (999 systems), 6 (1 system) | 1 |
For \(k \le 5\) every system has the \(6(6-k)\) inconsistent copies predicted above, and in all of them the copies with an error in an unused equation are inconsistent. For \(k = 6\) only 1 of the 1000 systems has inconsistent copies: in that system one column is not used in the dependency of the columns, and the six copies with an error in that column are inconsistent. In all 1800 systems, which all have rank 5, the inconsistent copies are exactly those with an error in an unused equation (\(u_i = 0\)) or in an unused column (\(v_j = 0\)). The system of Figure 57(b) was found by searching among random systems with \(k = 3\) for one with an unused column. We also checked (195) on 20 random matrices.