For an matrix over the real numbers, write its rows as and its columns as . Then
Thus the row space and column space consist of all linear combinations of the corresponding rows and columns; the null space is the kernel of a linear map represented by . The matrix rank counts independent row or column directions, with row rank equal to column rank.
The pivot columns in the row echelon form are columns 1 and 2. Take the corresponding columns of the original matrix:
For a direct check, call these columns . The other columns satisfy and , so they are in the same linear span. Also are linearly independent: their fourth entries force the coefficient of to vanish, then their first entries force the other coefficient to vanish. Elementary row operations preserve dependence relations among columns, but generally change the column space itself, which is why the original columns must be used.
The reduced row echelon form gives
Choose the free variables . Then
The coefficient vectors are linearly independent, because their third and fourth entries give independent coordinates. Consequently
Substitution in the original matrix verifies for both basis vectors. The rank-nullity theorem supplies the independent dimension check .
For a square matrix , an eigenvalue–eigenvector pair is a scalar and a nonzero vector satisfying
Thus the linear map represented by scales this particular direction by . The nonzero condition excludes the zero vector, which would otherwise satisfy the displayed equation for every scalar.
Use the characteristic polynomial convention , with the identity matrix. Put . Then
The required characteristic polynomial equation for this matrix is therefore
Using instead negates the cubic polynomial and leaves the eigenvalues unchanged.
The other eigenvalues are and . Their magnitudes are strictly less than one. All three eigenvalues are distinct, so their eigenvectors form a basis and the matrix is diagonalizable. Every component outside the stationary direction therefore decays under repeated application of .
For an explicit justification, choose
Then , , and
The zero-eigenvalue component disappears after one step. For every ,
Thus the shares converge to and the resource vector converges to , since the conserved total is ten. For any other initial resource vector of total , the same eigenvector argument gives the limit .
A graph path of length at most either already has length at most , or consists of a prefix of length at most followed by one edge. Therefore
The forward implication follows by removing the final edge of a nonempty graph path. Conversely, concatenating the indicated prefix and edge gives a walk of length at most , and removing repetitions if necessary gives a graph path no longer than that walk.
Writing for Boolean matrix multiplication, the formula is . Because includes the identity matrix, an equivalent formula is
Compute each new matrix from an unchanged copy of the preceding matrix, so the subscript continues to specify exactly the length bound.
Start with and repeatedly apply part (b), keeping a fresh output matrix. A simple implementation is
P := I OR E
repeat:
    Q := P OR boolean_product(P, E)
    if Q = P: return P
    P := Q
