All Relations Are Created Equal

How many distinct equivalence relations are there on a set of 6 elements?


The answer is 203.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

3 solutions

Ivan Koswara
Feb 11, 2016

This is exactly the definition of Bell numbers B n B_n . We're seeking B 6 = 203 B_6 = \boxed{203} .

A simple recurrence relation is B 0 = 1 B_0 = 1 and

B n + 1 = k = 0 n ( n k ) B k \displaystyle B_{n+1} = \sum_{k=0}^n \binom{n}{k} B_k

This can be proven as follows. Given a set of n + 1 n+1 elements, fix an element e e . Consider the partition (the equivalence class) that includes e e . Suppose it contains n k n-k elements besides e e itself. There are ( n n k ) = ( n k ) \binom{n}{n-k} = \binom{n}{k} ways to select these n k n-k elements, and the remaining k k elements can be partitioned in B k B_k ways by definition. Summing over all k k gives the above identity.

We can thus use the identity above to generate the Bell numbers 1 , 1 , 2 , 5 , 15 , 52 , 203 , 1, 1, 2, 5, 15, 52, \boxed{203}, \ldots .

Thanks for the solution. It was a nice one

Agnishom Chattopadhyay - 5 years, 4 months ago

Log in to reply

a nice problem stated

Atharva Bagul - 5 years, 3 months ago

what is the concept of bell numbers?

Atharva Bagul - 5 years, 3 months ago

Could u check ur solution again Pls... I seem to be getting 213...Though your logic is really nice... I did it similarly and don't understand why I am getting it wrong:-(:-(

Nisarg Sheth - 5 years, 4 months ago

Log in to reply

If you state your working, then others can point out the mistake that you made.

Calvin Lin Staff - 5 years, 3 months ago
Ww Margera
Feb 13, 2016

Let the number of equivalence relations on n elements that divide them into k equivalence classes be P(n, k).

Of course, P(n, 1) = 1 and P(n, n) = 1.

Otherwise, look at how this would be obtained from an equivalence relation on n-1 elements. From a relation that divides into k-1 classes, there is only one way to get one that divides into k classes (the new element must be a new class by itself). From a relation that divides into k classes, there are k ways to do this (choose the existing class the new element must become part of). It is easy to see that these are the only two cases.

So P(n, k) = P(n-1, k-1) + k * P(n-1, k).

Now we can just solve this manually by dynamic programming.

Here are the values of P for different values of n till 6 (and k going from 1, 2,... in a row) (values not given are 0):

n     P
1     1
2     1          1
3     1    2*1+1=3           1
4     1    2*3+1=7     3*1+3=6           1
5     1   2*7+1=15    3*6+7=25    4*1+6=10             1
6     1  2*15+1=31  3*25+15=90  4*10+25=65  5*1+10=15  1

Now, to get the required answer, just sum up 1+31+90+65+15+1=203

Reuben Tate
Feb 21, 2016

I came about my solution in the same way as Ivan Koswara (although I was not familiar with the concept of Bell Numbers before reading his solution). Although not the best in regards to time complexity, the python code below produces the desired solution of 203 \boxed{203} .

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# Count Number of Equivalent Relations
def fact(n):
    if n==1 or n==0:
        return 1
    else:
        return n*fact(n-1)

def C(n,k):
    return fact(n)/(fact(k)*fact(n-k))

def f(n):
    if n==0 or n==1:
        return 1
    else:
        return sum([C(n-1,i)*f(i) for i in range(0,n)])

print f(6)

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...