The short answer: repair the count, do not change the formula
For Euclid 2027 stars and bars with upper bounds, the reliable approach is to start from the unrestricted count and then apply exactly one repair strategy. Stars and bars counts the nonnegative integer solutions of x₁ + x₂ + … + xk = n as C(n + k − 1, k − 1). That formula assumes no variable is capped. Once you add 0 ≤ xi ≤ b, the formula is still the correct starting point, but you must remove the tuples that break a cap. There are two clean ways to do it: substitute deficits yi = b − xi and recount, or keep the unrestricted total and repair it with inclusion–exclusion. Both are valid; they differ in bookkeeping, not in mathematics.
The choice is practical. Use deficits when the caps are uniform and the total n sits close to k·b, because the complement sum becomes small. Use inclusion–exclusion when the caps differ, or when only one or two variables are bounded, because a single violation set is easy to count and the sign pattern stays short. If both look short, do both — the second computation is your check.
This topic sits inside a wider syllabus. Hanlin’s 17 October 2026 article, translated as 2027 Euclid Mathematics Contest Registration Is Open — The Mathematical Evidence Admissions Officers Actually Read, lists permutations, combinations and probability among the knowledge areas associated with Euclid preparation. The contest itself, according to the University of Waterloo CEMC, is ten questions in 2.5 hours for 100 marks, written on 6 April 2027 in North and South America and 7 April 2027 elsewhere, with an ordering deadline of 11 March 2027.
Why the unrestricted formula overcounts
Take the running illustration of this article, clearly labelled as a teaching illustration rather than an actual Euclid problem: count the nonnegative integer solutions of
x₁ + x₂ + x₃ = 10, with 0 ≤ xi ≤ 4 for each i.
Ignoring the caps gives C(12, 2) = 66 tuples. That 66 includes tuples such as (10, 0, 0), (7, 3, 0) and (5, 5, 0), none of which is allowed. The caps eliminate a large fraction of the total, so the answer is far below 66.
The common error is not forgetting the caps — it is subtracting the bad cases carelessly. A student computes the number of tuples with x₁ ≥ 5, finds 21, multiplies by three for the three variables, and writes 66 − 63 = 3. That reasoning treats the three violation sets as disjoint. They are not. A tuple with x₁ = 5 and x₂ = 5 violates two caps simultaneously, so it is deducted twice by that subtraction and must be added back once. Any count that subtracts overlapping sets without adding intersections is unbalanced, and the same error appears whenever a bound creates a second, overlapping layer of invalid cases.

