The matrix is A=0111abcde with a,b,c,d,e∈{0,1}.
First find an explicit expression for the determinant.
Expanding along the first row:
∣A∣=0(ae−db)−1(1⋅e−d⋅1)+c(1⋅b−a⋅1)
⟹∣A∣=−(e−d)+c(b−a).
Define two simpler variables:
x=d−e,y=b−a,
so that
∣A∣=x+cy.
Because each entry is either 0 or 1,
x,y∈{−1,0,1}.
Specifically
- x=1 when (d,e)=(1,0),
- x=0 when (d,e)=(0,0) or (1,1),
- x=−1 when (d,e)=(0,1).
- y=1 when (b,a)=(1,0),
- y=0 when (b,a)=(0,0) or (1,1),
- y=−1 when (b,a)=(0,1).
The requirement is ∣A∣=x+cy=±1. Treat the two cases for c.
Case 1: c=0
Then ∣A∣=x. For ∣A∣=±1 we need x=±1.
- x=1:(d,e)=(1,0)
- x=−1:(d,e)=(0,1)
That gives 2 choices for (d,e).
The pair (a,b) is unrestricted (4 possibilities).
Total in this case: 1(c)×2(d,e)×4(a,b)=8.
Case 2: c=1
Now ∣A∣=x+y. We need x+y=±1.
The admissible ordered pairs (x,y) and their counts are
- (−1,0): 1 way for x × 2 ways for y = 2
- (0,1): 2 ways for x × 1 way for y = 2
- (0,−1): 2 ways for x × 1 way for y = 2
- (1,0): 1 way for x × 2 ways for y = 2
Adding these, we have 8 matrices when c=1.
Hence total in this case: 1(c)×8=8.
Adding the two cases:
8+8=16.
Therefore, the set S contains 16 matrices.