At the start of each iteration, for the current length bound . The update produces , proving the loop invariant by mathematical induction. If , every edge extension of a known graph path is already known. Repeating the same update then makes no further change, so every longer graph path is represented as well.
Every reachable pair of distinct vertices has a simple path of at most edges: a repeated vertex allows the intervening part to be deleted. Thus the process stabilizes after finitely many updates and returns
This is the reflexive transitive closure. An alternative stopping rule is to stop once the length bound is at least , avoiding a final equality-detection iteration. For or , already suffices.
Split a graph path of length at most into two consecutive parts of length at most , allowing a zero-length part. Conversely, concatenating two such parts gives a walk of length at most and hence the same reachability. Therefore
Start at , then square to obtain . Stop at equality of successive matrices, or after the length bound reaches . The invariant is now after squarings. Equality implies closure under composition, and the included identity matrix ensures reflexivity.
For the same elementary dense Boolean matrix multiplication and equality stopping test, the cost is
The additive constant covers the final stability check and the cases . Thus, with , the number of cubic passes falls from to . In terms of alone the worst-case bound improves from to for these implementations. A directed chain also requires logarithmically many squarings. This comparison uses ordinary triple-loop multiplication, rather than a faster matrix multiplication method.
Apply the elementary row operations from bottom to top: , , and . This order ensures that each subtraction uses the original preceding row. The result is the upper triangular matrix
Put , , , . Row is either zero if , or has its first nonzero entry in column . Thus, for arbitrary real parameters, a row echelon form is obtained by retaining the nonzero rows of in their existing order and moving every zero row to the bottom. This deals explicitly with vanishing parameters; an upper triangular matrix with an intermediate zero row is not yet a row echelon form.
The subtractions preserve the determinant, so the original matrix has
A square matrix is invertible exactly when its determinant is nonzero. Consequently,
These conditions concern consecutive parameters: no ordering, positivity, or pairwise distinctness of all four is required. More generally the rank of a matrix here is the number of nonzero , because the retained nonzero rows have distinct leading columns.
For a real matrix , the row space is the linear span of its rows in , and the column space is the linear span of its columns in . Its null space consists of the input vectors sent to zero:
The rank of a matrix is
The equality of row and column dimensions is the row-rank/column-rank theorem. Each displayed space is a linear subspace of the indicated ambient vector space.
The pivot columns of the reduced row echelon form are columns 1 and 3. Take those columns of the original matrix, since elementary row operations need not preserve the original column space:
For an explicit spanning check, column 2 is , column 4 is , and column 5 is . The first two coordinates of the displayed columns form a matrix of determinant , proving their linear independence. They are therefore a basis of the column space.
Every nonempty axis-aligned rectangle has a top-right corner. Enumerate all such corners and retain the greatest area from part (b).
var best = 0
var i = 0
while (i < N) {
  var j = 0
  while (j < N) {
    best = math.max(best, maxRectangleAt(i, j))
    j += 1
  }
  i += 1
}
The loop invariant is that best is the greatest area obtained from the corners processed so far, or zero if there are none. Consequently
The preprocessing cost from part (a) is included. An entirely false matrix, or an empty one, returns zero. In the printed example, rows through and columns through give area ; exhaustive corner enumeration confirms that no larger all-true rectangle exists.[ref]
Figure 1.
An area-15 rectangle and the row run lengths that certify its width
. Details.
The representation invariant is , rows.length == N, and every rows(i) is a nonnull finite list of entries satisfying
Strict increase excludes repeated columns. The abstraction function gives when the unique entry occurs in rows(i), and otherwise. Thus omitted positions represent zero; omission does not mean an unknown matrix entry.
For each source row, use a temporary dense array to accumulate contributions from nonzero pairs. For every stored , traverse stored entries in row of the other sparse matrix.
def mult(that: SparseMatrix): SparseMatrix = {
  require(N == that.N)
  val out = new SparseMatrix(N)
  for (i <- 0 until N) {
    val acc = Array.fill[Double](N)(0.0)
    for ((k, x) <- rows(i)) {
      for ((j, y) <- that.rows(k)) {
        acc(j) += x * y
      }
    }
    var j = N - 1
    var result: Row = Nil
    while (j >= 0) {
      if (acc(j) != 0.0) result = (j, acc(j)) :: result
      j -= 1
    }
    out.rows(i) = result
  }
  out
}
During accumulation, acc(j) is the sum of the already processed terms contributing to position . Missing entries multiply to zero, so ignoring them loses no contribution under the finite arithmetic convention of part (e). At completion,
Descending j and prepending produce strictly increasing stored indices. Omitting zero also handles cancellation. The temporary array uses auxiliary space beyond the output. The time complexity is
at worst , but potentially much smaller when the matrices are sparse. The term covers clearing and scanning the row accumulators. Finite-precision rounding can affect the numerical result, as in any Double matrix multiplication.
For a square matrix , an eigenvalue–eigenvector pair consists of a scalar and a nonzero vector satisfying
The linear map represented by therefore scales by . The exclusion of the zero vector matters: otherwise every scalar would satisfy the equation trivially.
For an matrix with real entries, its row space is the linear span of its rows, a linear subspace of . Its column space is the linear span of its columns, a linear subspace of and the image of a linear map . Its null space is
a linear subspace of . Finally,
Thus the rank of a matrix counts the number of linearly independent columns, equivalently rows. The nullity is by the rank-nullity theorem.
The pivot columns in the row echelon form are columns 1 and 3. Use those columns of the original matrix for a basis of the original column space:
For a direct spanning check, column 2 is twice column 1 and column 4 is times column 1 minus times column 3. The displayed columns are linearly independent, since the first two coordinates of give and , so .
Suppose an invertible matrix has two LU factorizations, , with unit lower triangular matrices and upper triangular matrices. All four factors are invertible matrices, since their square products are invertible. Multiplication by the appropriate inverse matrices gives
By the supplied closure properties, the left side is a unit lower triangular matrix and the right side is an upper triangular matrix. A matrix of both types is diagonal; its diagonal entries are all one. Thus both sides are the identity matrix, whence
Qualification of the printed wording: this establishes uniqueness if the specified LU factorization exists. Invertibility alone does not guarantee an unpivoted LU factorization. For example is invertible, but in a product , the zero top-left entry forces , making the bottom-left entry as well, contrary to the required value one. A permutation matrix is needed in general, as in PLU factorization.
Source gap / TODO: the original printed page 4, confirmed visually, omits the unknown vector. It literally equates a matrix with a vector, so it does not define a well-formed system of linear equations. The following answer is conditional on the usual intended interpretation ; the missing factor is not present in the source.
Under that interpretation, the rows satisfy . Applying this linear relation to the right-hand side gives the necessary consistency condition
It is sufficient too: the upper-left minor has determinant , so the first two rows are linearly independent. The third row is , and imposes precisely the condition already found. Therefore
For completeness, setting gives
and direct substitution satisfies all three linear equations exactly for those two values of . An unconditional answer to the malformed printed equality awaits a source correction.