Method one: the deficit transformation
Define yi = 4 − xi for i = 1, 2, 3. Because each xi lies in {0, 1, 2, 3, 4}, each yi lies in {0, 1, 2, 3, 4}. Adding the three equations gives
y₁ + y₂ + y₃ = 12 − (x₁ + x₂ + x₃) = 12 − 10 = 2.
The mapping x ↦ y is a bijection in both directions: given any solution y with sum 2 and yi ≥ 0, setting xi = 4 − yi returns a valid solution, and the cap xi ≤ 4 is automatic because yi ≥ 0. The extra condition yi ≤ 4 is also automatic, since a sum of 2 cannot give any yi above 2. So the problem becomes an unrestricted stars-and-bars count: C(2 + 2, 2) = C(4, 2) = 6.
The six solutions, listed to verify the bijection, are (4, 4, 2), (4, 3, 3), (4, 2, 4), (3, 4, 3), (3, 3, 4) and (2, 4, 4). Each has entries at most 4 and sums to 10, and the list is exhaustive: with x₃ = 4 there are three, with x₃ = 3 there are two, with x₃ = 2 there is one, and x₃ ≤ 1 is impossible because 4 + 4 + 1 < 10.
The transformation stays clean when the caps are uniform and the complement sum k·b − n is small enough that the new upper bounds do not bind. If the caps differ, define yi = bi − xi for each i. Then the target becomes Σbi − n, but each yi carries its own bound bi, and those bounds may or may not bind. The deficit route is still valid, but it is no longer automatically an unrestricted stars-and-bars count.
Method two: inclusion–exclusion over the violations
Let A₁ be the set of nonnegative solutions of x₁ + x₂ + x₃ = 10 with x₁ ≥ 5, and define A₂ and A₃ similarly. For A₁, substitute x₁′ = x₁ − 5 ≥ 0, giving x₁′ + x₂ + x₃ = 5, so |A₁| = C(7, 2) = 21. By symmetry each single violation set has 21 elements, totalling 63.
Now the overlaps. For A₁ ∩ A₂, both x₁ ≥ 5 and x₂ ≥ 5 leave x₃ = 10 − x₁ − x₂ ≤ 0, so x₁ = x₂ = 5 and x₃ = 0 — exactly one tuple. The same holds for A₁ ∩ A₃ and A₂ ∩ A₃, so the pairwise term is 3. For A₁ ∩ A₂ ∩ A₃, the sum would be at least 15, which exceeds 10, so the triple intersection is empty. Therefore
valid tuples = 66 − 63 + 3 − 0 = 6.
This matches the deficit count exactly. Note what the inclusion–exclusion line is doing: 63 is not the number of bad tuples, it is the sum of the sizes of three overlapping sets. The signed sum 66 − 63 + 3 is the count of tuples in none of the three sets, which is precisely the count of valid tuples.
Diagnostic: which method is cleaner here?
| Situation | Better first method | Reason |
|---|---|---|
| All caps equal, and n is close to k·b | Deficit | The complement sum k·b − n is small, so the recount is short |
| Caps differ across variables | Inclusion–exclusion | Deficits produce different targets and lose symmetry |
| Only one variable is capped | Inclusion–exclusion | One violation set, no overlaps to repair |
| n ≤ min bi | Neither — plain stars and bars | No variable can exceed n, so no cap can bind |
| Both routes look short | Either, then the other | A second route localises an arithmetic slip |
The diagnostic is worth running before writing, because the wrong choice turns a six-line solution into a page of casework. It is a decision about presentation cost, not about correctness — both methods count the same set.
Writing the count for full-solution marks
CEMC states on its Euclid contest page that each submitted solution is assessed for completeness, clarity and presentation style, and that a correct solution, poorly presented, will not earn a full score for that problem. A bounded count exposes exactly where presentation carries marks. Write four things explicitly: the substitution you are making, the bijection claim and why it is invertible, the counting formula with its inputs, and the treatment of overlap.
A defensible deficit write-up says: “Set yi = 4 − xi. This is a bijection between solutions of the original system and nonnegative solutions of y₁ + y₂ + y₃ = 2, since xi = 4 − yi recovers the original and the caps are satisfied automatically. The number of such solutions is C(4, 2) = 6.” A defensible inclusion–exclusion write-up states the three single-violation counts, then states that tuples violating two caps exist and are counted in the pairwise term, then evaluates. What should not appear is an unexplained subtraction: “66 − 63 + 3” without the sentence identifying the last term is a hole a marker can point to.
For the broader habit of self-marking against a written standard, the site’s guide to How to Mark Your Own Euclid Paper: A Self-Scoring Protocol for Papers With No Solution Set sets out a self-scoring protocol; the companion piece on Euclid Counting Cases: Prove Your Cases Are Complete and Do Not Overlap handles the case-split side of the same discipline. This article covers the complementary risk: a count where the cases overlap by construction and the overlaps must be added back.
A second check you can run in four minutes
Change the problem slightly and recount both ways. Teaching illustration: count nonnegative integer solutions of x₁ + x₂ + x₃ + x₄ = 8 with 0 ≤ xi ≤ 3.
Inclusion–exclusion: unrestricted C(11, 3) = 165. A single cap violation, say x₁ ≥ 4, leaves x₁′ + x₂ + x₃ + x₄ = 4, so C(7, 3) = 35; four such sets give 140. Two simultaneous violations leave a residual sum of 0, contributing one solution per pair, and there are C(4, 2) = 6 pairs. Three violations would need a sum of at least 12, which is impossible. Total: 165 − 140 + 6 = 31.
Deficit check: set yi = 3 − xi, so y₁ + y₂ + y₃ + y₄ = 12 − 8 = 4 with each yi between 0 and 3. Unrestricted gives C(7, 3) = 35; the excluded cases have some yi = 4 with the rest zero, which is exactly 4 possibilities. Again 35 − 4 = 31. Agreement between two structurally different routes is far stronger evidence than re-reading one line.
This is the routine worth building before April: change one parameter, solve by the method you did not use the first time, and compare. For which counting ideas have actually appeared on recent papers, the site’s survey of Euclid Counting and Probability for 2027: Where the Counts Hid on the 2025 and 2026 Papers is a more honest guide than a general topic list.
What to bring to a preparation consultation
A consultation about counting is only useful if the tutor can see your written reasoning, not just your final number. Bring one bounded-count solution, written out in full, with the substitution or the inclusion–exclusion line visible. Then ask two specific questions. First: is the bijection I claimed actually invertible, and does it cover every solution? Second: where in my write-up did I justify the overlap term rather than assert it? Those two questions surface most of the lost presentation marks in this topic.
It also helps to say what you already tried. “I got 3 by subtracting 21 three times” is far more informative than “I don’t understand this topic”, because it identifies the double-subtraction error directly. Formal contest format, permitted aids and award rules should always be read on the CEMC’s own Euclid page rather than from a coaching summary, since rules can change between seasons.
Nothing here predicts a score or an outcome. The claim is narrower and checkable: when a count carries upper bounds, name the repair method before you compute, and verify with the other method before you trust the number.
General event background is available at Event background.

Frequently Asked Questions
Does the deficit method always work for bounded counts?
It works whenever substituting yi = b − xi produces a genuine bijection onto a set you can count. Uniform caps are the clean case, because every variable flips to the same small target sum. With different caps you get different ranges on each yi, so you are counting a bounded problem again with a smaller total — sometimes still easier, but no longer automatic. When the complement sum (k·b − n for uniform caps, or Σb_i − n in general) is large, inclusion–exclusion is usually shorter.
Why is subtracting the single-violation counts three times wrong?
Because the three violation sets overlap. In the illustration, x1 ≥ 5 and x2 ≥ 5 can happen at the same time, for example at (5, 5, 0). That tuple belongs to two of the sets, so it is deducted twice in the crude subtraction of 63 and must be added back once. Inclusion–exclusion handles this with the signed pattern 66 − 63 + 3, where 3 is the number of tuples violating two caps; the triple overlap is empty here because three violations would need a total of at least 15.
Can I just list all the solutions instead of using a formula?
For a total as small as 10 with caps of 4, listing is feasible and worth doing as a check — the six solutions here can be grouped by the value of x3. But a list alone is weak full-solution writing: you must argue that the list is complete, and the method does not scale when the total rises or the number of variables grows. Use enumeration to verify a count, and use a bijection or inclusion–exclusion to justify it.