# We are given an $18\times 18$ table, all of whose cells may be black or white.

We are given an $18\times 18$ table, all of whose cells may be black or white. Initially all the cells are colored white. We may perform the following operation: choose one column or one row and change the color of all cells in this column or row. Is it possible by repeating the operation to obtain a table with exactly $16$ black cells?

Now I wonder if a following solution is correct?

All the matrix here are $18\times 18$. Let $S$ be a matrix with all entry $1$ and $F$ be a matrix with exactly $16$ entries with $0$ and the other entries are $1$.

Let $A_i$ be a matrix with all entries $1$ on $i$-th row, for $1\leq i\leq 18$ and the other are 0 and with all entries $1$ on $(i-18)$-th column for $19\leq i\leq 36$ and the other are zero. So, for example: $$A_2 =\begin{bmatrix} 0 & 0 & \dots & 0&0\\ 1&1&\dots &1&1\\ 0 & 0 & \dots & 0&0\\ \vdots & \vdots & \dots & \vdots &\vdots\\ 0 & 0 & \dots & 0&0 \end{bmatrix} \;\;\;{\rm and}\;\;\; A_{19} =\begin{bmatrix} 1 & 0 & \dots & 0&0\\ 1&0&\dots &0&0\\ 1 & 0 & \dots & 0&0\\ \vdots & \vdots & \dots & \vdots &\vdots\\ 1 & 0 & \dots & 0&0 \end{bmatrix}$$

We can understand a table as a matrix with entry $1$ if corresponding cell is white and $0$ if it is black. So $S$ is a starting matrix and $F$ a final matrix. Now each recoloring of a given matrix $M$ is actually $M+A_i$ for some $i\leq 36$

So after some transformations we have equality like this $$F = S + a_1A_1+a_2A_2+...+a_{36}A_{36}$$ where $a_i\in \{ 0,1\}$ for all $i$. Mark $F-S = D$, so $D$ is a matrix with exactly $16$ ones.

Now what can we say about $a_1,a_2,...$? Since $D$ has exactly $16$ ones it must have at least two columns and two rows with only zeros. We can assume that all entries in first $2$ rows and first $2$ columns are $0$, so $D$ is like: $$D =\begin{bmatrix} 0 & 0 & 0&\dots & 0&0\\ 0 & 0 &0 &\dots &0&0\\ 0 & 0 & *& \dots & *&*\\ \vdots & \vdots & \vdots & \dots &\vdots& \vdots\\ 0 & 0 & *&\dots & *&* \end{bmatrix}$$ If $a_1=1$ then each $a_{19},a_{20},...a_{36}$ must also be $1$ since in first row must be all $0$. But then we must have also $a_2,...,a_{18}$ all $1$ since in first column are only $0$. This means that $D$ is a zero matrix which is not true. So $a_1=0$ and thus all $a_{19},a_{20},...a_{36}$ are $0$ and then also all $a_2,...,a_{18}$ are $0$ so $D$ is zero matrix again. A contradiction.

This is not a duplicate. I don't want a solution like in that link, I want a proof verification!

• Could you make your question more clear and accurate? Obviously, you cannot obtain 17 black cells, the parity never changes. – A. Pongrácz Aug 28 '18 at 16:05
• Possible duplicate of Is is possible to obtain exactly 16 black cells? – J.-E. Pin Aug 28 '18 at 17:27
• This is not a duplicate. I don't wont a solution like in that link, I wont a proof verificiation. @J.-E.Pin – Aqua Aug 28 '18 at 18:41

Let $V$ be the vector space over the field with two elements, $\Bbb F_2$, generated by all matrices of shape $N\times N$, $N=18$, which have exactly one row, or exactly one column with one entries, all other entries being zero. We consider the following map from $V$ to $\Bbb F_2$:

$X$ in $V$ is mapped to $$f(X)= (x_{11}+x_{22}+\dots+x_{N-1,N-1}+x_{N,N}) + (x_{12}+x_{23}+\dots+x_{N-1,N}+x_{N,1})\ .$$ (Sum on two consecutive fixed diagonals of $X$, where the indices are considered modulo $N$.)

Then each generator of $V$ is mapped to zero, since the "bits" taken in $f(X)$ are exactly two in each row and/or column. So $f$ vanishes on $V$. But it does not vanish on any quadratic submatrix $A=A(I)$ with ones exactly on the positions $I\times I$, $I$ being a proper interval of $\{1,2,\dots,N\}$. (For instance $I=\{1,\dots,16\}$ for our $N=18$.)

