Oops, this matrix is singular:
a <- matrix(1:16, 4, 4)
1 5 9 13
2 6 10 14
3 7 11 15
4 8 12 16
Why? See this:
a[, 3, drop = FALSE] + a[, 2, drop = FALSE] - a[, 1, drop = FALSE]
[,1]
[1,] 13
[2,] 14
[3,] 15
[4,] 16
exactly a[, 4, drop = FALSE]
.
A square matrix is invertible, only when it has full column rank, i.e., all its columns are linearly independent. But the columns of this matrix is linearly dependent, i.e., you can write out one column as linear combination of other columns.
In fact, matrices like a <- matrix(1:(n*n), n, n)
are singular, for any n > 2
. You can prove that those matrices have only a rank of 2, no matter how large n
is.