Test of Consistency and Solution of Linear Systems using Matrices
Introduction to Linear Systems
A system of linear equations is a set of two or more linear equations involving the same set of variables. For example, consider the system of equations:
$a_1x + b_1y + c_1z = d_1$
$a_2x + b_2y + c_2z = d_2$
$a_3x + b_3y + c_3z = d_3$
This system can be represented in matrix form as $AX = B$, where:
$A = \begin{bmatrix} a_1 & b_1 & c_1 \\ a_2 & b_2 & c_2 \\ a_3 & b_3 & c_3 \end{bmatrix}$ (Coefficient Matrix)
$X = \begin{bmatrix} x \\ y \\ z \end{bmatrix}$ (Variable Matrix)
$B = \begin{bmatrix} d_1 \\ d_2 \\ d_3 \end{bmatrix}$ (Constant Matrix)
The study of linear systems using matrices involves determining whether a solution exists (consistency) and, if so, finding that solution. This is a fundamental concept in linear algebra with applications in various fields like engineering, economics, and computer science.
Test of Consistency
A system of linear equations $AX = B$ is said to be consistent if it has at least one solution. It is inconsistent if it has no solution. We can test for consistency using the determinant of the coefficient matrix and the augmented matrix.
Case 1: Determinant of the Coefficient Matrix is Non-Zero ($\det(A) \neq 0$)
If the determinant of the coefficient matrix $A$ is non-zero, the matrix $A$ is invertible. In this case, the system $AX = B$ has a unique solution given by $X = A^{-1}B$. The system is always consistent, and the solution is unique.
Example:
Consider the system:
$x + y + z = 6$
$2x + y - z = 1$
$3x + 2y + z = 11$
The matrix form is $AX = B$, where: $A = \begin{bmatrix} 1 & 1 & 1 \\ 2 & 1 & -1 \\ 3 & 2 & 1 \end{bmatrix}$, $X = \begin{bmatrix} x \\ y \\ z \end{bmatrix}$, $B = \begin{bmatrix} 6 \\ 1 \\ 11 \end{bmatrix}$
Calculate the determinant of $A$:
$\det(A) = 1(1 \cdot 1 - (-1) \cdot 2) - 1(2 \cdot 1 - (-1) \cdot 3) + 1(2 \cdot 2 - 1 \cdot 3)$
$\det(A) = 1(1 + 2) - 1(2 + 3) + 1(4 - 3)$
$\det(A) = 1(3) - 1(5) + 1(1)$
$\det(A) = 3 - 5 + 1 = -1$
Since $\det(A) = -1 \neq 0$, the system has a unique solution and is consistent.
Case 2: Determinant of the Coefficient Matrix is Zero ($\det(A) = 0$)
If the determinant of the coefficient matrix $A$ is zero, the matrix $A$ is singular, and it does not have an inverse. In this situation, the system may have either no solution (inconsistent) or infinitely many solutions (consistent). To determine which case applies, we examine the rank of the coefficient matrix $A$ and the augmented matrix $[A|B]$.
The augmented matrix $[A|B]$ is formed by appending the constant matrix $B$ as an additional column to the coefficient matrix $A$. $[A|B] = \begin{bmatrix} a_1 & b_1 & c_1 & d_1 \\ a_2 & b_2 & c_2 & d_2 \\ a_3 & b_3 & c_3 & d_3 \end{bmatrix}$
We use the concept of rank. The rank of a matrix, denoted as $\rho(M)$, is the maximum number of linearly independent rows or columns in the matrix.
Subcase 2a: Inconsistent System (No Solution) The system $AX = B$ is inconsistent if and only if the rank of the coefficient matrix $A$ is not equal to the rank of the augmented matrix $[A|B]$. That is, $\rho(A) \neq \rho([A|B])$.
Subcase 2b: Consistent System (Infinitely Many Solutions) The system $AX = B$ has infinitely many solutions if and only if the rank of the coefficient matrix $A$ is equal to the rank of the augmented matrix $[A|B]$, and this common rank is less than the number of variables. That is, $\rho(A) = \rho([A|B]) < n$, where $n$ is the number of variables (e.g., 3 for $x, y, z$).
Example for $\det(A) = 0$:
Consider the system:
$x + 2y + 3z = 6$
$2x + 4y + 6z = 12$
$3x + 6y + 9z = 18$
The matrix form is $AX = B$, where: $A = \begin{bmatrix} 1 & 2 & 3 \\ 2 & 4 & 6 \\ 3 & 6 & 9 \end{bmatrix}$, $X = \begin{bmatrix} x \\ y \\ z \end{bmatrix}$, $B = \begin{bmatrix} 6 \\ 12 \\ 18 \end{bmatrix}$
Calculate the determinant of $A$:
$\det(A) = 1(4 \cdot 9 - 6 \cdot 6) - 2(2 \cdot 9 - 6 \cdot 3) + 3(2 \cdot 6 - 4 \cdot 3)$
$\det(A) = 1(36 - 36) - 2(18 - 18) + 3(12 - 12)$
$\det(A) = 1(0) - 2(0) + 3(0) = 0$
Since $\det(A) = 0$, we need to check the ranks. The augmented matrix is $[A|B] = \begin{bmatrix} 1 & 2 & 3 & 6 \\ 2 & 4 & 6 & 12 \\ 3 & 6 & 9 & 18 \end{bmatrix}$
Notice that the second row is 2 times the first row, and the third row is 3 times the first row. Similarly, the second and third columns are multiples of the first column. This indicates linear dependence.
We can perform row operations to find the rank. $R_2 \rightarrow R_2 - 2R_1$ $R_3 \rightarrow R_3 - 3R_1$ $[A|B] \sim \begin{bmatrix} 1 & 2 & 3 & 6 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \end{bmatrix}$
The rank of $A$ (ignoring the last column) is 1, as there is only one non-zero row. $\rho(A) = 1$. The rank of the augmented matrix $[A|B]$ is also 1, as there is only one non-zero row. $\rho([A|B]) = 1$.
Here, $\rho(A) = \rho([A|B]) = 1$. The number of variables $n=3$. Since $1 < 3$, the system is consistent and has infinitely many solutions.
Another Example for $\det(A) = 0$: Inconsistent System
Consider the system:
$x + y + z = 6$
$2x + 3y + 2z = 10$
$3x + 4y + 3z = 15$
$A = \begin{bmatrix} 1 & 1 & 1 \\ 2 & 3 & 2 \\ 3 & 4 & 3 \end{bmatrix}$, $X = \begin{bmatrix} x \\ y \\ z \end{bmatrix}$, $B = \begin{bmatrix} 6 \\ 10 \\ 15 \end{bmatrix}$
$\det(A) = 1(3 \cdot 3 - 2 \cdot 4) - 1(2 \cdot 3 - 2 \cdot 3) + 1(2 \cdot 4 - 3 \cdot 3)$
$\det(A) = 1(9 - 8) - 1(6 - 6) + 1(8 - 9)$
$\det(A) = 1(1) - 1(0) + 1(-1) = 1 - 0 - 1 = 0$
Augmented matrix: $[A|B] = \begin{bmatrix} 1 & 1 & 1 & 6 \\ 2 & 3 & 2 & 10 \\ 3 & 4 & 3 & 15 \end{bmatrix}$
Row operations: $R_2 \rightarrow R_2 - 2R_1$ $R_3 \rightarrow R_3 - 3R_1$ $[A|B] \sim \begin{bmatrix} 1 & 1 & 1 & 6 \\ 0 & 1 & 0 & -2 \\ 0 & 1 & 0 & -3 \end{bmatrix}$
Now, $R_3 \rightarrow R_3 - R_2$ $[A|B] \sim \begin{bmatrix} 1 & 1 & 1 & 6 \\ 0 & 1 & 0 & -2 \\ 0 & 0 & 0 & -1 \end{bmatrix}$
The rank of $A$ (first 3 columns) is 2, as there are two non-zero rows. $\rho(A) = 2$. The rank of the augmented matrix $[A|B]$ is 3, as there are three non-zero rows. $\rho([A|B]) = 3$.
Since $\rho(A) = 2$ and $\rho([A|B]) = 3$, we have $\rho(A) \neq \rho([A|B])$. Therefore, the system is inconsistent and has no solution.
Solution of Linear Systems using Matrices
There are several methods to solve a system of linear equations using matrices. The most common ones are using the inverse matrix and using Gaussian elimination (row reduction).
Method 1: Using the Inverse Matrix (for unique solutions)
This method is applicable only when $\det(A) \neq 0$, which guarantees a unique solution. The system is $AX = B$. Multiply both sides by $A^{-1}$ from the left: $A^{-1}(AX) = A^{-1}B$ $(A^{-1}A)X = A^{-1}B$ $IX = A^{-1}B$ $X = A^{-1}B$
To use this method, you need to:
- Form the matrices $A$, $X$, and $B$.
- Calculate $\det(A)$. If it's zero, this method cannot be used directly.
- Calculate the inverse matrix $A^{-1}$. The formula for the inverse of a 3x3 matrix $A = \begin{bmatrix} a & b & c \\ d & e & f \\ g & h & i \end{bmatrix}$ is $A^{-1} = \frac{1}{\det(A)} \text{adj}(A)$, where $\text{adj}(A)$ is the adjugate (or adjoint) of $A$. The adjugate is the transpose of the cofactor matrix.
- Multiply $A^{-1}$ by $B$ to find $X$.
Example (Continuing from the first example where $\det(A) = -1$): $A = \begin{bmatrix} 1 & 1 & 1 \\ 2 & 1 & -1 \\ 3 & 2 & 1 \end{bmatrix}$, $B = \begin{bmatrix} 6 \\ 1 \\ 11 \end{bmatrix}$, $\det(A) = -1$.
First, find the cofactor matrix of $A$. $C_{11} = +(1 \cdot 1 - (-1) \cdot 2) = 3$ $C_{12} = -(2 \cdot 1 - (-1) \cdot 3) = -5$ $C_{13} = +(2 \cdot 2 - 1 \cdot 3) = 1$ $C_{21} = -(1 \cdot 1 - 1 \cdot 2) = -(-1) = 1$ $C_{22} = +(1 \cdot 1 - 1 \cdot 3) = -2$ $C_{23} = -(1 \cdot 2 - 1 \cdot 3) = -(-1) = 1$ $C_{31} = +(1 \cdot (-1) - 1 \cdot 2) = -3$ $C_{32} = -(1 \cdot (-1) - 1 \cdot 2) = -(-3) = 3$ $C_{33} = +(1 \cdot 1 - 1 \cdot 2) = -1$
Cofactor Matrix $C = \begin{bmatrix} 3 & -5 & 1 \\ 1 & -2 & 1 \\ -3 & 3 & -1 \end{bmatrix}$
Adjugate Matrix $\text{adj}(A) = C^T = \begin{bmatrix} 3 & 1 & -3 \\ -5 & -2 & 3 \\ 1 & 1 & -1 \end{bmatrix}$
Inverse Matrix $A^{-1} = \frac{1}{\det(A)} \text{adj}(A) = \frac{1}{-1} \begin{bmatrix} 3 & 1 & -3 \\ -5 & -2 & 3 \\ 1 & 1 & -1 \end{bmatrix} = \begin{bmatrix} -3 & -1 & 3 \\ 5 & 2 & -3 \\ -1 & -1 & 1 \end{bmatrix}$
Now, calculate $X = A^{-1}B$: $X = \begin{bmatrix} -3 & -1 & 3 \\ 5 & 2 & -3 \\ -1 & -1 & 1 \end{bmatrix} \begin{bmatrix} 6 \\ 1 \\ 11 \end{bmatrix}$ $X = \begin{bmatrix} (-3)(6) + (-1)(1) + (3)(11) \\ (5)(6) + (2)(1) + (-3)(11) \\ (-1)(6) + (-1)(1) + (1)(11) \end{bmatrix}$ $X = \begin{bmatrix} -18 - 1 + 33 \\ 30 + 2 - 33 \\ -6 - 1 + 11 \end{bmatrix}$ $X = \begin{bmatrix} 14 \\ -1 \\ 4 \end{bmatrix}$
So, $x = 14$, $y = -1$, and $z = 4$. This is the unique solution.
Method 2: Gaussian Elimination (Row Reduction)
This method is versatile and can be used to determine consistency and find solutions (unique or infinite) for any system of linear equations. It involves transforming the augmented matrix $[A|B]$ into row echelon form or reduced row echelon form using elementary row operations.
Elementary Row Operations:
- Swapping two rows ($R_i \leftrightarrow R_j$).
- Multiplying a row by a non-zero scalar ($R_i \rightarrow kR_i$, $k \neq 0$).
- Adding a multiple of one row to another row ($R_i \rightarrow R_i + kR_j$).
The goal is to transform the matrix into a simpler form where the solution can be easily read.
Steps for Gaussian Elimination:
- Form the augmented matrix $[A|B]$.
- Use elementary row operations to transform the matrix into row echelon form. This means:
- All non-zero rows are above any rows of all zeros.
- The leading coefficient (pivot) of a non-zero row is always strictly to the right of the leading coefficient of the row above it.
- All entries in a column below a leading coefficient are zeros.
- Analyze the row echelon form to determine consistency and the nature of the solution (unique, infinite, or none).
- If consistent, use back-substitution to find the solution(s).
Example 1: Unique Solution (using Gaussian Elimination)
Consider the system:
$x + y + z = 6$
$2x + y - z = 1$
$3x + 2y + z = 11$
Augmented matrix: $[A|B] = \begin{bmatrix} 1 & 1 & 1 & | & 6 \\ 2 & 1 & -1 & | & 1 \\ 3 & 2 & 1 & | & 11 \end{bmatrix}$
Perform row operations: $R_2 \rightarrow R_2 - 2R_1$ $R_3 \rightarrow R_3 - 3R_1$ $\begin{bmatrix} 1 & 1 & 1 & | & 6 \\ 0 & -1 & -3 & | & -11 \\ 0 & -1 & -2 & | & -7 \end{bmatrix}$
$R_3 \rightarrow R_3 - R_2$ $\begin{bmatrix} 1 & 1 & 1 & | & 6 \\ 0 & -1 & -3 & | & -11 \\ 0 & 0 & 1 & | & 4 \end{bmatrix}$
This is now in row echelon form. The corresponding system is: $x + y + z = 6$ $-y - 3z = -11$ $z = 4$
Now, use back-substitution: From $z = 4$. Substitute $z=4$ into $-y - 3z = -11$: $-y - 3(4) = -11$ $-y - 12 = -11$ $-y = 1$ $y = -1$
Substitute $y=-1$ and $z=4$ into $x + y + z = 6$: $x + (-1) + 4 = 6$ $x + 3 = 6$ $x = 3$
Wait, there is a discrepancy. Let's recheck the inverse matrix calculation. $X = \begin{bmatrix} -18 - 1 + 33 \\ 30 + 2 - 33 \\ -6 - 1 + 11 \end{bmatrix} = \begin{bmatrix} 14 \\ -1 \\ 4 \end{bmatrix}$ The inverse method gave $x=14, y=-1, z=4$. Let's recheck the Gaussian elimination calculation. $R_3 \rightarrow R_3 - R_2$ $\begin{bmatrix} 1 & 1 & 1 & | & 6 \\ 0 & -1 & -3 & | & -11 \\ 0 & 0 & 1 & | & 4 \end{bmatrix}$ This step is correct. $z = 4$. $-y - 3z = -11 \implies -y - 3(4) = -11 \implies -y - 12 = -11 \implies -y = 1 \implies y = -1$. Correct. $x + y + z = 6 \implies x + (-1) + 4 = 6 \implies x + 3 = 6 \implies x = 3$. Let's re-verify the inverse matrix calculation. $A^{-1} = \begin{bmatrix} -3 & -1 & 3 \\ 5 & 2 & -3 \\ -1 & -1 & 1 \end{bmatrix}$ $A^{-1}B = \begin{bmatrix} -3 & -1 & 3 \\ 5 & 2 & -3 \\ -1 & -1 & 1 \end{bmatrix} \begin{bmatrix} 6 \\ 1 \\ 11 \end{bmatrix} = \begin{bmatrix} -18 - 1 + 33 \\ 30 + 2 - 33 \\ -6 - 1 + 11 \end{bmatrix} = \begin{bmatrix} 14 \\ -1 \\ 4 \end{bmatrix}$. Let's substitute the Gaussian result ($x=3, y=-1, z=4$) into the original equations: $3 + (-1) + 4 = 6$ (Correct) $2(3) + (-1) - 4 = 6 - 1 - 4 = 1$ (Correct) $3(3) + 2(-1) + 4 = 9 - 2 + 4 = 11$ (Correct) So, the Gaussian elimination result ($x=3, y=-1, z=4$) is correct. Let's re-examine the cofactor calculations. $A = \begin{bmatrix} 1 & 1 & 1 \\ 2 & 1 & -1 \\ 3 & 2 & 1 \end{bmatrix}$ $C_{11} = +(1 - (-2)) = 3$ $C_{12} = -(2 - (-3)) = -5$ $C_{13} = +(4 - 3) = 1$ $C_{21} = -(1 - 2) = 1$ $C_{22} = +(1 - 3) = -2$ $C_{23} = -(2 - 3) = 1$ $C_{31} = +(-1 - 1) = -2$ <-- ERROR FOUND HERE $C_{32} = -(-1 - 2) = 3$ $C_{33} = +(1 - 2) = -1$ Corrected Cofactor Matrix $C = \begin{bmatrix} 3 & -5 & 1 \\ 1 & -2 & 1 \\ -2 & 3 & -1 \end{bmatrix}$ Corrected Adjugate Matrix $\text{adj}(A) = C^T = \begin{bmatrix} 3 & 1 & -2 \\ -5 & -2 & 3 \\ 1 & 1 & -1 \end{bmatrix}$ Corrected Inverse Matrix $A^{-1} = \frac{1}{-1} \begin{bmatrix} 3 & 1 & -2 \\ -5 & -2 & 3 \\ 1 & 1 & -1 \end{bmatrix} = \begin{bmatrix} -3 & -1 & 2 \\ 5 & 2 & -3 \\ -1 & -1 & 1 \end{bmatrix}$ Now, recalculate $X = A^{-1}B$: $X = \begin{bmatrix} -3 & -1 & 2 \\ 5 & 2 & -3 \\ -1 & -1 & 1 \end{bmatrix} \begin{bmatrix} 6 \\ 1 \\ 11 \end{bmatrix}$ $X = \begin{bmatrix} (-3)(6) + (-1)(1) + (2)(11) \\ (5)(6) + (2)(1) + (-3)(11) \\ (-1)(6) + (-1)(1) + (1)(11) \end{bmatrix}$ $X = \begin{bmatrix} -18 - 1 + 22 \\ 30 + 2 - 33 \\ -6 - 1 + 11 \end{bmatrix}$ $X = \begin{bmatrix} 3 \\ -1 \\ 4 \end{bmatrix}$ This now matches the Gaussian elimination result: $x=3, y=-1, z=4$. It's crucial to be meticulous with calculations.
Example 2: Infinitely Many Solutions (using Gaussian Elimination) Consider the system from earlier: $x + 2y + 3z = 6$ $2x + 4y + 6z = 12$ $3x + 6y + 9z = 18$
Augmented matrix: $[A|B] = \begin{bmatrix} 1 & 2 & 3 & | & 6 \\ 2 & 4 & 6 & | & 12 \\ 3 & 6 & 9 & | & 18 \end{bmatrix}$
Row operations: $R_2 \rightarrow R_2 - 2R_1$ $R_3 \rightarrow R_3 - 3R_1$ $\begin{bmatrix} 1 & 2 & 3 & | & 6 \\ 0 & 0 & 0 & | & 0 \\ 0 & 0 & 0 & | & 0 \end{bmatrix}$
This is in row echelon form. The corresponding system is: $x + 2y + 3z = 6$ $0 = 0$ $0 = 0$
We have one equation with three variables. This indicates infinitely many solutions. We can express the variables in terms of parameters. Let $y = s$ and $z = t$, where $s$ and $t$ are arbitrary real numbers. Then, $x = 6 - 2y - 3z = 6 - 2s - 3t$.
The solution set is $(x, y, z) = (6 - 2s - 3t, s, t)$ for any $s, t \in \mathbb{R}$.
Example 3: Inconsistent System (using Gaussian Elimination) Consider the system from earlier: $x + y + z = 6$ $2x + 3y + 2z = 10$ $3x + 4y + 3z = 15$
Augmented matrix: $[A|B] = \begin{bmatrix} 1 & 1 & 1 & | & 6 \\ 2 & 3 & 2 & | & 10 \\ 3 & 4 & 3 & | & 15 \end{bmatrix}$
Row operations: $R_2 \rightarrow R_2 - 2R_1$ $R_3 \rightarrow R_3 - 3R_1$ $\begin{bmatrix} 1 & 1 & 1 & | & 6 \\ 0 & 1 & 0 & | & -2 \\ 0 & 1 & 0 & | & -3 \end{bmatrix}$
$R_3 \rightarrow R_3 - R_2$ $\begin{bmatrix} 1 & 1 & 1 & | & 6 \\ 0 & 1 & 0 & | & -2 \\ 0 & 0 & 0 & | & -1 \end{bmatrix}$
The last row corresponds to the equation $0x + 0y + 0z = -1$, which simplifies to $0 = -1$. This is a contradiction, meaning the system has no solution. It is inconsistent.
Cramer's Rule (Alternative for Unique Solutions)
Cramer's rule provides another method to find the unique solution of a system of linear equations $AX = B$ when $\det(A) \neq 0$. It expresses each variable as a ratio of two determinants.
For a system of $n$ linear equations in $n$ variables: $A = [a_{ij}]$, $X = [x_1, x_2, \dots, x_n]^T$, $B = [b_1, b_2, \dots, b_n]^T$.
The solution for each variable $x_i$ is given by: $x_i = \frac{\det(A_i)}{\det(A)}$
where $A_i$ is the matrix formed by replacing the $i$-th column of $A$ with the constant matrix $B$.
Example (using Cramer's Rule for the first example): $A = \begin{bmatrix} 1 & 1 & 1 \\ 2 & 1 & -1 \\ 3 & 2 & 1 \end{bmatrix}$, $B = \begin{bmatrix} 6 \\ 1 \\ 11 \end{bmatrix}$, $\det(A) = -1$.
To find $x$, replace the first column of $A$ with $B$: $A_1 = \begin{bmatrix} 6 & 1 & 1 \\ 1 & 1 & -1 \\ 11 & 2 & 1 \end{bmatrix}$ $\det(A_1) = 6(1 - (-2)) - 1(1 - (-11)) + 1(2 - 11)$ $\det(A_1) = 6(3) - 1(12) + 1(-9) = 18 - 12 - 9 = -3$ $x = \frac{\det(A_1)}{\det(A)} = \frac{-3}{-1} = 3$.
To find $y$, replace the second column of $A$ with $B$: $A_2 = \begin{bmatrix} 1 & 6 & 1 \\ 2 & 1 & -1 \\ 3 & 11 & 1 \end{bmatrix}$ $\det(A_2) = 1(1 - (-11)) - 6(2 - (-3)) + 1(22 - 3)$ $\det(A_2) = 1(12) - 6(5) + 1(19) = 12 - 30 + 19 = 1$ $y = \frac{\det(A_2)}{\det(A)} = \frac{1}{-1} = -1$.
To find $z$, replace the third column of $A$ with $B$: $A_3 = \begin{bmatrix} 1 & 1 & 6 \\ 2 & 1 & 1 \\ 3 & 2 & 11 \end{bmatrix}$ $\det(A_3) = 1(11 - 2) - 1(22 - 3) + 6(4 - 3)$ $\det(A_3) = 1(9) - 1(19) + 6(1) = 9 - 19 + 6 = -4$ $z = \frac{\det(A_3)}{\det(A)} = \frac{-4}{-1} = 4$.
The solution is $x=3, y=-1, z=4$, which matches the results from the other methods.
- Inverse Matrix Method: Useful for theoretical purposes and when $A^{-1}$ is readily available or easy to compute. Computationally intensive for large matrices.
- Gaussian Elimination: Most general method. Works for any system, determines consistency, and finds unique or infinite solutions. Efficient for larger systems.
- Cramer's Rule: Elegant for finding unique solutions, especially for 2x2 or 3x3 systems. Becomes computationally expensive for larger systems due to determinant calculations. Not applicable for inconsistent or infinitely many solutions.
Systems of Equations with Fewer or More Equations than Variables
The concepts of consistency and solutions extend to systems where the number of equations ($m$) is not equal to the number of variables ($n$).
Case: $m < n$ (Fewer equations than variables) Example: $x + y + z = 6$ $2x + y - z = 1$ Here $m=2, n=3$. Augmented matrix: $\begin{bmatrix} 1 & 1 & 1 & | & 6 \\ 2 & 1 & -1 & | & 1 \end{bmatrix}$ Row reduction leads to: $\begin{bmatrix} 1 & 1 & 1 & | & 6 \\ 0 & -1 & -3 & | & -11 \end{bmatrix}$ $\rho(A) = 2$, $\rho([A|B]) = 2$. Since $\rho(A) = \rho([A|B]) = 2 < n=3$, the system is consistent and has infinitely many solutions. We will have $n - r = 3 - 2 = 1$ free variable.
Case: $m > n$ (More equations than variables) Example: $x + y = 3$ $2x - y = 0$ $x + 2y = 5$ Here $m=3, n=2$. Augmented matrix: $\begin{bmatrix} 1 & 1 & | & 3 \\ 2 & -1 & | & 0 \\ 1 & 2 & | & 5 \end{bmatrix}$ Row reduction: $R_2 \rightarrow R_2 - 2R_1$, $R_3 \rightarrow R_3 - R_1$ $\begin{bmatrix} 1 & 1 & | & 3 \\ 0 & -3 & | & -6 \\ 0 & 1 & | & 2 \end{bmatrix}$ $R_2 \leftrightarrow R_3$ (optional, for cleaner pivot) $\begin{bmatrix} 1 & 1 & | & 3 \\ 0 & 1 & | & 2 \\ 0 & -3 & | & -6 \end{bmatrix}$ $R_3 \rightarrow R_3 + 3R_2$ $\begin{bmatrix} 1 & 1 & | & 3 \\ 0 & 1 & | & 2 \\ 0 & 0 & | & 0 \end{bmatrix}$ $\rho(A) = 2$, $\rho([A|B]) = 2$. Since $\rho(A) = \rho([A|B]) = 2 = n$, the system is consistent and has a unique solution.
If the row reduction resulted in a row like $[0 \ 0 \ | \ k]$ where $k \neq 0$, the system would be inconsistent. This occurs when $m > n$ and the extra equations are contradictory.