Ugly Duckling Theorem Calculator

Enter the size of your object universe (n) and an optional predicate rank (r) to see exactly how many of the 2ⁿ possible predicates are shared by any two objects — the constant count behind Watanabe's Ugly Duckling Theorem.

Quick Facts

Total predicates
2ⁿ
Every subset of the n-object universe defines one predicate, so there are 2ⁿ possible predicates in all.
Predicates shared by any pair
2ⁿ⁻²
Fixing any two objects as members, the rest are free to vary — the same count for every possible pair.
Shared fraction
2ⁿ⁻² ÷ 2ⁿ = 1/4
Exactly 25% of all predicates are shared by any given pair, no matter how large n is.
Rank-r shared count
C(n-2, r-2)
Restricting to predicates true for exactly r objects still gives an identical count for every pair.

Your Results

Calculated
Total Predicates (2ⁿ)
-
All possible predicates over n objects
Shared by Any Pair (2ⁿ⁻²)
-
True for both objects of any pair, all ranks
Rank-r Predicates (C(n,r))
-
Predicates true for exactly r of the n objects
Rank-r Shared by a Pair (C(n-2,r-2))
-
Rank-r predicates true for both objects of any pair

Ready

Enter the universe size n (and optional rank r), then press Calculate.

How the Ugly Duckling Theorem Works

The Ugly Duckling Theorem, proved by Satosi Watanabe in 1969, is a foundational result in pattern recognition and machine learning theory. It shows that if every logical predicate (Boolean property) over a set of objects is counted equally, any two distinct objects share exactly the same number of predicates as any other two objects — so no pair can be called objectively "more similar" unless some predicates are given more weight than others.

Formula and method

Model each of the n objects in your universe as elements of a finite set. A predicate is any Boolean-valued property defined on that set — equivalently, each predicate corresponds to a unique subset of objects for which it is true. Because each of the n objects is independently included or excluded, there are exactly 2ⁿ distinct predicates in total. A predicate has rank r if it is true for exactly r of the n objects; the number of rank-r predicates is the binomial coefficient C(n, r), since you are choosing which r objects make it true. Now pick any two specific objects, i and j. A predicate is "shared" by both if its subset contains both i and j; since i and j are fixed as members, the remaining n − 2 objects can each independently be in or out, giving 2ⁿ⁻² shared predicates — a count that does not depend on which i and j you chose. Restricting to rank r, you must also choose the remaining r − 2 true objects from the other n − 2, giving C(n − 2, r − 2) shared rank-r predicates. This calculator evaluates all four quantities for the universe size and rank you enter.

Common sources of error

  • Confusing "rank" with "count": rank r is how many objects a single predicate is true for; it is unrelated to how many predicates exist overall — those are C(n, r) many.
  • Forgetting r ≤ n: a predicate cannot be true for more objects than exist in the universe, so r above n is undefined.
  • Assuming raw counts imply similarity: because every pair shares 2ⁿ⁻² predicates, raw predicate-counting can never rank one pair as "more similar" than another — that requires assigning weights to predicates first.

Checking your result

A quick sanity check: the shared-predicate count divided by the total predicate count should always equal exactly 1/4 (25%) for any n ≥ 2 — if your ratio comes out different, re-check your inputs. You can also verify small cases by hand: with n = 3 objects {A, B, C}, there are 2³ = 8 total predicates (the subsets ∅, {A}, {B}, {C}, {A,B}, {A,C}, {B,C}, {A,B,C}); exactly 2 of them — {A,B} and {A,B,C} — contain both A and B, matching 2ⁿ⁻² = 2¹ = 2.

Applications

Watanabe's theorem underlies a core lesson in machine learning and pattern recognition: clustering, classification, and similarity metrics are never purely "data-driven" — they always encode an implicit choice of which features (predicates) matter more than others. It is commonly cited in discussions of feature selection, the "no free lunch" theorems for learning algorithms, and philosophy-of-science debates about natural kinds and induction.

Frequently Asked Questions

What is the Ugly Duckling Theorem?
Proved by Satosi Watanabe in 1969, it states that if every logical predicate over a set of objects is treated as equally important, any two distinct objects share exactly the same number of predicates as any other two objects — so no pair can be called objectively more similar without first weighting which predicates matter.
How many predicates do any two objects share?
Out of 2ⁿ total predicates possible over an n-object universe, exactly 2ⁿ⁻² are true for both objects in any given pair — this count is the same no matter which two objects you pick.
Why is it called the "Ugly Duckling" theorem?
It references Hans Christian Andersen's tale: by pure predicate-counting, the ugly duckling shares just as many predicates with a swan as two swans share with each other. Only by weighting some predicates as more relevant (e.g., feather shape or color) does the intuitive notion that "swans look like swans" emerge.
What does "predicate rank" mean in this calculator?
A predicate has rank r if it is true for exactly r of the n objects. There are C(n, r) rank-r predicates in total, and C(n − 2, r − 2) of them are shared by any two given objects.