A student has to pass a exam, with $k2^{k-1}$ questions to be answered by yes or no, on a subject he knows nothing about. The student is allowed to pass mock exams who have the same questions as the real exam. After each mock exam the teacher tells the student how many right answers he got, and when the student feels ready, he can pass the real exam. Show that if the student is good at combinatorics he can guess all the answers after only $2^{k}$ mock exams.

For those who prefer a more formal presentation of the problem: if $E=\{1,-1\}^{N}$ we seek $n$ so that for some vectors $v_{1},v_{2}, \ldots, v_{n}\in E$ \begin{align*} \phi\colon E &\rightarrow \mathbb{N}^{n},\\ v &\mapsto (\langle v,v_{1}\rangle, \langle v,v_{2}\rangle, \ldots, \langle v,v_{n}\rangle) \end{align*} is injective. Show that it is possible to find such vectors when $N=k2^{k-1}$ and $n=2^{k}$.

It is possible to use duality to transform again the problem. We seek a $n\times N$ matrix $M$ such that $v\mapsto Mv$ is injective over $E$. If $X$ is the formal polynomial vector $X=(X_{1},X_{2}, \ldots,X_{n})$ then $v\mapsto Mv$ is injective iff $v\mapsto \langle X,Mv \rangle$ also is. But $\langle X,Mv \rangle = \langle M^{T}X, v \rangle$ and it is easily seen that $v\mapsto \langle M^{T}X,v \rangle$ is injective iff the $N$ column vectors $x_{i}$ of $M$ are such that $\sum_{i\in I} x_{i}\neq \sum_{j\in J} x_{j}$ for any two different subsets $I$, $J$ of $\{1,\dots,N\}$.

This problem comes from an olympiad-like contest. The original problem was formulated with 30 questions and the aim was to prove that the student could guess with 24 trials. One of my teachers came up with the result above (which would give 16 trials for 30 questions), but I can't remember his proof or find another one by myself.

