How to:
The number of solutions of a system of linear equations is highly dependent upon the rank of the coefficient
matrix (That is, the part that normally comes before the equals sign in the equations. So, if we had 7x + 8y = 11, '7' and '8'
would be part of the coefficient matrix, where as the '11' would not).
Suppose we have a system of equations with m equations (no. of rows in coefficient matrix) and n unknowns (no. of columns).
First it is easy to see that the rank will always be less than or equal to m and n.
This is because no matter what, we cannot have more leading 1's than we do rows or columns (whichever we have fewer of).
Case 1 - rank(A) = m, rank(A) = n
This can only happen we we are dealing with a square coefficient matrix. When we have a leading '1' in every row and every
column, then our system of equations has exactly one solution.
Case 2 - rank(A) = m, rank(A) < n
Here we have a leading '1' in every row, but we have more columns than rows (more unknowns than equations). Here, we will
have infinity many solutions.
Case 3 - rank(A) < m, rank(A) = n
Now we have a leading '1' in every column, but more columns than rows (more equations than unknowns). To find our number
of solutions here, we must work with the augmented matrix (the coefficient matrix with the values that normally come after the
equals sign; normally we separate the coefficient matrix from the last column with colons).
So, we enter our augmented matrix into MATLAB and we find its Reduced Row-Echelon Form.
(note: MATLAB does not allow you to separate your coefficient matrix from the last column with a colon ':'. You just have
to remember what it means yourself).
If every row below the row with the last leading '1' in the coefficient matrix is all zero's (including the last column), then
we have exactly one solution.
However, if there exists a row with any non-zero value in the final column (the one that isn't part of our coefficient matrix),
then our system of equations is inconsistent and we have no solutions.
Case 4 - rank(A) < m, rank(A) < n
Here, it is again necessary to look at our augmented matrix. If we have all-zero rows, we have infinitely many solutions.
But, if we have a row with a non-zero value in the final column, we again are inconsistent and have no solutions.