A factory inspects synthetic batches for a particular defect. Direct inspection tests every item separately and costs one inspection per item. Consider another precise protocol: combine k items into a pool and test that pool once. A perfect negative result certifies all k items good. A positive result triggers individual tests of all k items, at one inspection each. There are no false results in this teaching model.
Assume each item is independently defective with probability p. Independence is an assumption about the joint distribution, not a conclusion from a shared defect rate. Pooling might save work when most pools are negative, but positive pools cost more than direct inspection. Before calculating, predict which effect dominates for small p and for p near one.
Predict
A pool has two possible costs. A negative pool costs 1; a positive pool costs 1+k. Predict the negative probability for k=2 and p=1/4. It is not 1−2p: that expression double-counts the case in which both items are defective when computing its complement.
The correct negative probability is (3/4)²=9/16. Thus positive probability is 7/16. Record the expected pool cost, and then divide by the number of items before comparing it with the direct baseline. Comparing a pool total with a per-item baseline would mix different denominators.
Experiment
The following table enumerates the four patterns for the worked pair. G means good and D means defective. The probabilities need not be equal.
Pattern
Probability
Pool result
Inspections
GG
9/16
Negative
1
GD
3/16
Positive
3
DG
3/16
Positive
3
DD
1/16
Positive
3
Expected total work is (9+9+9+3)/16=15/8 inspections per pool, or 15/16 per item. A particular positive pool still costs three inspections for two items. The expectation averages over defect configurations; it is not a guarantee of savings on every realized batch.
Use the explorer’s separate default p=0.02 and k=8. Predict whether doubling the pool size improves the cost, then compare all feasible equal-pool sizes for its fixed 64-item batch. A size that does not divide 64 still has a valid standalone-pool formula, but cannot partition that batch into equal pools without an additional remainder rule.
Compare expected inspection work
Each item independently has a defect with probability p. A perfect pool test costs one inspection; if positive, inspect every one of its k items at cost one each. This fixed protocol includes the redundant second test when k=1. These are teaching assumptions, not measured factory performance.
Positive-pool probability 1−(1−p)^k = 0.149237. Expected inspections per pool: 1+k·P(positive) = 2.193896. Dividing by k gives 0.274237 per item, versus direct inspection baseline 1. This is an expectation over random defects, not a guarantee for every batch.
Approximation 1/k+kp = 0.285. Its excess over the formula is 0.01076302; the mathematical bound is 0≤excess≤k(k−1)p²/2 = 0.0112. All displayed numbers are rounded floating-point evaluations. The analytic inequality, rather than this numerical comparison, supplies the guarantee; tiny roundoff in a computed excess is displayed as zero.
Pool size 8 divides 64, so it can partition a 64-item batch into equal pools.
All equal-pool sizes for 64 items at the current p; direct inspection always costs 1 per item
Pool size
Pools
Expected work per item
Compared with direct inspection
1
64
1.02
Higher
2
32
0.5396
Lower
4
16
0.3276318
Lower
8
8
0.274237
Lower
16
4
0.3387023
Lower
32
2
0.5073669
Lower
64
1
0.7411715
Lower
Smallest computed pooling cost among these divisors: 0.274237, at k=8. This is below the direct baseline. Comparisons use unrounded calculations; a displayed rounding tie does not by itself certify an exact tie.
Predict the p=0 and p=1 results before changing the probability. Then compare k=4 and 8 at p=0.02. The comparison includes only the stated two-stage protocol and equal pools; it does not optimize arbitrary inspection trees, incomplete remainder pools, noisy tests or real operating costs. No state is saved and no completion is awarded.
Try p=0 and p=1. At zero, every pool is negative and cost per item is 1/k. At one, every pool triggers individual follow-up and cost per item is 1+1/k. Also inspect k=1: the formula gives 1+p, because this stated protocol tests a positive singleton twice. Removing that redundant test would be a different protocol. Keeping its cost visible prevents an unnoticed change of rules at a boundary.
Understand
Let I be 1 if the pool is positive and 0 otherwise. Its work is 1+kI. Independence gives P(I=0)=(1−p)^k. Linearity of expectation therefore gives
Expected pool work = 1+k[1−(1−p)^k].
Dividing by k gives c(k)=1/k+1−(1−p)^k inspections per item. For a batch of N independent items split into equal pools, k must divide N. Multiplying the pool expectation by N/k gives total expected work Nc(k). Testing each item directly costs N. The comparison assumes equally costly perfect tests and ignores any extra handling costs; those assumptions define the calculation.
For small p, a useful approximation is c(k)≈1/k+kp. We can bound its error rather than merely label p “small.” Let X count defective items. For every nonnegative integer x,
0≤x−1 if x is positive, and this difference is at most x(x−1)/2; at x=0 the difference is zero.
More uniformly the middle expression is x minus the indicator of x≥1. Taking expectations gives kp−P(X≥1). The quantity X(X−1)/2 counts unordered pairs of defective items. Each pair has probability p² by independence, so its expectation is k(k−1)p²/2. Hence
0≤kp−[1−(1−p)^k]≤k(k−1)p²/2.
The approximation overestimates cost, with a stated size-dependent error. For real k>0 and p>0, the identity
1/k+kp−2√p = (1/√k−√(kp))²
shows its continuous minimum occurs at k=1/√p and has value 2√p. The factor two matters. This is not yet an exact integer decision: compare the original formula on all permitted divisors of N, and include direct inspection as a separate alternative. Approximation error can change which candidate wins.
A different defect model changes the negative probability. If a batch has exactly D defective items among N and a pool is a uniformly chosen k-subset, the negative probability is C(N−D,k)/C(N,k). Here C(n,k) counts k-subsets and is zero when k exceeds n. Randomly grouping a fixed-total population does not make its defect indicators independent. Different pools are dependent too, but symmetry and linearity still let us add their marginal expected costs. For example N=8,D=2,k=2 gives negative probability15/28 and per-item cost1/2+13/28=27/28, whereas the iid model with the same marginal p=1/4 gave15/16.
Apply
Change the inspection protocol again. Let N=2^h items occupy the leaves of a complete binary tree. Test the full root pool. Whenever a nonsingleton pool is positive, test both children. A singleton test stops, with no redundant repeat. This is a specified algorithm, not the flat protocol with its name changed.
At level ℓ≥1 there are 2^ℓ possible tests. A particular node is tested exactly when its parent is positive. A positive parent implies all its ancestors are positive, so the parent was indeed reached. Its size is N/2^(ℓ−1). By linearity,
Expected tests = 1 + sum, for ℓ=1 through h, of 2^ℓ[1−(1−p)^(N/2^(ℓ−1))].
Test this formula at N=2,p=1/2: the root costs one and both singleton children are tested with probability3/4, giving5/2 expected tests, more than direct inspection’s two. At p=0 only the root is tested; at p=1 every node is tested, totaling2N−1. For N=1 the sum is empty and the root is the sole test. Explain why using the child’s own positive probability would undercount tests: a good child is still inspected when its sibling makes their parent positive.
A changed dependence case
Suppose every item in a pool is defective together with probability p and otherwise all are good. The positive probability is p, not1−(1−p)^k, although each item still has marginal defect probability p. Flat-protocol cost per item becomes1/k+p. Shared marginals do not determine expected work without a joint model. Neither this model nor the independent model establishes measured reliability for real inspections.
Continue
In the practice, specify the test rule, defect model and feasible sizes before optimizing. Keep expected work, realized work and defect-detection reliability separate. For recursive inspection, define exactly which event triggers each node’s test, then add its indicator expectation; independence between those test events is unnecessary. The fixed numerical explorer supplies comparisons for one bounded model, while the written proofs explain which changes require a new calculation.
Apply · explain · revise
Practice and reasoning
Drafts save locally as you type. Reveal worked solutions when useful; the site remembers that exposure. Automatic matches check the requested answer, while written arguments require review against the rubric.
Derive the expected cost for a pool of k independent items with defect probability p under the stated protocol. Compare per-item cost to direct inspection. Check p=0,p=1 and k=1 explicitly. Why is replacing k=1 by cost1 a change of algorithm?
Structure your argument and preserve revisions
These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.
Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.
There are N=6 independent items with p=1/4. Compare every equal-pool size dividing6 and direct inspection. Separately minimize the continuous approximation1/k+kp for p>0 and real k>0 without calculus. Explain why its minimizer need not be feasible or exactly optimal.
Structure your argument and preserve revisions
These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.
Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.
Let X be the number of defective items in a pool. Prove0≤kp−[1−(1−p)^k]≤k(k−1)p²/2 under independence, by comparing X with the indicator of X≥1. Give the bound for k=5,p=1/10 and describe what it says about1/k+kp. Does it certify the same optimizer for every candidate size?
Structure your argument and preserve revisions
These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.
Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.
A batch has N=12 items with exactly D=2 defects and is randomly partitioned into equal pools of size3, uniformly with respect to item positions. Derive the probability a chosen pool is negative and the expected cost per item. Compare with the iid formula at p=1/6. Explain whether dependence between different pools invalidates the expectation calculation.
Structure your argument and preserve revisions
These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.
Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.
Define a different protocol for N=2^h iid items: test the full root pool; whenever a nonsingleton pool tests positive, test both equal children; singleton tests stop without repetition. Derive expected total tests by tree levels. Evaluate N=4,p=1/2, compare the flat two-stage protocol, and check p=0,p=1,N=1.
Structure your argument and preserve revisions
These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.
Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.
Keep perfect tests and the flat protocol, but suppose a whole pool is defective together with probability p and otherwise every item is good. Each item still has marginal defect probability p. Derive expected per-item cost and compare it with the iid cost at k=4,p=1/4. Explain why a correct expected-cost comparison alone does not establish acceptable performance for noisy tests or a guaranteed realized cost.
Structure your argument and preserve revisions
These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.
Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.
Reflect and continue
Before marking this lesson complete, explain one key idea without the worked solution and identify a condition that matters. Marking complete records participation, not independent mastery.