Coefficient matrix Created 2026-10-18 Updated 2026-11-05
For a linear system , the coefficient matrix contains the coefficients of the unknowns, with one row per equation and one column per unknown. The system becomes . The augmented matrix additionally includes the right-hand-side column; that column is not part of .
Gaussian elimination Created 2026-09-24 Updated 2026-10-25
Gaussian elimination applies elementary row operations to reduce a linear system to triangular form. Dense elimination uses arithmetic operations.
Gaussian elimination solves a linear system by removing one unknown from later equations at each step. Write the coefficients and right-hand side together as an augmented matrix . Apply the same elementary row operations to both parts until the coefficients form a row echelon form; for a square invertible matrix, this gives an upper triangular matrix system. Then back substitution recovers the unknowns from the last equation upward. The useful simplification is that each successive equation involves fewer unknowns, while the set of solutions stays the same.
Why do elementary row operations preserve solutions? Interchanging equations changes only their order. Multiplying an equation by a nonzero scalar can be undone by division. Replacing equation by itself plus times equation , with , can be undone by adding times the unchanged equation . Equivalently, an elementary matrix is an invertible matrix, so if and only if . Applying an operation to without also applying it to loses this equivalence.
At step , choose a nonzero pivot element after any row interchange. For every , form the elimination multiplier and perform the elementary row operation . Its coefficient in column becomes in exact arithmetic. Later operations combine rows that already have zeros in earlier columns, so those zeros survive. If an active column has no nonzero candidate, general row echelon form reduction skips it; a square invertible matrix always has a candidate at each step with suitable row interchanges. Partial pivoting also considers roundoff error when selecting the candidate.[ref]
For a dense matrix with one right-hand side, the classical algorithm uses arithmetic operations over the real numbers, counting each addition, subtraction, multiplication and division as one. At step , the coefficient update has entries, each costing one multiplication and one subtraction; the elimination multipliers, right-hand-side updates and back substitution contribute lower-order terms. Searching for partial pivoting adds comparisons, and storing the dense coefficients uses space. These assumptions exclude the different storage and work patterns of sparse Gaussian elimination; the exact loop counts appear in LU factorization and solve costs. Here denotes Big O notation.
Recording the same steps as an LU decomposition makes Reusing LU factors for multiple right-hand sides possible. This is useful whenever the coefficients stay fixed while the forcing vector changes: the expensive elimination is done once. The choice of pivot element matters even when the linear system is well conditioned, as Tiny-pivot roundoff in Gaussian elimination demonstrates.
Gaussian elimination with a row swap Created 2026-10-18 Updated 2026-10-20
Consider this original linear system and its augmented matrix:
The first diagonal entry is zero, so it cannot serve as a pivot element. Interchange and to obtain a pivot element of one:
This chooses a convenient nonzero entry for exact arithmetic; partial pivoting would instead interchange and , selecting the largest absolute value, two. For our chosen ordering, the first-column elimination multipliers are and . The elementary row operation gives
The next pivot element is two and the next elimination multiplier is . Applying gives the upper triangular matrix system
Every operation also changed the right-hand side. Back substitution now gives
Checking the original equations, rather than only the reduced ones, verifies the answer by matrix multiplication:
Thus a zero first diagonal entry was a row-order obstruction, not a singular matrix. Indeed, the diagonal product of the final upper triangular matrix is ; the single row interchange makes , since the two row additions preserve the determinant.
Figure 1.
A row interchange supplies the first pivot element; successive elementary row operations create zeros, then back substitution gives
. Details.
Matrix rank Created 2026-09-24 Updated 2026-11-05
The matrix rank of an matrix over a field is the dimension of its column space, equivalently the dimension of its row space. It counts linearly independent column directions, with . Counting nonzero matrix entries gives a different quantity: an all-ones matrix can have arbitrarily many nonzero matrix entries and still have matrix rank one.[ref]
Consider the following matrix over the real numbers, with columns written as vectors:
The vectors are linearly independent: requires both and , so . The third column adds no new direction to their linear span, hence despite all nine matrix entries being nonzero. The second row likewise repeats twice the first row.
The column space is a plane through the origin:
Every output has second coordinate twice its first coordinate. Conversely, any vector equals , so this condition describes the entire plane, not just part of it. For example, is attainable, whereas lies outside the plane.
Figure 1.
Three column vectors span a two-dimensional plane: , is attainable, and is outside the column space
. Details.
Elementary row operations expose the same count algebraically. Apply and , interchange the last two rows, multiply the second row by , and subtract twice the second row from the first. The resulting reduced row echelon form is
There are two pivot columns, so the matrix rank is two. The corresponding original columns form a basis of the original column space. The pivot columns of itself span the different plane with third coordinate zero: row operations preserve column linear relations, but generally move the column space.[ref]
Solving the homogeneous linear system gives and . Taking the free variable gives
The kernel is the input direction that trades one unit of each of the first two columns for one unit of the third. This trade leaves the output unchanged. The rank-nullity theorem expresses the general balance: for an matrix of matrix rank , the nullity is . The column space describes reachable outputs; the kernel describes invisible changes to inputs.[ref]
For the attainable output , one solution is . Every solution lies in the affine solution space of a linear equation
Indeed, and . Conversely, subtracting from any solution gives a vector in the kernel, so this describes every solution. For , the same row operations on the augmented matrix expose : the second requirement demands where twice the first requires .
Figure 2.
Two pivot columns, one kernel direction, and the same row operations distinguishing attainable from impossible
. Details.
In general, a linear system is solvable exactly when appending leaves the matrix rank unchanged:
Appending a vector outside the column space adds an independent direction. When a solution exists, every solution is , because . Thus one count predicts both how many output directions are reachable and, through the rank-nullity theorem, how many independent input directions remain free.[ref]
Subtracting the first equation from the third gives , so . The second equation then becomes . The third fixes . Therefore the three possibilities are
For the first case the coefficient determinant is , confirming uniqueness. At its matrix rank is two. The augmented matrix has the same matrix rank only for , giving one free variable in a linear system; otherwise the linear system is inconsistent.
Let be the augmented matrix of the linear system. Consistency means that is in the column space of , equivalently . For a consistent system, choosing one solution gives every solution as . The rank-nullity theorem therefore gives the complete classification:
  • Unique: , equivalently .
  • Infinitely many: .
  • None: .