I tagged this information theory because some probabilistic arguments show that it is impossible to do better than this asymptotically. More precisely, if we choose the coordinates of the $v$ defined above randomly, then \begin{equation*} N = H(\phi(v)) \leqslant \sum_{i} H(\langle v,v_{i} \rangle) = nH(B(N,1/2)) \sim (n/2)\log_{2}(N) \end{equation*} where $H$ designates entropy. With $N=k2^{k-1}$ we get $n\geqslant c\frac{k2^{k}}{k-1+\log_{2}(k)}\geqslant c2^{k}$ for all $c<1$ and $k$ large enough.

  • 5,154
  • 2
  • 16
  • 32
  • 3,270
  • 12
  • 24
  • 4
    Can you explain the formal presentation? It seems to be that you think that the answer guesses must be fixed $v_i$, whereas I think that the original question allows the student to choose how to answer after each mock test. – Calvin Lin Dec 09 '14 at 05:14
  • Yes that's a very good point ! If you have a solution where the student adapts his guesses that would already be great, and I think indeed that was the original wording of the problem. But I know for sure that my teacher's proof used fixed guesses. My solution with 24 guesses for 30 questions (of which I'm not so sure because it's a bit messy) also uses fixed guesses. – Sergio Dec 09 '14 at 09:26
  • 3
    [Here](http://math.stackexchange.com/questions/810200/deducing-correct-answers-from-multiple-choice-exams) is closely related (less-refined) question. – Andrew Kelley Dec 11 '14 at 01:40
  • Perhaps your solution to the problem without having to specify the mock tests from the start can help. – Asinomás Dec 18 '14 at 05:08
  • I found the original problem, along with a solution for 24 mock exams with fixed guesses: http://www.math.toronto.edu/oz/turgor/archives/TT2008F_SAsolutions.pdf. – Sergio Dec 22 '14 at 19:27
  • This is completely trivial, but looking at the problem the other way around, I think you can do no better than this. If we think of the maximum information we can get per mock exam, it's going to be a number between $0$ and $N$, so the number of bits of information is $\log_2(N)$. So assuming we can use every bit, the most information we can get out is $n\log_2(N)$. Since we need at least $N$ bits of information, $N \le n\log_2(N)$ so I believe this constraint will hold: $\frac{N}{\log_2(N)} \le n$. – Colm Bhandal Aug 12 '17 at 10:44
  • 3
    There is an article in russian journal "Математическое просвещение" ( https://www.mccme.ru/free-books/matprosf.html ) with discussion about this problem . There you can find the proof. But it's in russian. – bigant146 Sep 27 '17 at 14:02
  • 8
    The full answer can be found in the link below, though I recommend thinking about this for a while before revealing the solution. https://users.renyi.hu/~p_erdos/1963-12.pdf – mm8511 Apr 28 '18 at 23:18
  • 2
    @Sergio Would you consider writing up the answer from the reference in a short self-contained way? – Phira Jun 24 '18 at 18:35
  • 1
    @mm8511 Of course, some thinking is recommended, because the article at your link doesn't answer the question at all. – John McClane Jul 07 '18 at 17:07
  • Another way to say this is, how many beacons do we need at corners of the n-dimensional cube, so that knowing your distance to each beacon uniquely identifies which vertex you are at. If we define $f(n)$ as the number of mock exams (beacons) needed, to prepare for an exam with $n$ questions (to locate yourself on the n-dimensional cube), then $f$ starts: 1,2,3,4,4,5,6,6,7,7,8,8,... And this sequence is strangely not in the OEIS. (I calculated it by greedily choosing beacons to minimize the size of the largest cluster of indistinguishable vertices, so these numbers are actually upper bounds.) – Matt Jul 08 '18 at 19:45
  • @Matt Hint: your $f(n)=\min\{x \mid S(x) \ge n-1\} + 1$, where $S(n)\!=$[A000788(n)](https://oeis.org/A000788). – John McClane Jul 09 '18 at 01:58
  • @JohnMcClane: Aha! It is $f(n)=\min\{x | S(x) \ge n \}$, where $S(n)=$[A053873](https://oeis.org/A053873). – Matt Jul 10 '18 at 14:16
  • @JohnMcClane The article literally states the problem in the first sentence (see section 1, "Introduction"). If you need a hint to see the correspondence, let the gold coins be correct answers to the test, silver coins incorrect answers, and the weight of the coins be the number of correct solutions. This corresponds to "given n questions, some of which may be true (gold) or false (silver), determine which are correct (gold) in the fewest number of mock exams (weighings). It's not that difficult. – mm8511 Jul 14 '18 at 01:45
  • For a sketch of a solution, we want to find a matrix $A\in\left\{ 0,1\right\} ^{n\times m}$ such that for any distinct $x,x^{'}\in\left\{ 0,1\right\} ^{n}$, $Ax\neq Ax'$ (1). Here, $x$ is the solution vector for the exam, and the rows of $A$ correspond to your mock exams. It follows that $(Ax)_{i}$ is the number of questions you answered correctly on mock exam $i$. If (1) holds, then $A$ is invertible over $\left\{ 0,1\right\} ^{n}$, and thus we are able to obtain $x$ - the true solution for the exam. – mm8511 Jul 14 '18 at 01:56
  • Minimizing $m$ corresponds to using the fewest number of mock exams. To prove that $m\sim\frac{n}{\log n}$ suffices, one can consider choosing $A$ uniformly at random and applying the probabilistic method. Again, the details are explained in the paper I referenced in an earlier comment. – mm8511 Jul 14 '18 at 02:15
  • For clarity, I am considering $n=k⋅2^{k}$ so $\log n = k+ \log k$. If there are any issues with my solution, please let me know. Also, please try to give constructive feedback rather than blindly cast dissent. – mm8511 Jul 14 '18 at 02:20
  • One last note: The proof outline I gave shows that “for any T/F exam $E$ with $n$ questions, there exist a set of mock exams, $M$ such that, knowing the scores of each mock exam $m \in M$, uniquely identifies the solution vector $x$ of $E$. Furthermore, $|M|$ is asymptotically $n / \log n$.” This result is purely existential, and essentially says that w.h.p any ‘large enough’ set of randomly chosen mock exams will get the job done. As far as I know, derandomizing this is open in general. I would be very interested to see a constructive version of this result. – mm8511 Jul 14 '18 at 15:51
  • 3
    @mm8511 To be precise, the article of Erdős and Rényi considers two problems and this question refers to the second one, which appears only on the third page. Two sequences, $A(n)$ for the first problem and $B(n)$ for the second, are constructed. The difference between them can be seen already at the 4th term: $A(4)=3$, while $B(4)=4$. Main statements and their proofs are given separately. This is especially strange considering that only asymptotic results are obtained. Such a famous mathematician as Erdős should have noticed that, in fact, $A(n) \le B(n) \le A(n) + 1$ for any $n$. – John McClane Jul 22 '18 at 05:21
  • 2
    But the main drawback of the article is that it gives neither specific mock answer patterns nor practically useful algorithm for restoring right answers from mock exams results. I believe this question asks exactly this. The only result in this article that I've found to be useful within the given context is Theorem 4 which gives asymptotic lower bound for $B(n)$. Unfortunately, the proof of Th.4 contains a serious error, Chebyshev's inequality is too weak for the purpose it is used. But that can be avoided if either correctly transfer the proof of Th.3 or use the aforesaid bounds for $B(n)$. – John McClane Jul 22 '18 at 05:27
  • Regarding practical (not probabilistic and not asymptotic) results, they are already obtained. This does't mean that the minimal number $B(n)$ of mock exams needed to find answers to $n$ questions is known, but there is a method to find answers to $S(n-1)+1$ (see my comment above) questions with $n$ mock exams, so $B(S(n-1)+1) \le n$ for any $n$. For $n=2^k$, $S(n-1)+1=k2^{k-1}+1$ ($+1$ means that a small correction to this question's statement is needed). This result can be found at the article pointed to by bigant146. – John McClane Jul 22 '18 at 05:27
  • @bigant146 Can you be a little more specific about which article discusses this problem? I'm considering hiring a translator, but I prefer translating only the relevant article. :) – nalzok Dec 20 '19 at 07:02
  • 3
    @nalzok pp. 204-213 here https://www.mccme.ru/free-books/matpros/mpe.pdf ( К. А. Кноп, Л. Э. Медников Тест Клепцына: с компьютером и без него ) – bigant146 Dec 21 '19 at 11:28

2 Answers2


Thanks to DeepL translate, I was able to read the article in the Russian journal posted in the comments (https://www.mccme.ru/free-books/matprosf.html), and I can now give the solution. In fact, you can determine the answers to a test with $k2^{k-1}+1$ questions in only $2^k$ non-adaptive attempts.

First, let us reformulate the problem in terms of weighings. Suppose without loss of generality your first submission is a test with all answers being "yes." For any subset $A$ of questions, let the weight of $A$ be the number of questions in $A$ whose answer is "yes." Given the result of this all-"yes" submission, for any subset $A$ of questions, each of these two pieces of information can be deduced from the other:

  • The score of a test when you answer "yes" for all questions in $A$, and "no" for the other questions

  • The weight of $A$.

Therefore, I can and will state the strategy in terms of weights.

The fact that you can solve $k2^{k-1}+1$ questions in $2^k$ attempts follows from the following lemma.

Lemma: Suppose you can deduce the answers to a test with $M$ questions in $N$ attempts. Then it is possible to deduce the answers to a test with $2M+N-1$ questions in $2N$ attempts.

Proof: Given a test with $2M+N-1$ questions, divide the questions into three sets $A,B$ and $C$, where $|A|=|B|=M$, and $|C|=N-1$. By assumption, there exist $N-1$ sets $A_1,\dots,A_{N-1}$ such that you could solve a test whose question set is $A$ by submitting the all-"yes" test, and then weighing $A_1,\dots,A_{N-1}$. Similarly, there exist sets $B_1,\dots,B_{N-1}$ for solving a test whose question set is $B$. Finally, let $C=\{c_1,c_2,\dots,c_{N-1}\}$. Then the solution for the $(2M+N-1)$-question test is this:

  • Answer "yes" to all questions.
  • Find the weight of $B$.
  • For each $k\in \{1,\dots,N-1\}$: find the weights of these two sets:
    • $A_k\cup B_k\cup \{c_k\}$
    • $A_k\cup (B\setminus B_k)$.

Here is how you deduce the answers to the test. For each $k\in \{1,\dots,N-1\}$, the parity of the sum of the weights of $A_k\cup B_k\cup \{c_k\}$ and $A_k\cup (B\setminus B_k)$ and $B$ determines the answer to $c_k$. We now know the weights of the three sets $A_k\cup B_k$, $A_k\cup (B\setminus B_k)$, and $B$, which gives a simple system of equations to solve for $A_k$ and $B_k$. This gives us the information we need to deduce the answers to the $A$ questions and $B$ questions, using the assumed strategy.$\tag*{$\square$}$ That is, starting with the two-attempt solution to a two-question test, you can derive a four-attempt solution to a test with $2\cdot 2+(2-1)=5$ questions, then an eight attempt solution to a test with $2\cdot 5+(4-1)=13$ questions, and so on, in general leading to $k2^{k-1}+1$ questions in $2^k$ attempts.

The strategy can be modified extend an $N$-attempt strategy for an $M$-question test to a $2N$-attempt strategy for a $2M+r$ test for any $r\in \{0,1,\dots,N-1\}$, by ignoring some of the $C$ questions. This lets you hand the $k2^{k-1}$ question test in $2^k$ questions, as exactly asked in the OP.

Furthermore, it is easy to extend an $N$-attempt strategy for $M$ to an $(N+1)$-attempt strategy for $M+1$. Together with these two rules, you can inductively use the lemma to determine a strategy for any number of tests.

Mike Earnest
  • 57,073
  • 6
  • 49
  • 103

You set up a grid: 3x4 in case k=3 or 9x256 in case k = 9, etc. In each first mock exam you fill out only one row. The entire row. In each second (alternate) mock exam you fill out only one column. You never fill out the same column or row. Always fill with "yes" or always fill with "no", all your choices, never change once you committed to fill all rows and columns by the same "yes" (or "no") answer. IN the first example you will fill out 3 rows (each separately) and 4 columns, (each separately) which is fewer the 8. IN the second example, you fill out 9 rows and 256 columns. That is 265 mock exams, which is fewer than 512. Both cases we fulfilled the "minimum" required exams. When we guess "wrong" on the mock exam, then we got a "no" (if our choice was to fill out only "Yes"-es in the mock exams.) Simply match up the rows and columns where there is a non-null number of score is given for the given row and the given column by the prof for our faulty answers.

And bob is your uncle.

This is a solution. I am not sure if this constitutes a proof, or how many more steps is required to make this into a proof.

My observation is that the original question of this problem resembles the society board game "Mastermind". This is a simplified version of it, with fewer colours of pegs (if you want to think of this problem that way) but with larger boards, but the same principle applies.