# How to find a 3x3 matrix with determinant =0 from which I can delete random column and random row to make it nonzero?

I need to find a $3 \times 3$ matrix and the determinant of this matrix has to be $0$.
I also need to be able to delete randomly chosen column and row to make the determinant nonzero? Is it even possible? Thank you.

• what does the delete row operation do? do you mean you delete a row and column randomly and consider the determinant of a $2 \times 2$ matrix? Commented Jun 4, 2017 at 20:09
• Yes. It need to work with whichever row and column I (or anyone) delete. Commented Jun 4, 2017 at 20:15
• Just a note: it's probably best to avoid using the word random in this way. Using random suggests that there is some probability distribution involved, but this is not what you mean. Instead, consider saying, "deleting an arbitrary row and an arbitrary column should yield a nonsingular 2×2 matrix." Commented Jun 5, 2017 at 1:23
• If one were to pick 8 of the entries at random, and then choose the last to make the determinant 0, the resultant matrix would almost certainly meet your condition. Commented Jun 5, 2017 at 3:26

The matrix $$\begin{pmatrix}1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9\end{pmatrix}$$works just fine :

• the columns are in arithmetic progression, which means that the middle column is the arithmetic mean of the extremal columns, and thus they are not independent.
• for any $2\times 2$ submatrix, the difference of the columns is a multiple of $\left(\begin{smallmatrix}1\\ 1 \end{smallmatrix}\right)$, but none of the column is, so the columns must generate a space of dimension $2$, hence they are linearly independent.

$$\begin{pmatrix}1&1&-2\\1&-2&1\\-2&1&1\end{pmatrix}$$

This matrix corresponds to a linear map that maps the standard basis vectors to the column vectors of the matrix. Removing a row corresponds to restricting the linear map to the $xy$-, $xz$- or $yz$-plane. Removing a column corresponds to composing the linear map with the projection to the $xy$-, $xz$- or $yz$-plane. So it is necessary and sufficient that no two column vectors project to the same vector under any of the three projections. Equivalently, each pair of column vectors must differ in at least two coordinates.

For the matrix to have zero determinant the column vector must lie in a common plane. By the above each of the three projections, restricted to this plane, must be injective, so the plane must be given by an equation $ax+by+cz=0$ with $abc\neq0$.

Then it is geometrically clear that any such plane and any three pairwise nonparallel vectors in it will suffice as column vectors. I chose the plane $x+y+z=0$ and three obvious vectors on it.

Geometrically such matrices correspond bijectively, up to scalar multiples, to triples of distinct collinear points in the projective plane whose common line does not pass through $(1:0:0)$, $(0:1:0)$ and $(0:0:1)$.