For the given equations, subtracting the first from the second and the second from the third gives
If , then and the first equation gives . If , the first reduced equation is , so the system is inconsistent. Thus
These conclusions can also be checked from , but the row differences exhibit the inconsistency directly.
When but , the dependent coefficient rows would require an impossible equality between their right-hand sides. Thus the augmented matrix has larger matrix rank than the coefficient matrix, and the linear system is inconsistent. For part (i) already supplies a unique solution. Consequently there is no solution exactly when and .
An elementary row operation is one of three reversible changes: interchange two rows; multiply one row by a nonzero scalar; or add a scalar multiple of one row to a different row. Their inverses are, respectively, the same interchange, multiplication by the reciprocal, and addition of the negative scalar multiple.
Applied to an augmented matrix, these changes interchange linear equations, rescale an equation by a nonzero factor, or add a multiple of one equation to another. Every old solution satisfies the new equations. Applying the inverse elementary row operation gives the converse, so the solution set is unchanged at every step. Equivalently, all the operations together give
where is an invertible matrix, a product of elementary matrices.
Use Gaussian elimination on the augmented matrix. First take and , then :
By back substitution, the last row gives , the second gives and hence , and the first gives . Thus
The right-hand side has been transformed in every row operation, preserving the solution set.
Apply the same elementary row operations to the augmented matrix:
The last row establishes consistency; equivalently the third original row is the second minus twice the first, and the right-hand entries obey . With and , the second equation gives and the first gives . All real solutions are therefore
This affine solution space is one particular solution plus the null space. The two free variables show that there are no additional restrictions.
Row-equivalent matrices 2026-10-18
Two matrices of the same size over the same field are row-equivalent matrices if a sequence of elementary row operations transforms one into the other.[ref] Every operation is reversible, so they have the same row space and the same column linear relations. Writing the entire sequence as multiplication by an invertible matrix gives and
Thus the kernel is preserved. For a nonzero right-hand side, perform every operation on the whole augmented matrix : changing the coefficients while keeping fixed generally changes the solutions. The column space instead transforms to , which need not equal .
Work over the rational numbers, allowing unknowns in the real numbers when interpreting the geometry. Consider four equations in three unknowns:
The third row of is the sum of its first two rows, and the fourth is their difference, second minus first. The same relations must hold on the right: consistency requires and . The latter condition already holds. Gaussian elimination makes this compatibility test explicit while exposing the remaining freedom.
Apply the elementary row operations in this order, using each row's current value:
then and . The resulting augmented matrix is in row echelon form for every :
When , the third row has its pivot element in the augmented column. It says , so the linear system has no solution. When , that entire row vanishes and only two pivot elements remain. More equations than unknowns therefore do not force a unique solution: some equations may repeat information.
The final operation reduces the coefficient block to
The product of all six elementary matrices is
Direct matrix multiplication verifies both displayed transformations. Its determinant is one, so this transformation is reversible. In particular, the third row of extracts the discrepancy between the third equation and the sum of the first two.
Figure 1.
Row echelon form exposes compatibility; a right-hand-side pivot element distinguishes inconsistency from a free variable in a linear system
. Details.
For , is the reduced row echelon form of the full augmented matrix. For , only its coefficient block is reduced: scale the third row by and clear the entries above its augmented pivot element. The full reduced row echelon form is then
The last column is part of the matrix when testing the echelon conditions. Calling fully reduced before clearing that column would miss this distinction.
System of linear equations Created 2026-10-03 Updated 2026-10-18
A system of linear equations imposes several linear equations on the same unknowns. In the compact form , the matrix contains their coefficients, the vector contains the unknowns, and the vector contains the required outputs. Over the real numbers, the following examples exhibit the three possible outcomes: one solution, infinitely many solutions, or no solution.
For and , adding the two linear equations gives , hence and . Each linear equation describes a line in the plane; the two lines meet only at . Substitution checks both requirements: and . The two measurements together determine both unknowns.
Keeping only leaves a whole line of solutions:
For instance, gives . The direction belongs to the kernel of the linear map : its two contributions cancel. Moving in that direction changes the unknowns without changing their measured sum. The solution line is an affine space, translated away from the origin.
For and , the second linear equation instead demands . The parallel lines never meet. In the augmented matrix, subtracting twice the first row from the second is an elementary row operation that exposes the contradiction:
The last row says . A zero row of coefficients is harmless only when its appended entry is also zero.
Figure 1.
Three linear systems: a unique intersection, a solution line, and incompatible parallel lines
. Details.
The column viewpoint unifies these pictures. If are the columns of , then : a linear combination of those columns. A linear system is consistent precisely when lies in the column space, the image of a linear map represented by . Once one solution is known, every solution is with , since . Conversely, subtracting any two solutions gives an element of the kernel. Thus the kernel measures freedom, while the image of a linear map decides existence. A consistent linear system has a unique solution exactly when its kernel is .[ref]
Counting linear equations alone does not tell us how much information is present. If the second requirement were , it would repeat , so the two linear equations would still leave the same solution line. The matrix rank counts independent requirements. For a consistent linear system with unknowns and matrix rank , the rank-nullity theorem gives as the dimension of the kernel. This is the number of independent directions in which a solution can move. In the single-measurement example, one measured combination leaves one direction of freedom; in the sum-and-difference example, neither unknown can change without changing an output.