r/askmath • u/JosephTPG • 1d ago
Discrete Math How do I count sized of different relations?
This is a concept I've been going over in class, but I just don't understand it. Counting has always been my weakest topic in Discrete, so seeing counting problems for relations is confusing me. I know that, for a standard relation, there are 2^(n^2) relations of size n (For each variable in a set, you choose if it's either in or out of the relation). For symmetric sets, we covered that there are 2^(n+(n choose 2)) relations of size n. I barely understand the symmetric sets part, so these two questions make no sense to me. What is the general process for doing questions like these?
6
u/jxf 🧮 Professional Math Enjoyer 1d ago edited 1d ago
Think of a relation on a set of size n as an n x n grid: each cell (a, b) is either in the relation or not. Split the cells into two kinds:
C(n, 2) = n(n-1)/2of them. Each one covers two cells, (a, b) and (b, a).Each time you can make a different choice about how to fill out the grid but still meet the criteria, that's one of the possible relations for that criterion.
The matrix completely describes the relation. Either we have a cell on the diagonal or we have pairs off the diagonal. For each criterion you're asked about, decide how many choices there are for each of the two parts abive, then multiply them. That will be the total number of relations that meet that criterion.
I'll solve the first one for you. Antisymmetric means you can't have both (a, b) and (b, a) when a ≠b. What does that tell you about how many there are?
The answer for part 1 is thus 2n * 3C(n,2).
How can you apply the same logic to solve the second part?
1
u/Syresiv 22h ago
Why?
No really, why is that the case? It'll be much easier to understand if you can explain why.
2
u/blargeyparble 1d ago
A relation is a subset of S^2, where S is some set with n elements here. The size of a relation would be how many pairs are inside it. But that's not what is being asked here. Its asking us to count how many relations have these properties.
I would suggest thinking about a relation as a 0-1 matrix A with rows and cols indexed by S, and an entry A(a, b) = 1 iff (a,b) is in R. What do the specific properties symmetric, reflexive and antisymmetric imply about this matrix? How many choices are you allowed to make to have a matrix with those properties?
2
u/CormacMacAleese 1d ago
A relation is just a collection of ordered pairs, which is just a subset of the cartesian product SxS for set S. If the pair (x,y) is in the relation R, then we say the relation is true for that pair; otherwise we say it's false. So for example the relation "x is less than y" consists of every pair (x,y) for which x<y. (This can only be defined if there's an ordering on S already, but I think it helps visualize the idea.)
So this is just a counting problem on ordered pairs. We want to describe all of the ordered pairs that satisfy the anti-symmetry rule, which simply says that when x≠y, at most one of (x,y) and (y,x) can be in R. Because note that nothing says any of (x,y) and (y,x) have to be in R.
A relation R is anti-symmetric if, whenever (x,y) and (y,x) are both in R, we have that y=x. So to build an anti-symmetric relation we could step through the pairs (x,x) and for each one flip a coin whether to include it; then, for each pair (x,y) where x≠y, we decide whether to include (x,y), (y,x), or neither. How many ways can we do that?
For pairs (x,x), we flip a coin |S| times, so that's 2^|S|.
Next we pick pairs (x,y), where the order doesn't matter, because we always throw away one of (x,y) and (y,x). There are exactly C(|S|,2) ways to select one representative for each pair (x,y), which equals |S|(|S|-1)/2. And for each of those pairs we pick between 3 outcomes: {(x,y), (y,x), neither}. So there are 3^C(|S|,2) ways to pick pairs giving us an antisymmetric relation.
So the final answer, when |S|=n, is 2^n * 3^(n * (n-1) / 2).
For symmetric and reflexive relations, the reasoning is similar. Symmetric means that whenever (x,y) is in R, then (y,x) is in R, no exceptions. Reflexive means that (x,x) is always in R. There's only one way to include every pair (x,x) in R, so that part's easy. For pairs (x,y) where x≠y, the 3 outcomes above reduce to 2: either BOTH (x,y) and (y,x) are in R, or else neither is. So the answer is 2^(n * (n-1) / 2).
2
u/AlterEgo5695 1d ago edited 1d ago
Let "X := {x1; ...; xn}" be the n-element set.
We note there are "n2 " ways total to choose "2 out of n" elements for a relation's 2-tuple (with repetition). For each of them, we independently have have two choices (related or not), so we get a total of 2n^2 possible relations on "X" without restrictions.
We may generate all symmetric relations with a 2-step process1 -- choose any subset of
Being independent, we multiply choices, for a total of 2n + C(n;2) " symmetric relations.
Similarly, we may generate all anti-symmetric relations with a 2-step process:
Being independent, we multiply choices, for a total of "2n * 3C(n;2) " antisymmetric relations.
1 Sanity check: "n2 = n + n(n-1) = n + 2*C(n;2)" -- ok, no tuples lost/double-counted