So in our case the answer to the problem is negative. (The "change of the color on a line/columns" corresponds to adding a generator of $V$ to a matrix. We are starting with a zero matrix. The matrices that can be obtained are exactly those in the vector space $V$ of dimension $N+N-1$.)

Note: I can provide some simple computer check in sage, if needed.

Later edit: It is simpler to test the equations $$x_{is}-x_{js}-x_{it}+x_{jt}=0\ ,\qquad 1\le i<j\le N\ ,\ 1\le s<t\le N\ ,$$ that can be extracted from all $2\times 2$ minors of a matrix $X$ in order to test/decide if a matrix $X$ can be realized. (The minus is also a plus, but makes it simpler to see that e.g. each of the above "one row matrix of ones" satisfy the equation, explicitly $1-1-0+0=0$, and correspondingly for the column matrices in the base of $V$...)

• I posted the above to have a solution that can be easily generalized, so that the very special different numbers $18$ and $16$ appearing above can be taken arbitrarily. (The dimension of the vector space of all matrices in the above $V$ is $N^2$, relatively big w.r.t. the space generated by the given $2N-1$ independent operations.) – dan_fulea Aug 28 '18 at 17:59
• This is a nice solution! I've like it being algebraic. Does this solution has to do anything with my? – Aqua Aug 28 '18 at 19:09
• Yes, i tried to use the idea of finding a linear combination (or rather only a sum) of "basic blocks" so that it evaluates to the "block" to be realized, the 16x16 black square inside the given 18x18 square. This is a very good start. And the $A$-matrices are also good. Now we need the proper algebraic setting to the operation of "changing color", translated simplest by using $\Bbb F_2$ as coefficients for me (since $\pm$ and scalars are gone), but also by using positivity as in the OP, the solution is valid. I only wanted to have an algebraic way to test if some configuration is possible. – dan_fulea Aug 29 '18 at 16:44
• Oh I saw this only recently, since I can't accept two answers I will upvote your answers elsewhere. – Aqua Aug 29 '18 at 20:35

Changing all entries of a row or column is equivalent to adding a row of all 1's to that row or adding a column of all 1's to that column (modulo 2). Suppose we have added $k$ rows and $l$ columns of all 1's to the zero matrix and have obtained a matrix with exactly 16 entries equal to 1. First note that we can eliminate two equal rows (addition is commutative and two equal rows add up to zero modulo 2). So we can assume all the rows are different and all the columns are different. In particular $0\leq k,l\leq 18$.

Now, by adding $k$ different rows of all 1's and $l$ different columns of all 1's we get exactly $18k+18l-kl$ entries equal to 1. So we want $$18k+18l-kl=16,~0\leq k,l \leq 18.$$ To solve this, rewrite it as $(18-k)(18-l)=18^2-16=4*7*11$. Since the product of every two of the numbers 4, 7, and 11 exceeds 18, this equation has no solutions within the required range.

• I don't really understand the part where you say you can make all the rows and columns be different. I also don't understand why you went to quite so much trouble after that. Consider that if all rows are different, then there can be at most one row of all zeros, so there are immediately at least 17 1s (in fact there are at least 18 1s, because the parity of the sum of the array is preserved at all times) and you are done. – Ian Aug 28 '18 at 17:23
• @Ian If you change several times the status of a given row, you may as well do nothing, because changes are commutative. However, I don't understand your argument that there must be a row of $0$s: you can change columns as well. – Arnaud Mortier Aug 28 '18 at 17:27
• @ArnaudMortier That's not how I read this answer, I read it as there cannot be two identical rows in the final array, not that you can only interact with each row/column either zero or one times (which I agree with). Also, I'm saying there can be only at most one row of zeros (according to this argument that all rows must be distinct) which gives an immediate lower bound on the number of 1s. – Ian Aug 28 '18 at 17:28
• @Ian For me it is clear if you read carefully the previous sentences. – Arnaud Mortier Aug 28 '18 at 17:30
• Oh, I see, the intended meaning is "all rows in the sequence of rows to be modified are distinct" is the intended meaning. That's not clear at all in this wording; how am I to tell that "the rows" are in the sequence vs. in the final array? – Ian Aug 28 '18 at 17:31

Yes, this proof looks good to me.