Counting D-classes and R-Classes

MA 502 Project 1

By: Stephanie Getz 10/4/99

[Maple Math] is the set of selfmaps of the finite set A with | A |= n .

Definition: [Maple Math] is a D-class of [Maple Math] . If f, g [Maple Math] [Maple Math] , then | f(A) | = | g(A) | = r .

In other words f and g are [Maple Math] -valued selfmaps of A .

Definition: [Maple Math] is the number of functions in [Maple Math] . [Maple Math] is the number of [Maple Math] -valued selfmaps [Maple Math] : [Maple Math] ->{1,2,.., r }.

Definition: [Maple Math] is an R-Class of [Maple Math] . ( [Maple Math] is as previously defined.) Given any [Maple Math] , [Maple Math] in R , f( A )=g( A ). (i.e., [Maple Math] and [Maple Math] share the same range.)

Definition: [Maple Math] is the number of elements of any R-class in [Maple Math] . Given a paricular r -valued range, say {1,...,r}, [Maple Math] is the number of r-valued selfmaps of {1,...,n} to {1,...,r}.

Example: Let A ={1,2,3,4}, and [Maple Math] is the set of three-valued selfmaps of A . The following Maple work lists and counts all the functions in this D-class.

> restart;

> D43:=NULL:
s:=0:
for i from 1 to 4 do
for j from 1 to 4 do
for k from 1 to 4 do
for l from 1 to 4 do
if (i=j and i<>k and i<>l and k<>l)
or(i=k and i<>j and i<>l and j<>l)
or(i=l and i<>j and i<>k and j<>k)
or(j=k and j<>i and j<>l and i<>l)
or(j=l and j<>i and j<>k and k<>i)
or(k=l and k<>i and k<>j and i<>j) then
D43:=D43,[i,j,k,l];
s:=s+1;
fi
od od od od:
D43:=[D43];
d43:=s;

>

[Maple Math]

[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]

[Maple Math]

Example: consider [Maple Math] which was listed above. One R-class in [Maple Math] is the set of functions whose range is {1,2,3}. The following Maple work lists and counts this R-class.

> restart;

> D43:=NULL:
s:=0:
for i from 1 to 4 do
for j from 1 to 4 do
for k from 1 to 4 do
for l from 1 to 4 do
if (i<>4 and j<>4 and k<>4 and l<>4)
and ((i=j and i<>k and i<>l and k<>l)
or(i=k and i<>j and i<>l and j<>l)
or(i=l and i<>j and i<>k and j<>k)
or(j=k and j<>i and j<>l and i<>l)
or(j=l and j<>i and j<>k and k<>i)
or(k=l and k<>i and k<>j and i<>j))then
D43:=D43,[i,j,k,l];
s:=s+1;
fi
od od od od:
D43:=[D43];
r43:=s;

[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]

[Maple Math]

Theorem I: The intersection of any two R-classes is empty.

Proof:

Let [Maple Math] and [Maple Math] be two different R-classes of [Maple Math] . Assume [Maple Math] is contained in both [Maple Math] and [Maple Math] . This means that for any [Maple Math]

in [Maple Math] , [Maple Math] and [Maple Math] have the same range; and similarly for any [Maple Math] in [Maple Math] , [Maple Math] and [Maple Math] have the same range. By transitivity of equality of sets, [Maple Math] and [Maple Math] have the same range. This implies that [Maple Math] and [Maple Math] are the same R-class, which is a contradiction because [Maple Math] and [Maple Math] are different R-classes. Thus, there cannot be a function in two different R-classes, which implies the intersection of any two R-classes is empty.

Theorem II: A D-class is the union of R-classes .

Proof:

Let [Maple Math] be a union of R-classes. [Maple Math] = [Maple Math] {R-classes of selfmaps with [Maple Math] = i } where [Maple Math] is contained in [Maple Math] ={subsets of domain, [Maple Math] , with [Maple Math] elements}.

Show [Maple Math] .

i.) [Maple Math] is in [Maple Math] . Show [Maple Math] is in [Maple Math] .

