How many strings of length three can be formed from L, R, and O?
02Information and logical testingwarm upNew
A legal split turns one group into two. Starting with one group, how many such splits create eight groups?
Core idea
An information bound limits the number of cases a decision tree can distinguish, but you also need a feasible test scheme. For two eggs and m drops, decreasing gaps cover at most m(m+1)/2 floors.
Worked example
A card has a letter on one side and a number on the other. Visible cards show A, D, 4, and 7. Which must be turned to test “every vowel has an even number”?
Let V mean that a card's letter is a vowel, and E that its number is even. The rule is the implication . It fails only for a vowel paired with a non-even number. Check the visible cards that could belong to that counterexample: a visible vowel or a visible odd number.
More practice
Solve these questions here. More practice counts separately from lesson completion.
Two identical glass balls break when dropped from floor X or higher and survive lower drops. You have a 100-floor building. Find the smallest worst-case number of drops and give a strategy.
Modeling assumptions: Allow X=101 to mean that neither ball breaks anywhere in the building; the same strategy works if a breaking floor within 1–100 is promised.
Four Cards
Practice
1498Information and logical testingcoreNew
Consider four cards on a table. Each card has a number on one side and a colored patch on the other. The visible sides display: 3, 8, red, and brown. To verify the claim, "if a card has an even number, then its opposite side is red," which card(s) should you flip?
Vending Machine
Practice
1525Information and logical testingcoreNew
A vending machine offers three types of snacks - Chips, Candy, or Surprise. However, the machine's labels have been mixed up, so each button does not deliver the snack it claims to. If each snack costs $1, what's the least amount of money you must spend to determine which button dispenses which snack?
Modeling assumptions: Each dispensing function is assigned to exactly one button, and the assignment remains fixed. Report the cost in dollars.
Three bags contain all apples, all oranges, and a mixture. Their labels “apple”, “orange”, “mix” are all wrong. Identify all bags with the minimum number of sampled fruits.
Counterfeit coins I
Practice
1229Information and logical testingcoreNew
Ten bags each contain 100 identical coins. Nine bags have 10-gram coins; one has all 9-gram or all 11-gram coins. Identify that bag and whether it is heavy or light with one exact digital weighing.
Counterfeit coins II
Practice
This question requires access to all of its assigned lessons.
This question requires access to all of its assigned lessons.
Found a mistake in this lesson?
V⇒E
violation=V∧¬E.
Turn A and 7. A could hide an odd number, directly violating the rule. The odd 7 could hide a vowel, also violating it. D may have either parity, and the even 4 may have either letter type. Testing a rule requires seeking counterexamples, not merely confirming examples.
Methods and variations
A. Look for the only falsifying case
The implication P⇒Q fails only when P is true and Q false. Its contrapositive ¬Q⇒¬P is equivalent, but the converse is not. A test should inspect cases that could hide a violation.
To disprove “if P, then Q,” you need both parts of one counterexample: P occurs and Q does not. Symbolically,
¬(P⇒Q)=P∧¬Q.
Observing Q alone is uninformative about whether P occurred: a rule saying all squares are rectangles does not say all rectangles are squares. Observing ¬P also cannot violate the rule. This explains why checking a universal rule focuses on possible counterexamples, whereas collecting confirming examples can leave the rule untested.
Practice
03Information and logical testingcoreNew
Cards show E, K, 2, and 9, with a letter on one side and number on the other. Which must be turned to test “every vowel has an even number”?
04Information and logical testingcoreNew
A record has a product type on one side and inspection status on the other. The rule is “every fragile product was inspected.” Visible sides read fragile, sturdy, inspected, and uninspected. Which records need checking?
05Information and logical testinghardNew
A rule says every approved account has a verified address. You find a verified address. Does the rule establish that the account is approved?
B. Separate an outcome bound from a feasible weighing scheme
A balance has three outcomes, so w weighings distinguish at most 3w cases. For a known-heavy object, split candidates into three groups; an unknown heavy-or-light defect needs identity-and-direction hypotheses and physically balanced pans.
The following fixed schedule works for twelve unknown-direction balls. Read each ball’s L/R/O column as its heavy outcome, and exchange L with R for a light outcome; equal pan sizes and 24 distinct signed columns establish feasibility.
Figure4 First compare two groups of three; a balance isolates the unweighed group. Within the indicated group, compare two coins: left heavy or right heavy identifies one, and a balance identifies the third. This feasible construction attains the nine-leaf information bound when exactly one coin is known to be heavy.
If a test has at most three outcomes, each node in its decision tree has at most three children. After w tests there are at most 3w leaves. Distinct hidden cases must end at distinct leaves, so for H hypotheses,
3w≥H,w≥⌈log3H⌉.
For one known-heavy coin, weighing equal groups makes the heavier group suspect; a balance identifies the unweighed group. For an unknown direction, coin identity alone is insufficient: “coin A heavy” and “coin A light” are different hypotheses. An unbalanced first weighing rules out every off-scale coin and permits only heavy coins on the heavier side or light coins on the lighter side.
The fixed table implements an encoding: a heavy coin produces its listed column, and a light coin produces the reversed column. Unique signed columns make decoding possible. Equal numbers on the pans cancel the unknown normal weight. Both properties are required; a large enough number of theoretical outcome strings does not guarantee a realizable experiment.
Practice
06Information and logical testingcoreNew
One of twenty-seven coins is known to be heavier. How many balance weighings suffice, and why can two not suffice?
07Information and logical testingcoreNew
A diagnostic test reports one of three outcomes and can distinguish any chosen three groups of fault causes. There are eighteen possible causes. What is the minimum worst-case number of tests?
08Information and logical testinghardNew
Among 12 otherwise identical balls, one is heavier or lighter, with unknown direction. Using a balance that reports only heavier, lighter, or equal, identify the ball and its direction in three weighings.
C. Exploit a label known to be false
With pure-A, pure-B, and mixed containers, all labels wrong, sample the container labeled mixed. It must actually be pure, and the remaining assignments follow by elimination. List possible worlds explicitly if “mixed” instead means a separately identifiable third product.
A sample of A from a genuinely mixed container would not identify its composition, since the next sample might be B. The false “mixed” label supplies the missing certainty: that container must be pure. Once its true type is known, the other pure label cannot retain its stated type, so elimination fixes the remaining two. The information comes from the combination of the observation and the promise that every label is wrong.
Practice
09Information and logical testingcoreNew
Three bags contain only red, only blue, or both colors. They are labeled red, blue, mixed, and every label is wrong. One ball from the mixed-labeled bag is red. Identify all three bags.
10Information and logical testinghardNew
If only two of the three labels are guaranteed wrong, does one red draw from the mixed-labeled bag necessarily identify it as pure red?
D. Budget the worst remaining search after a failure
With two eggs and m drops, the first-egg gaps must be at most m,m−1,…,1. Their sum m(m+1)/2 is both a coverage bound and an achievable schedule; after a break, test the intervening floors with the remaining egg.
For e eggs the capacity satisfies F(e,m)=F(e−1,m−1)+1+F(e,m−1), with zero capacity for zero eggs or drops. Include the possibility that every floor is safe.
Figure3 Test the first egg at 14, 27, 39, 50, 60, 69, 77, 84, 90, 95, 99, and finally 100. Before the final truncation the gaps decrease by one. If the kth test breaks, at most 14 − k lower unchecked floors remain for the second egg. Thus no outcome needs more than 14 drops, including the all-safe case.
Suppose the first test is at floor x. If the egg breaks, the other egg must test the x−1 lower floors one by one. Including the first drop costs x drops, so a budget of m requires x≤m. After a successful drop, one fewer attempt remains, forcing the next gap to shrink by one. Hence
F(2,m)=j=1∑mj=2m(m+1).
More generally, a test separates the unknown boundary into floors below and above it. A break leaves e−1 eggs and m−1 drops below; survival leaves e eggs and m−1 drops above. The tested floor adds one:
F(e,m)=F(e−1,m−1)+1+F(e,m−1).
Choose the smallest m whose capacity covers the building. This balances the worst possible remaining work, including a first break and no break at all.
Practice
11Information and logical testingcoreNew
Two eggs must locate the highest safe floor in a fifteen-floor building, possibly floor fifteen. Find the minimum worst-case drops.
12Information and logical testingcoreNew
A component can be tested at integer stress levels 1 through 21. Above its unknown limit it breaks permanently. With two identical components, how many tests guarantee finding the largest safe level?
13Information and logical testinghardNew
A proposed two-egg search starts at floor 50 of a hundred-floor building. Why does the usual binary-search claim fail?
E. Encode cases in an exact weight deviation
For one defective bag, take i coins from bag i; a known per-coin deviation gives a signed bag-index code. For independent light/normal/heavy bags, use counts 1,3,9,…: balanced ternary digits −1,0,1 uniquely encode every assignment.
At the largest differing place, its power of three exceeds twice the sum of all smaller places. Exact resolution and enough coins are required; a scale with only balance outcomes is a different instrument.
Let a normal coin weigh w0 and the known defect change weight by δ. Taking i coins from bag i gives total expected weight w0∑ii. If only bag j is defective, the measured deviation is jδ, so division by δ identifies j.
For independently light, normal, or heavy bags, let si∈{−1,0,1}. Counts 3i−1 give
δW−W0=i=1∑nsi3i−1.
Two different assignments cannot have the same code: at their highest differing position, the difference is at least 3k, while all smaller differences total at most 2∑j=0k−13j=3k−1. Thus they cannot cancel. This argument also explains why measurement precision is part of the model.
Practice
14Information and logical testingcoreNew
Four bags normally hold 10 g coins; exactly one instead has all 9 g or all 11 g coins. Weigh 1,2,3,4 coins from bags 1,2,3,4. The total is 97 g. Which bag is defective?
15Information and logical testinghardNew
Three bags independently contain 9 g, 10 g, or 11 g coins. Would taking 1,2,4 coins guarantee decoding all three types from the total weight?
Lesson check
16Information and logical testingcoreNew
Two identical eggs must determine the highest safe floor in a ten-floor building, allowing every floor to be safe. Find the minimum worst-case drops.
17Information and logical testingcoreNew
One of nine coins is known to be heavier. Show how two balance weighings identify it.
18Information and logical testingcoreNew
Explain why seeing Q is not enough to establish P when the rule is P⇒Q.
19Information and logical testingcoreNew
Five bags contain coins weighing 9, 10, or 11 grams within each bag. You take 1, 3, 9, 27, 81 coins. What does a weight deviation of 76 grams mean?
20Information and logical testingcoreNew
A building rule says everyone entering the cold room wears gloves. You can check people known to be entering, not entering, wearing gloves, or not wearing gloves. Which categories can reveal a violation?