A singular matrix is a square matrix (one that has a number of rows equal to the number of columns) that has no inverse. That is, if A is a singular matrix, there is no matrix B such that A*B = I, the identity matrix. You check whether a matrix is singular by taking its determinant: if the determinant is zero, the matrix is singular. However, in the real world, especially in statistics, you will find many matrices that are near-singular but not quite singular. For mathematical simplicity, it is often necessary for you to correct the near-singular matrix, making it singular.

Write the matrix’s determinant in its mathematical form. The determinant will always be the difference of two numbers, which themselves are products of the numbers in the matrix. For example, if the matrix is row 1: [2.1, 5.9], row 2: [1.1, 3.1], then the determinant is second element of row 1 multiplied by the first element of row 2 subtracted from the quantity that results from multiplying the first element of row 1 by the second element of row 2. That is, the determinant for this matrix is written 2.1*3.1 – 5.9*1.1.

Simplify the determinant, writing it as the difference of only two numbers. Perform any multiplication in the mathematical form of the determinant. To make this two terms only, perform the multiplication, yielding 6.51 – 6.49.

Round both of the numbers to the same non-prime integer. In the example, both 6 and 7 are possible choices for the rounded number. However, 7 is prime. So, round to 6, giving 6 – 6 = 0, which will allow the matrix to be singular.

Equate the first term in the mathematical expression for the determinant to the rounded number and round the numbers in that term so that the equation is true. For the example, you would write 2.1*3.1 = 6. This equation is not true, but you can make it true by rounding 2.1 to 2 and 3.1 to 3.

Repeat for the other terms. In the example, you have the term 5.9*1.1 remaining. Thus you would write 5.9*1.1 = 6. This is not true, so you round 5.9 to 6 and 1.1 to 1.

Replace the elements in the original matrix with the rounded terms, making a new, singular matrix. For the example, place the rounded numbers in the matrix so that they replace the original terms. The result is the singular matrix row 1: [2, 6], row 2: [1, 3].

#### References

- “Matrix Algebra: Theory, Computations, and Applications in Statistics”; James Gentle; 2007
- “Matrix Algebra”; Karim Abadir and Jan Magnus; 2005