Let us assume that A is non-singular i.e. |A| ≠ 0 and hence A−1 exists such that AA−1=I.
∴ AB=0
⟹ A−1(AB)=(A−1A)B=IB=B=0
Above shows that B is a null matrix which is a contradiction.
Similarly, if B is non-singular then as above we will have A=0 which is again a contradiction. hence, both A and B must be singular.