# How many possible relations between two sets?

Battlemage!
Say you have set A with n elements and set B with m elements. If I recall, there are a total of 2nm relations between them. But my question is, does this count redundancies? What I mean is, if in the relation A~B = B~A. I don't want to count identical relations twice.

Thanks!

## Answers and Replies

Let'sthink
In principle A~B = B~A can never be correct because A~B means to for EVERY element in A there is a UNIQUE element in B to which is supposed to be related. And so is the fact with B~A means for EVERY element in B there is a UNIQUE element in A to which is supposed to be related. So they cannot be equal.

Battlemage!
Okay well what I mean is, say the relation is multiplication in a subset of R. Then 3*2 = 2*3. And so on.

Staff Emeritus
Homework Helper
Multiplication is not a relation, it is an operation.

Cruz Martinez
Say you have set A with n elements and set B with m elements. If I recall, there are a total of 2nm relations between them. But my question is, does this count redundancies? What I mean is, if in the relation A~B = B~A. I don't want to count identical relations twice.

Thanks!

A relation between sets A and B is by definition a subset of AxB. If A has n elements and B has m elements, AxB has nm elements. Such a set has 2nm subsets, therefore there are 2nm relations between A and B.

Battlemage!
Multiplication is not a relation, it is an operation.
I thought all operations were types of relations. It appears i mixed some stuff up. Lets just rephrase the question as multuplication instead.

Mentor
I thought all operations were types of relations. It appears i mixed some stuff up. Lets just rephrase the question as multuplication instead.
So what is the new question?

Battlemage!
So what is the new question?
Im sorry I havent slept in 38 hours that last post was nonsense.

But as a test, a specific example:

Say I have a set with 6 elements and a set with 4 elements. Call them set A=[a1, a2, a3, a4, a5, a6] and set B=[b1,b2,b3,b4] Each of the 6 elements can be matched with one of the 4 elements, but each of the 4 elements can be matched to any number of the 6. So you can end up with all 6 of set A being associated with the first element of set B, or a1 and a2 being mathed woth b1, a3 being matched with b2, a4 and a5 being mathed with b3, and a6 being matched with b4. And so on. Any combination as long as all 6 from set A are matched with elements from set B and

Let'sthink
I am sorry the definition which I wrote was that of a function and not of relation. Every function is a relation but every relation is not a function.

Let'sthink
What is the difference between mapping and relation? You have to consider this question as well. I think mapping involves every element of say A whereas relation does not if its definition is any subset of AXB. Are the sets AXB and BXA identical I do not think so. That partly answers your self imposed equation A~B = B~A?

Say you have set A with n elements and set B with m elements. If I recall, there are a total of 2nm relations between them.

To investigate the correctness of that statement, we would need an clear definition for the statement "##R## is a relation between set ##A## and set ##B##".

For example, if ##R =\{(1,4), (2,4)\}## then is ##R## a relation between the sets ##A =\{1,2,3\}## and ##B=\{4\}##?

It looks to me like your result of ##2^{mn}## would count ##R## as being among the relations "between" ##A## and ##B##.

However, doesn't ##2^{mn}## also count the null set of ordered pairs as a relation? Are we going to count a null set of ordered pairs as a relation ? Is it a relation "between" ##A## and ##B## ?

Let'sthink
That means there is no relation between the sets A and B is also a relation! Because that is the meaning of null set being the sub set of AXB and defining a relation between them. Or is teh total number [{2^(nm)} -1]

Are the sets AXB and BXA identical

Yes, if ##A=B##.

Let'sthink
Stephen Tashi, thanks for responding. What is the correct or appropriate statement of the following:
1. The set A is related to set B.
2.The set B is related to set A.
3. There is a relation between the sets A and B.

The definition given by Cruz Martinez favors the third option. There is a relation between A and B means A is related to B and B is related to A.

Stephen Tashi, thanks for responding. What is the correct or appropriate statement of teh following:
1. The set A is related to set B.
2.The set B is related to set A.
3. There is a relation between the sets A and B.

I don't know of any standard mathematical definition for a relation "between" sets.

So let's look at your post #8 and consider what you want the statement "##R## is a relation between ##A## and ##B##" to mean.

I think you want each element of ##A## to in at least one of the ordered pairs of ##R##.
With that requirement, we would not consider ##R = \{(a1,b1), (a2,b4)\}## to be a relation between ##A## and ##B## because some of the elements of ##A## are missing in the first members of the ordered pairs of ##R##.

Now lets consider ##R = \{ (a1,b1),(a1,b2), (a3,b4), (a4,b4) ,(a5,b4), (a6,b4)\}##. Do you want ##R## to be a relation between ##A## and ##B## or do you want to disqualify it because it contains both ##(a1,b1)## and ##(a1,b2)## ?

