I was asked this years ago, but I don't remember by whom, and have never managed to solve it. Consider the $2^n \times n$ matrix of all vectors in {-1,1}$^n$. Someone comes and maliciously replaces some of the entries by zeros. Show that there still remains a non-empty subset of rows that add up to the all zero vector.

  • $\begingroup$ To see if I understand your situation properly, you're taking 2^n vectors of n elements such that each element in the matrix is a -1 or a 1, and no two vectors are the same? I would think that a proof for such would use induction, but I'm not sure how it would work. $\endgroup$ – Gabriel Benamy Dec 1 '09 at 20:36
  • 1
    $\begingroup$ How about the smpty subset? ;-) $\endgroup$ – Kevin Buzzard Dec 1 '09 at 20:47
  • $\begingroup$ @buzzard: I took the liberty of inserting the non-empty word. $\endgroup$ – Ilya Nikokoshev Dec 1 '09 at 21:06
  • $\begingroup$ I hope for your sake the problem is correct with that modification :-) $\endgroup$ – Kevin Buzzard Dec 1 '09 at 21:21
  • 26
    $\begingroup$ "Someone comes and maliciously replaces some of the words by other words. Show that the problem still has a solution" $\endgroup$ – Kevin Buzzard Dec 1 '09 at 21:22

Another answer (I guess they must be equivalent):

  • Write each original line as a difference of two 0/1 vectors.
  • Adapt this representation to the modified lines by changing only the subtrahends.
  • You now have a function from {0,1}^n to {0,1}^n. Find a cycle.
  • 1
    $\begingroup$ For the archive: The function in step 3 is the one that maps each minuend to the corresponding changed subtrahend. -- Great solution! $\endgroup$ – darij grinberg Jul 18 '10 at 23:48

Hint: starting with the empty set, add vectors one by one and ensure you never get a negative entry in the partial sum. During the process, either you can find a suitable vector (the one which originally had 1's where your current sum has 0's), or you've hit upon a partial sum previously seen - which means the difference is 0.

  • $\begingroup$ But we're not asked about differences, are we? Just sums. $\endgroup$ – Harald Hanche-Olsen Dec 1 '09 at 22:56
  • 2
    $\begingroup$ Harald: The difference between the previous and current partial sums being zero is the same thing as the sum of the vectors you added between then and now being zero. $\endgroup$ – David Eppstein Dec 1 '09 at 23:38
  • $\begingroup$ Oh, duh; thanks. I had one more objection, which was how we could tell that we have the same partial sum again if we stopped. The point being that we must always keep every component of the partial sums in {0,1}, as the particular choice suggested in the answer ensures. (Well, he did call it a hint, did he not?) So that's +1 from me, then. $\endgroup$ – Harald Hanche-Olsen Dec 2 '09 at 0:06
  • $\begingroup$ Great, thanks Alon. I've been haunted by this silly question for a long time. BTW, I believe it used to be used as a question in job interviews for Hi-Tech companies in Israel. I am sure every single candidate started by trying induction. The nice thing about your solution is that it is almost dimension-free... $\endgroup$ – Ehud Friedgut Dec 2 '09 at 5:43
  • $\begingroup$ Glad I could help :) I wouldn't call this a silly question, I actually think it's quite hard despite the solution being fairly simple. I also think it's completely unsuitable for job interviews, but I know a lot of companies do this kind of stuff. If a person is unable to solve this on the spot, you really learn very little about them. $\endgroup$ – Alon Amit Dec 2 '09 at 17:29

One place where it showed up:



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.