• Thank you! Can you tell me how did you find this one please? Commented Jun 4, 2017 at 20:31
• @TadCzech See my edit. Commented Jun 4, 2017 at 21:16
• Anyone care to explain the downvote? Commented Jun 4, 2017 at 21:17
• This is a nice answer -- so it would seem that almost all matrices of rank $2$ have nonsingular minors. Commented Jun 4, 2017 at 22:30
• @pjs36 Yes, this is the case, $P(\operatorname{subdet} A = 0 \mid \det A=0)=0$ for any subdeterminant choice, given the probabilitic measure you choose is ACIM. (Don't ask me for a proof though, it's probably trivial so wouldn't quite be able to show it in a trivial way.)
– yo'
Commented Jun 5, 2017 at 14:32

Your requirements can be equivalently described as wanting a 3x3 matrix with a determinant of $0$ and for which all elements of the minor matrix are non-zero. For this answer each element in the minor matrix is the determinant of the original matrix with that row and column removed. i.e. element of minor matrix at row $i$ and column $j$ is the determinant of the original matrix with row $i$ and column $j$ removed. (There are other conventions used elsewhere.)

By building a general matrix then solving the conditions I derived a general condition for the matrix to obey. I found that the minor matrix had 5 independent elements. These could be taken to be any set of elements such that there was at least one element in each row and each column. The remaining 4 elements are dependant on the other 5 via very simple formulas.

I chose for the independent elements to be the top row and first column so the matrix takes the form $$\begin{pmatrix}A & B & C\\D&\dfrac{B D}{A} & \dfrac{C D}{A}\\G &\dfrac{B G}{A}&\dfrac{C G}{A}\end{pmatrix}$$

This form must always obey the requirements that they are all non-zero as long as the independent elements are explicitly chosen to be non-zero as then the fractions can no be infinite, indeterminate or zero.

Now the original matrix must be calculated that gives this form. This matrix was found to have 3 more independent elements. Using one choice of independent veriables the matrix is given by $$\begin{pmatrix}\dfrac{A b d+C G}{A e}& b& \dfrac{b B}{C}-\dfrac{A b d+C G}{C e}\\ d& e& \dfrac{B e-A d}{C}\\ \dfrac{d D}{G}-\dfrac{A b d+C G}{e G}& \dfrac{D e-A b}{G}& \dfrac{A (A b d +C G)}{C e G}+\dfrac{B D e}{C G}-\dfrac{A (b B+d D)}{C G}\end{pmatrix}$$

It is clear that this formula diverges when $e$ is $0$ unless $Abd+CG$ is also $0$. For this case the matrix can be found by replacing one of $b$ or $d$ (I chose to use $b$) and then taking the limit of $e\to 0$ which gives $$\begin{pmatrix}a& -\dfrac{C G}{A d}& -\dfrac{a A}{C}-\dfrac{B G}{A d}\\ d& 0& -\dfrac{A d}{C}\\ -\dfrac{a A}{G}+\dfrac{d D}{G}& \frac{C}{d}& \dfrac{a A^2}{C G}-\dfrac{A d D}{C G}+\dfrac{B}{d}\end{pmatrix}$$

Using these formulas a general matrix can be chosen by first choosing the independent minors, $A$, $B$, $C$, $D$ and $G$, to be non-zero values from whatever range and type (i.e. integer or real) by whatever means desired. Then a value for $e$ should be chosen from the desired range and type, allowing it to be $0$. Depending on if $e$ turns out to be $0$ then the relevant formula can be used. Finally the last two values must be chosen and the values can be substituted into the formulas given to produce the elements of the matrix.

If it is required that all elements be integers or in certain ranges or for the matrices to be produced uniformly using a random number generator, them more effort will be needed as the values produced by the formulas for the elements will not be nicely distributed or integers.

I wrote a simple procedure in Maple that generates this kind of matrix:

restart: with(combinat): with(LinearAlgebra):
Checkmatrix:=proc(a,b)
local u,t,B,P,i,j,F;
u:=1:
while u=1 do
t:=1:
B := RandomMatrix(3, 3, generator = a .. b)
if Determinant(B)=0 then
P := choose(3, 2)
for i from 1 to nops(P) do
for j from 1 to nops(P) do
F := B(P[i], P[j])
if Determinant(F)=0 then
t:=0: i:=nops(P)+1:j:=nops(P)+1: end if;
end do: end do:
if t = 1 then print(B); u := 0 end if
unassign('B, F, i, j, P')
end if:
end do:
end proc:


In the procedure Checkmatrix the values of $a$ and $b$ are min and max number of matrix. For example: $$Checkmatrix(-1, 1)= \left( \begin {array}{ccc} 1&-1&0\\ -1&0&-1 \\ 0&-1&-1\end {array} \right)$$ One of the form of this kind of matrix is as follows: $$A=\left( \begin {array}{ccc} n+2&n+1&n\\ n&n&n \\ n&n+1&n+2\end {array} \right)$$ where $n$ is a natural numbers. We can check that the determinant of $A$ is zero and determinant of all sub-matrix of $A$ is a linear function based on the $n$ like $n,2n,2n+2,4n+4$. For example: $$A= \left( \begin {array}{ccc} 3&2&1\\1&1&1 \\ 1&2&3\end {array} \right)$$

Pick an arbitrary nonsingular $2\times2$ matrix $P$ and also four nonzero numbers $u_1,u_2,v_1,v_2$. Let $$A=\pmatrix{1&0\\ 0&1\\ u_1&u_2}P\pmatrix{1&0&v_1\\ 0&1&v_2}.\tag{1}$$ Then $A$ is singular because it has rank 2, but its every $2\times2$ submatrix is nonsingular because it is the product of three nonsingular $2\times2$ matrices. In fact, every singular $3\times3$ matrix whose all $2\times2$ submatrices are nonsingular can be written in the form of $(1)$.

• Perfect answer. Commented Jul 12, 2017 at 11:07