Since [Maple Math] is in [Maple Math] , | [Maple Math] | = [Maple Math] . This implies [Maple Math] is in [Maple Math] , which implies that [Maple Math] is in an R-class for some [Maple Math] . And, this implies that [Maple Math] is in [Maple Math] .

ii. ) [Maple Math] is in [Maple Math] . Show [Maple Math] is in [Maple Math]

Since f is in U , f(A)=i for some i in I . This implies | f(A) |= r , which by definition means f is in [Maple Math] .

By i) and ii) [Maple Math] = U . Therefore a D-class is a union of R-classes.

Theorem III: Any two R-classes in a D-class have the same number of elements

Proof: Let R1 and R2 be R-classes of [Maple Math] . [Maple Math] = {selfmaps f :{1,.., n }-> [Maple Math] ={ [Maple Math] , [Maple Math] , [Maple Math] ,.., [Maple Math] }, and [Maple Math] ={selfmaps

g :{1,2,.., n }-> [Maple Math] ={ [Maple Math] , [Maple Math] , [Maple Math] ,..., [Maple Math] }}. Since [Maple Math] and [Maple Math] are both r -valued and have cardinality r , one-to-one relationships can be made from the set {1,2,...,r}to both [Maple Math] and [Maple Math] . Let h be the one-to-one function h :{1,2,.., r }-> [Maple Math] } and j be the one-to-one function [Maple Math] :{1,2,.., r }-> [Maple Math] .

Let M(A) ={selfmaps M:A ={1,..., n }->{1,2,.., r }} by identity property of sets.

Let h(M(A)) ={selfmaps h(M) , where h is the one-to-one function h :{1,2,..,r}-> [Maple Math] }

| M(A) | = | h(M(A)) | because h is a one-to-one function that transforms the range {1,2,..,r} to [Maple Math] .

Let j(M(A)) ={selfmaps j(M) , where j is the one-to-one function j :{1,2,.., r }-> [Maple Math] }

| M(A) | = | j(M(A)) | because j is a one-to-one function that transforms the range {1,2,.., r } to [Maple Math] .

Therefore, | h(M(A)) |=| j(M(A)) |

h(M(A)) ={selfmaps h(M) :{1,.., n }-> [Maple Math] ={ [Maple Math] , [Maple Math] , [Maple Math] ,.. [Maple Math] }}= R1 by definition

j(M(A)) ={selfmaps j(M): {1,2,.., n }-> [Maple Math] ={ [Maple Math] , [Maple Math] , [Maple Math] ,..., [Maple Math] }}= [Maple Math] by definition

This implies | [Maple Math] |=| [Maple Math] |=| j(M(A)) |=| R2 |

Therefore, any two R-classes in a D-class have the same number of elements.

Theorem IV: The number of R-classes in a D-class is nCr.

By definition, an R-class is a set of selfmaps of A ={1,2,.., n } with the same r -valued range. The number of R-classes is the number of different r -valued ranges for these selfmaps. The number of r -valued ranges of selfmaps is the same as the number of r -element subsets of A , whose cardinality is n . The number of r -element subsets from an n -element set is nCr (by definition of nCr). Thus, the number of R-classes in a D-class is nCr.

Theorem V: [Maple Math] =(nCr)* [Maple Math]

Proof:

By the Theorems 1, 2, and 3, the intersection of any two R-classes is empty; and the D-class equals the union of the R-classes in the D-class, and any two R-classes in a D-class have the same number of elements.

This implies [Maple Math] =(the number of functions in [Maple Math] ) = (#R-classes in [Maple Math] )*(# functions per R-Class in [Maple Math] )

= (nCr)* [Maple Math]

Theorem VI: [Maple Math] = [Maple Math] - sum( [Maple Math] , i=1..r-1) for [Maple Math] , [Maple Math] and [Maple Math] = 1.

Proof:

i) [Maple Math]

By definition [Maple Math] is the number of functions in an R-classes of [Maple Math] . [Maple Math] is the D-class of selfmaps with a one-valued range. In other words, [Maple Math] is the D-class of constant selfmaps. Since the domain of the selfmaps, A = {1,2,.., n }, has n elements, there are n constant selfmaps of A . Thus [Maple Math] . By Theorem V, [Maple Math] = (nCr)* [Maple Math] .

