[Math] Do the elements of a set have to be unique

elementary-set-theory

Does the mathematical definition of a set specify/imply that its elements be unique?


For context, this question has arisen in my mind from my experience using the Python programming language where one of the properties of the 'Set' data structure is that its elements are necessarily unique. Prior to this I had done a maths degree, but don't recall this being highlighted when learning about [mathematical] sets; certainly not with the emphasis it is given in Python.

Moreover, I feel like I came across questions or problems where sets would sometimes have repeated elements (perhaps problems in probability or combinatorics), but I may be mis-remembering this or it may have simply been an abuse of the notation. But an example might be:

What is the probability that the sum of two numbers, one each drawn randomly from the sets $A = \{1, 2, 2, 3, 3, 3\}$ and $B = \{1, 2, 3, 4\}$ is at least 6?

(where the desired answer is 8/24, rather than 3/12)

The Set Theory Wikipedia page does not use the term "unique" or "distinct" in reference to set elements. I came across this Stack Overflow question, but it's obviously geared heavily towards programming, so it's hard to know if that answers are really about the mathematical concept rather than programming data structures. It does mention that a set where repeated elements are allowed is called a Multiset, and in making this distinction, the Wikipedia page for Multiset does assert that a set is only allowed a single instance of an element. But it goes on to say that the term Multiset was only coined in the 1970s, so I'm left wondering what Mathematicians did before then if they wanted collections of objects with duplicates?

Best Answer

Does the mathematical definition of a set specify/imply that its elements be unique?

Yes.

The Set Theory Wikipedia page does not use the term "unique" or "distinct" in reference to set elements.

No, but it does say this:

"Set theory begins with a fundamental binary relation between an object o and a set A. If o is a member (or element) of A, the notation o ∈ A is used."

I interpret this as: To be an object in the universe is to be unique. For every thing, it is the only thing that is itself and either an object $o$ is a member of a set $A$.... or it isn't.

Now a set has nothing about how order the things or how you pick them out or list them. And if $o$ is in the set $A$, it doesn't matter if when asked to describe the elements of $A$ I mention $o$ first, or last, or $53$rd and if I say "$A$ has $o$ and it has $t$ and $s$ and it has $o$, did I mention $o$ already, and it has $q$ and $z$ and $o$ and $m$ and $o$ and $o$ and, gee I'm mentioning $o$ a lot, and ..." The fact remains either $o$ is in the set or not. Those are the only options.

So if a set is $\{1,2,3,4\}$ that doesn't mean we can't list it as $\{4,3,4,1,2,4\}$. In fact consider $\mathbb Q = \{\frac ab| a,b\in \mathbb Z; b\ne 0\}$. That's perfectly valid but inefficient. Notice we have include then element $\frac 34$ when we consider $\frac 34\in \mathbb Q$ as $3,4\in \mathbb Z$. But we considered it a second time when we considered $-3, -4 \in \mathbb Z$ and $\frac 34 = \frac {-3}{-4}$. And we considered it a third time when we considered $51, 68\in \mathbb Z$.

....

As to consider sets as lists with multiple listings of elements or as listings where order does matter.... well, that is why we have such concepts as multisets or sequences. Even functions is an extension of the concept.

As for a probability problem as you suggest. I imagine must would state it as something like "What is the probability that the sum of two numbers, one each drawn randomly from the collections A={1,2,2,3,3,3} and B={1,2,3,4} is at least 6?" Technically we'd say $A$ is a multiset, not a set.

Related Question