Let'sthink
I think Stephen Tashi is confusing between the definitions of function and relation, which I also did!

Cruz Martinez
I don't know of any standard mathematical definition for a relation "between" sets.

I've seen it in some books, e.g. Lee, Topological Manifolds, Appendix A. The other definition I've seen for a relation is that R is a relation if whenever z ∈ R, z is an ordered pair.

Staff Emeritus
Homework Helper
I've seen it in some books, e.g. Lee, Topological Manifolds, Appendix A. The other definition I've seen for a relation is that R is a relation if whenever z ∈ R, z is an ordered pair.

Yes, you're right. But you and Stephen are talking about something else. You are talking about a relation with codomain and domain a set. In this case, two elements of the sets can be related. Stephen seems to be talking about the case where two sets themselves are related. Of course you can define such a relation, but there is no standard one like the OP thinks.

xxxx0xxxx
Folks, here is the standard set theoretic definition of a relation:

$$R~\text{ is a relation}~\Leftrightarrow~\forall r(r \in R~\rightarrow~\exists x \exists y(r~=~<x,y>)~)$$

This definition leave open the possibility that some members of relation ##R## are not ordered pairs.

However, the cross product, ##A~\times~B##, of two sets, ##A## and ##B##, is certainly a relation since it satisfies the definition given above.

The minimum number of possible relations between sets ##A## and ##B## would then be the number of sets in the power set of ##A~\times~B##, but the maximum number of relations is infinite.

Staff Emeritus
Homework Helper
This definition leave open the possibility that some members of relation ##R## are not ordered pairs.

Then it is not the standard definition.

xxxx0xxxx
Ok, if you want to be picky :), the definition leaves open the possibility that some elements of the relation ##R## are not ordered pairs taken from ##A## and ##B##.

Staff Emeritus
Homework Helper
Ok, if you want to be picky :), the definition leaves open the possibility that some elements of the relation ##R## are not ordered pairs.

No. A relation by definition consists only of ordered pairs.

Ok, if you want to be picky :), the definition leaves open the possibility that some elements of the relation ##R## are not ordered pairs taken from ##A## and ##B##.

You haven't yet stated a definition for "##R## is a relation between sets ##A## and ##B##".

I think the definition you are using implicitly is:

##R## is a relation between sets ##A## and ##B## if and only if ##R## is a subset of ##A \times B##.

That's a reasonable definition for some purposes, but I wouldn't say that its a standard definition.

To answer the question in the original post, we need to know what definition Battlemage wants to use. Perhaps Battlemage's doesn't really want to know about relations. Perhaps his question is:

"How many distinct functions are there that have a domain consisting of set ##A## with cardinality is ##n## and an image that is a non-null subset of set ##B##, where ##B## has cardinality ##m## ?"

Battlemage!
You haven't yet stated a definition for "##R## is a relation between sets ##A## and ##B##".

I think the definition you are using implicitly is:

##R## is a relation between sets ##A## and ##B## if and only if ##R## is a subset of ##A \times B##.

That's a reasonable definition for some purposes, but I wouldn't say that its a standard definition.

To answer the question in the original post, we need to know what definition Battlemage wants to use. Perhaps Battlemage's doesn't really want to know about relations. Perhaps his question is:

"How many distinct functions are there that have a domain consisting of set ##A## with cardinality is ##n## and an image that is a non-null subset of set ##B##, where ##B## has cardinality ##m## ?"

Thank you for asking.

Here is what I'm getting at. I have two sets. The first set A is smaller than the second set B. Each element from A must be linked with one and only one element from B, but any element from B can be linked to as many elements of A as there are in A (or as few as zero).

How many possible configurations are there?

I hesitate to use the word "pair" because in this scenario one element from B can have multiple elements from A associated with it, while each element from A can only have one element from B associated with it.

Also if B were smaller than A but the same rules applied (each element of A must be linked to an elememt of B, while each element of B can be linked with as few as zero elements to as many as are in A.).

I do apologize for not using correct technical verbiage here.

Edited to add: the motivation for this came from me thinking about a training problem i had at my new job. We were to categorize documents by how confidential they were. There were a few categories of confidentiality but many types of documents. Being quickly bored of the exercise I was wondering at how big the possible number of arrangements could be, and how that question could be answered in general. I realize most people would question my sanity over such idle curiosity...

One more edit- my first estimate was 2 nm where n and m are the size of the two sets, as was suggested, but I doubt it is correct and only have intuition to go by (and mine is quite lacking).

Last edited:
bobkolker
A relation is a set of pairs. which would include the empty set. So if A has a elements (a not = 0) and B has b elements (b not = 0) then the set of relations between A and B is the set of subsets of A x B This tells you all the ways of matching elements of A with elements B including not matching any.

Battlemage!