This implies [Maple Math] . Thus [Maple Math] = [Maple Math] = [Maple Math] =1.

ii.) [Maple Math] = [Maple Math] - sum( [Maple Math] *rCi, i=1..r-1)

By definition, [Maple Math] is the number of selfmaps in an R-class of [Maple Math] . [Maple Math] is the D-class of selfmaps with an r -valued range. From Theorem III, any two R-classes in a D-class have the same number of elements. So, we will consider the R-class with range {1,2,..,r}. [Maple Math] is the number of r -valued maps [Maple Math] : A ={1,2,..., n }->{1,..,r}.

Let F be the set of maps (any valued) f : A ={1,2,..., n }->{1,.., r }. | F | is [Maple Math] because for each element in the domain, A , of the functions in F , there are r possible values in the range that the functions can take. This total number takes into account all of the constant functions, two-valued functions, three-valued functions, ..., (r-1) valued functions, and r-valued functions.

To obtain the number of r-valued selfmaps, the number of constant maps, two-valued maps, ..., (r-1) valued maps must be subtracted from the total number of selfmaps possible in the given range.

Let [Maple Math] ={ [Maple Math] : [Maple Math] is a constant selfmap of A and [Maple Math] :{1,2,.., n }->{1,2,.., r }},

[Maple Math] ={ [Maple Math] : [Maple Math] is a two-valued selfmap of A and [Maple Math] :{1,2,.., n }->{1,2,..., r }},

[Maple Math] ={ [Maple Math] : [Maple Math] is a three-valued selfmap of A and [Maple Math] :{1,2,.., n }->{1,2,..., r }},

.

.

.

[Maple Math] ={ [Maple Math] : [Maple Math] is an (r-1) -valued selfmap of A and [Maple Math] :{1,2,.., n }->{1,2,..., r }},

and [Maple Math] ={ [Maple Math] : [Maple Math] is an r -valued selfmap of A and [Maple Math] :{1,2,.., n }->{1,2,..., r }}

| [Maple Math] | = [Maple Math] *(rC1) because [Maple Math] gives the number of functions for one specific one-valued range, yet the range can be any of the r elements of {1,2,.., r }.

| [Maple Math] |= [Maple Math] *rC2 because [Maple Math] gives the number of functions for one specifice two-valued range, yet the two-valued range can be any two-element subset of {1,2,.., r }, and the number of such subsets is rC2.

In general, | [Maple Math] |= [Maple Math] *rCi because [Maple Math] gives the number of functions for one specific i -valued range, yet the i -valued range can be any i -element subset of {1,2,.., r }, and the number of such subsets is rCi.

Therefore, | [Maple Math] | = [Maple Math] *rCr = [Maple Math] = [Maple Math] - sum(| [Maple Math] |, i =1.. r-1 ) = [Maple Math] -sum( [Maple Math] *rCi, i =1.. r-1 )

[Maple Math] = [Maple Math] -sum( [Maple Math] *rCi, i =1.. r-1 )

***I am at a loss as to how to get Maple to execute this recursive function, but I will test by hand [Maple Math] .

From the brute force example at the beginning of the project, we know [Maple Math] =36. I will verify the formula with this.

[Maple Math] = [Maple Math] -( [Maple Math] *3C1 + [Maple Math] *3C2)

=81-(3*1 + 3*( [Maple Math] - [Maple Math] *2C1))

=81-(3+3(16-2))

=81-45 = 36

Excellent. You are excused from the exam. You may participate however.
here is the maple procedure which implements your formula. I called the function cr for
cardinality of an rclass.

> cr := proc(n,r)
options remember;
local i;
if r = 1 then 1
else r^n - add(cr(n,i)*binomial(r,i),i=1..r-1) fi end;

[Maple Math]

> cr(4,3);

[Maple Math]

If you use the small semigroup vocabulary to produce a table of values for cr(n,r) for n=1..6 you get this table [Maple Math] . checking the bottom row against cr, we get

> seq(cr(5,i),i=1..5);

[Maple Math]

Same answers. Yahoo!