Why can sets contain duplicate elements?

In summary: The point is that the number of elements in a multiset is the sum of the multiplicities of its elements, whereas the number of elements in a set is just its cardinality. So this example of M has 8 elements while the set(set(M)) has 8 elements.The reason that we don't use multisets all the time is that in classical mathematics, we don't care about the order of elements in a set. But we care about the order of elements in a multiset because it is the multiplicity of an element that is important, and switching the order of elements in a multiset changes the multiplicity of at least one element.In summary, sets are defined
  • #1
bahamagreen
1,014
52
If S={a,b,c}, what does it mean that S=T when T={a,a,a,a,a,a,b,c}?
The mapping that confirms the definition of equality assumes that the duplicate symbols in a set are representative of the same entity or idea.

If S={1/2} and T={ .5 , 2/4 , ,25/,5 , 4/8 } are these sets equal? At what point does one ask about or distinguish the symbols from what they represent? Does it matter that one might define the set T as "symbols that are equal to one half"?

Likewise with names:

S={Bill, Bill, Joe, Tom}

and S=T where T={Bill, Joe, Tom}

Isn't it undefined whether one of those "Bill"s in S is merely a duplication of the "Bill" symbol naming one of three boys in a group with names Bill, Joe, and Tom, or if the duplicate symbols represent the names of two boys from a group of four boys named Bill, Joe, Tom, and the fourth named Bill as well?

The mapping of the symbols to test equality does not seem to extend to the things represented strictly by the symbols of representation. Working at just the symbol level, how does one know when it is OK to collapse symbol duplicates without confounding the objects which they represent?

I'm probably not explaining my questions and examples very well; fundamentally I'm wondering why the definition of sets does not enforce or invoke some kind of uniqueness requirement of their elements. In the name example above, a set with two "Bill"s in it does not indicate whether those two are duplicate representations of a single instance or duplicate symbols used to represent two unique discernible instances... how would one know it was OK to reduce the set to contain only one "Bill" symbol and claim it was equal to before doing so?

In modern relational data systems one uses primary keys to enforce uniqueness so that one does not attempt to employ mutually shared attributes resulting in common identifiers of different things... how is set theory avoiding that kind of requirement?
 
Physics news on Phys.org
  • #2
bahamagreen said:
If S={a,b,c}, what does it mean that S=T when T={a,a,a,a,a,a,b,c}?

The a's in T are all equal. They don't represent anything but an a. If I build the set of all forum members and list you twice by mistake that doesn't change the set.

If S={1/2} and T={ .5 , 2/4 , ,25/,5 , 4/8 } are these sets equal?

No, not in general. Because they are representatives of equivalence classes: 1/2 ≠ 2/4. They have the same value but are not equal.
You will know if you go to the next bakery and buy first half a cake and the two quarters. You get the same amount of cakes but of different sizes.

Does it matter that one might define the set T as "symbols that are equal to one half"?

Therefore whether 1/2 is the same element as 0.5 depends on your description of the set or its embedding in some larger set, i.e. different as symbols, same as values.

Likewise with names: S={Bill, Bill, Joe, Tom} and S=T where T={Bill, Joe, Tom}

Yes. Bill is the same Bill as a name but it might be two persons named Bill. Then it would be probably better to call them Bill the younger and Bill the older.

In modern relational data systems one uses primary keys to enforce uniqueness so that one does not attempt to employ mutually shared attributes resulting in common identifiers of different things... how is set theory avoiding that kind of requirement?
The same way. By proper definition, say well-defined sets, and by carefully distinguishing between elements and attributes. Using foreign keys or pointer would result in bad readability. So define your set carefully and avoid to be the barber in the village who shaves everyone in the village who doesn't shave himself!
 
  • #3
Like Fresh said, a set is uniquely -defined by the list of its elements, unlike is the case with objects like ordered n-ples that have
additional structure. This is true by definition of set. The issue of 0.5 vs 1/2 is dealt with in the concepts of intensionality and extensionality..
 
  • #4
The exchange:

"If S={1/2} and T={ .5 , 2/4 , ,25/,5 , 4/8 } are these sets equal?"

"No, not in general. Because they are representatives of equivalence classes: 1/2 ≠ 2/4. They have the same value but are not equal."


is at the very minimum extremely misleading, and I would tend to say just completely mistaken.

When you represent a real number, whether as a decimal (".5") or a fraction ("4/8") or whatever, you are referring to the number itself, which is the equivalence class of the representation that you choose.

So it is true, without the faintest doubt whatsoever, that indeed

1/2 = 2/4 = .5 = 4/8​

(though I can't understand the part of bahamgreen's set notation with the extra commas and 25/5).

And therefore the two sets:

S = {1/2}​

and

T = {1/2, 2/4, .5, 4/8}​

are certainly equal.

And Yes — as has been said — repeated elements inside of set brackets (or any other way to define a set) count only once. For any set S and any point x, either x is or is not a member of S; there is no such thing as being a member "with multiplicity".

However, there is a useful generalization of the concept of a set that is called a "multiset". This is none other than a set with a positive integer assigned to each element, called its multiplicity. This kind of thing arises all the time in datasets: Suppose you want to represent the grades that members of a college class scored on an exam, and you care about how many times the same grade occurred. Then you want a multiset, e.g.,

M = {100, 100, 100, 94, 92, 92, 87, 19}.​

Of course, a multiset can be represented in terms of just a certain kind of set after all: a set of ordered pairs where the first part of each ordered pair is the item in question and the second part is the positive integer that is its multiplicity:

set(M) = {(100, 3), (94, 1), (92, 2), (87, 1), (19, 1)}.
 
Last edited:
  • #5
I have always seen a set defined as being composed of unique elements, with order not significant.

bahamagreen said:
If S={1/2} and T={ .5 , 2/4 , ,25/,5 , 4/8 } are these sets equal? At what point does one ask about or distinguish the symbols from what they represent? Does it matter that one might define the set T as "symbols that are equal to one half"?

You can do whatever you like. If these are sets of numbers then they are equal. If they are sets of symbols, then they are not equal.
 
  • Like
Likes FactChecker
  • #6
bahamagreen said:
<Snip>

I'm probably not explaining my questions and examples very well; fundamentally I'm wondering why the definition of sets does not enforce or invoke some kind of uniqueness requirement of their elements. In the name example above, a set with two "Bill"s in it does not indicate whether those two are duplicate representations of a single instance or duplicate symbols used to represent two unique discernible instances... how would one know it was OK to reduce the set to contain only one "Bill" symbol and claim it was equal to before doing so?

In modern relational data systems one uses primary keys to enforce uniqueness so that one does not attempt to employ mutually shared attributes resulting in common identifiers of different things... how is set theory avoiding that kind of requirement?

But it does enforce this. A set is defined as a collection , possibly infinite, of _distinct_ objects.
 
  • #7
fresh_42 said:
Because they are representatives of equivalence classes: 1/2 ≠ 2/4. They have the same value but are not equal.
I'm going to disagree with you here, and second what zinq said, which is that 1/2 = 2/4. Since the two forms have the same value, they are equal.

Any two numbers or expressions that have the same value, are equal. That's what "equal" means.
 
  • #8
Mark44 said:
I'm going to disagree with you here, and second what zinq said, which is that 1/2 = 2/4. Since the two forms have the same value, they are equal.

Any two numbers or expressions that have the same value, are equal. That's what "equal" means.
I have been arguing from a very theoretical point of view. Two quarter of a cake is not equal to one half of a cake. Equivalent, but not equal. I like to think of it as the easiest example of the difference of the two. Maybe it's hair splitting, I have to admit.
 
  • #9
fresh_42 said:
I have been arguing from a very theoretical point of view. Two quarter of a cake is not equal to one half of a cake. Equivalent, but not equal.
Two quarters of a cake or one half of a cake? Same weight/volume of cake either way, so I don't see how they could be different, or unequal, any more than 1/2 is different from 2/4.
 
  • #10
Mark44 said:
Two quarters of a cake or one half of a cake? Same weight/volume of cake either way, so I don't see how they could be different, or unequal, any more than 1/2 is different from 2/4.
It doesn't differ more than 1/2 and 2/4. It differs by an additional cut. Latest at 48/96 it makes a huge difference. I always have someone in mind, sending me to the bakery fetching 6 piece of a cake (6/12) and then complains at my return, that I brought 1/2, which has still to be cut while the guests are waiting. As I've said, maybe hair splitting.
 
  • #11
fresh_42 said:
As I've said, maybe hair splitting.
Yes, I would agree.
Since we were originally talking about numbers, 1/2, 2/4, and 48/96 all have the same value, so are equal. It's immaterial that they appear different. I'm sure that you wouldn't argue that 1 and 0.999... aren't equal, so I don't understand why you are arguing that 1/2 and 2/4 aren't equal, as you said in post #2.
fresh_42 said:
Because they are representatives of equivalence classes: 1/2 ≠ 2/4.
 
  • #12
This depends on the context and the people I'm talking to. I would still say they are equivalent instead of equal in a theoretical debate, the more they are different representations of ##1##. It's just that we are used to equality as equivalence classes whereas we are not used to them, when talking about e.g. remainders or Graßmann algebras. I usually chose this picture with the cake when I want to explain what equivalence classes are, and that they can be viewed to be as natural as rational numbers. Simply different objects.

In addition, from an algebraic point of view: ##1/2 = 1 \cdot 2^{-1}## and ##2/4 = 2 \cdot 4^{-1}## which is different! Latest when it comes to rings in which ##2## has an inverse, and ##4## has not.

Edit: Let's say ##3/6 = 3 \cdot 6^{-1}## and ##6## has no inverse.
 
  • #13
In math, in order to decide if two members of some set are equal or not, one needs to say exactly which set one is speaking about! Otherwise the question is meaningless.

If one is speaking only about pairs of integers that can be the numerator and denominator of a rational number — nothing more — then the set would be the collection of ordered pairs

S = {(K, L) | K and L are integers, and L > 0}.​

But if instead one is interested in the rational numbers themselves, then one must take the quotient of this set S by a certain equivalence relation. Let's denote that equivalence relation by ~. Then the rational numbers ℚ are given by the quotient

ℚ = S / ~

where we define ~ for members (K, L) and (M, N) of S via

(K, L) ~ (M, N)​

if and only if

K ⋅ N = L ⋅ M.​

For some elementary notes about equivalence relations, see http://people.math.gatech.edu/~ecroot/2406_2012/equivalence_relation_notes.pdf.
 
  • #14
bahamagreen said:
If S={a,b,c}, what does it mean that S=T when T={a,a,a,a,a,a,b,c}?
The mapping that confirms the definition of equality assumes that the duplicate symbols in a set are representative of the same entity or idea.

Yes, it does in that case, because the traditional interpretation of such notation assumes there is a unique thing represented as "a".

If S={1/2} and T={ .5 , 2/4 , ,25/,5 , 4/8 } are these sets equal?

That depends on how you define "equal" for the elements. There are many different "equivalence relations" in mathematics.

For example, ".5" and "2/4" are "equal" if you consider them to represent numbers. However, if you consider them to represent strings of symbols, then they are not equal. Unfortunately, there is no universal definition for "equal" in mathematics. Asserting that "equal" means "the same" still leaves the question: "The same with respect to what ?".

At what point does one ask about or distinguish the symbols from what they represent? Does it matter that one might define the set T as "symbols that are equal to one half"?

Until you define what your notation means and what "equal" means with respect to that notation, you haven't defined which set is specified when you use that notation.

Likewise with names:

S={Bill, Bill, Joe, Tom}

and S=T where T={Bill, Joe, Tom}

Isn't it undefined whether one of those "Bill"s in S is merely a duplication of the "Bill" symbol naming one of three boys in a group with names Bill, Joe, and Tom, or if the duplicate symbols represent the names of two boys from a group of four boys named Bill, Joe, Tom, and the fourth named Bill as well?

Again, you have to define what your notation means. Merely writing a set using some notation doesn't tell what the notation means.

The mapping of the symbols to test equality does not seem to extend to the things represented strictly by the symbols of representation. Working at just the symbol level, how does one know when it is OK to collapse symbol duplicates without confounding the objects which they represent?

I'm probably not explaining my questions and examples very well; fundamentally I'm wondering why the definition of sets does not enforce or invoke some kind of uniqueness requirement of their elements. In the name example above, a set with two "Bill"s in it does not indicate whether those two are duplicate representations of a single instance or duplicate symbols used to represent two unique discernible instances... how would one know it was OK to reduce the set to contain only one "Bill" symbol and claim it was equal to before doing so?
In modern relational data systems one uses primary keys to enforce uniqueness so that one does not attempt to employ mutually shared attributes resulting in common identifiers of different things... how is set theory avoiding that kind of requirement?

However, if you were discussing the mathematics of a database system, you would discuss procedures for determining whether two sets of data "X" and "Y" contained the same information. So there is a concern about a certain kind of "sameness" (i.e. "equality") and a need for two different symbols to discuss how to test it.

An abstract discussion of a system that involves symbols ends up using symbols to represent other symbols. There is no way to discuss a question like "How do we determine if X = Y?" or "What should the program do if if X = Y?" if we are prohibited from using both "X" and "Y" to denote "the same" thing.

The bottom line is that the notation for the elements of a set must be defined before the set is defined.

One can argue that there are traditional systems of notation. For example, one might say that { 1/2, 0.5 } implies a different intepretation than {"1/2", "0.5"}. This is matter of culture, where people can disagree.
 
  • #15
"Again, you have to define what your notation means. Merely writing a set using some notation doesn't tell what the notation means."

Yes and no: Any notation that is used must of course be defined. But the notation for sets is utterly standard and decidedly does not need to be redefined each time it is used.

In particular, no matter how many times equal items are listed as elements of a set, they always represent exactly one element of the set.

This is designed so that one can define a set without necessarily knowing whether the items listed are equal.

For example, let

f: ZZ

be the function from the integers to themselves defined by

f(x) = x3 - 4x.​

Then the set given by

X = {f(x) | x ∈ Z and -2 ≤ x ≤ 2},​

or in other words

X = {f(-2), f(-1), f(0), f(1), f(2)},​

has only 3 elements. This kind of thing is easy to check from the definition of f. But if f were a more complicated function, the numbers of elements in X might not be obvious at all — even though the set X is perfectly well-defined in either case.

For another example, the set

Y = {a, b, c, d, e}​

has between 1 and 5 elements depending on which of a, b, c, d, e are equal.

Note: All sets — with the sole exception of the empty set { } (symbolized by ∅) — must be defined in terms of other sets that have already been defined. So in the last example of the set Y, its members a, b, c, d, e must have been already defined as members of some other set (call it Z) in which the equalities among them, if any, have been determined.
 
  • Like
Likes Jehannum
  • #16
fresh_42 said:
This depends on the context and the people I'm talking to.
The context here was a set that contained real numbers.
bahamagreen said:
If S={1/2} and T={ .5 , 2/4 , ,25/,5 , 4/8 }

fresh_42 said:
I would still say they are equivalent instead of equal in a theoretical debate, the more they are different representations of ##1##.
Surely you mean "different representations of 1/2", right?
fresh_42 said:
It's just that we are used to equality as equivalence classes whereas we are not used to them, when talking about e.g. remainders or Graßmann algebras. I usually chose this picture with the cake when I want to explain what equivalence classes are, and that they can be viewed to be as natural as rational numbers. Simply different objects.

In addition, from an algebraic point of view: ##1/2 = 1 \cdot 2^{-1}## and ##2/4 = 2 \cdot 4^{-1}## which is different!
But we're not talkiing about rings, or esoteric mathematical structures -- we're talking about sets with ordinary numbers in them. The numbers 1/2, .5, 2/4, and 4/8 all appear at exactly the same location on the number line, so they are equal. To say that they are not is sophistry.
(The OP wrote "25/,5" in what I quoted. I suspect that this is a typo, and that what was meant was "25/50", another representation of 1/2.
fresh_42 said:
Latest when it comes to rings in which ##2## has an inverse, and ##4## has not.
Edit: Let's say ##3/6 = 3 \cdot 6^{-1}## and ##6## has no inverse.
I fail to see how that has even the slightest relevance in this thread. Did the OP say anything about rings or Graßmann algebras? Try to do a better job of gauging the level of the poster who is asking the question, and tailoring your response accordingly.
 
  • #17
Mark44 said:
-- we're talking about sets with ordinary numbers in them.

If so, then the fact relevant to the original post is that our interpretation is based on a tradition of notation used certain contexts (e.g. the typical intermediate level mathematics text).

The numbers 1/2, .5, 2/4, and 4/8 all appear at exactly the same location on the number line, so they are equal.

Yes, they are equal with respect to the equivalence relation defined on the set of real numbers . I don't think it is useful to give students the impression that mathematics uses the term "equal" in the universal common language connotation of "equal" (i.e. "exactly the same in every respect").
Did the OP say anything about rings or Graßmann algebras? Try to do a better job of gauging the level of the poster who is asking the question, and tailoring your response accordingly.

I have the impression that the OP understands that how to find the cardinality of a finite set of real numbers. The questions in the original post have to do with the equality of things versus the equality of the representation of things. That's a reasonably sophisticated topic.

My point of view is that how representations are used ( to judge the equality or inequality of the things that are represented) often relies on traditions. For example, a elementary set theory book may declare that the set {a,b,b} has cardinality 2. But as, zinq pointed out, it could have cardinality 1 if a=b. So the tradition of set theory books is that distinct representations always represent distinct members. On the other hand, if we are dealing with a computer program or some context where the representations stand for variables, then it would be incorrect to conclude that {a,b,b} has cardinality 2. The possibility that a = b would have to be considered.
 
  • #18
Mark44 said:
Surely you mean "different representations of 1/2", right?
No. I meant your example: ##1## and ##.99999999...##
Mark44 said:
The context here was a set that contained real numbers.
Correction, the context is sets. The word "real" appeared in #4 for the first time.
And as elements of a set, it is absolutely unclear, whether 1/2 = 2/4 or not. *)
Mark44 said:
I fail to see how that has even the slightest relevance in this thread. Did the OP say anything about rings or Graßmann algebras? Try to do a better job of gauging the level of the poster who is asking the question, and tailoring your response accordingly.
Again. It was about sets. And as such, different types of sets in which equality of their elements is defined differently is well a very crucial property in the debate.

Could it be that you're a little bit unfair here?

*) Edit: E.g. in the proof I know, about the uncountability of ##\mathbb{Q}## the elements 1/2 and 2/4 are counted as two.
 
  • #19
Mark44 said:
The context here was a set that contained real numbers.
fresh_42 said:
Correction, the context is sets. The word "real" appeared in #4 for the first time.
And as elements of a set, it is absolutely unclear, whether 1/2 = 2/4 or not. *)
These sets, S={1/2} and T={ .5 , 2/4 , 4/8 }, were listed in post #1. (I removed the extra comma and 25/5.) As Stephen Tashi pointed out, if we view the set elements as strings of characters, then the sets are different. If we view the sets as real numbers, then T really contains only a single element; namely 1/2 (following the wikipedia definition of "set" as a "collection of well defined and distinct objects." (my emphasis)
On what basis are you claiming that 1/2 isn't equal to 2/4? I don't buy your example of half a cake versus two quarters of a cake. It is not reasonable to assume that the numbers in set T represent portions of a cake, pie, orange, or other concrete object.
Mark44 said:
I fail to see how that has even the slightest relevance in this thread. Did the OP say anything about rings or Graßmann algebras? Try to do a better job of gauging the level of the poster who is asking the question, and tailoring your response accordingly.

fresh_42 said:
Again. It was about sets. And as such, different types of sets in which equality of their elements is defined differently is well a very crucial property in the debate.
The only reasonable explanation I've seen so far is that 2/4, 4,8, etc. might be sign as strings of characters as opposed to being numbers. If bahamagreen intended these as strings of characters, I didn't see that in his description.
fresh_42 said:
Could it be that you're a little bit unfair here?
How so?
Mark44 said:
*) Edit: E.g. in the proof I know, about the uncountability of ##\mathbb{Q}## the elements 1/2 and 2/4 are counted as two.
You saw a proof that the rationals were uncountable? :oldbiggrin:
In any case, the only reason for counting 1/2 and 2/4 separately is to make it easier to pair the rationals with the positive integers.
 
  • #20
Mark44 said:
I didn't see that in his description.
Yes, but I didn't see ##S \subset \mathbb{Q}## or ##T \subset \mathbb{R}## either. The OP started to talk about strings.
bahamagreen said:
If S={1/2} and T={ .5 , 2/4 , ,25/,5 , 4/8 } are these sets equal? At what point does one ask about or distinguish the symbols from what they represent? Does it matter that one might define the set T as "symbols that are equal to one half"?
I found that this question automatically leads to the question about the definition of equality of elements which brought me to my answer in #2. I only wanted to point out (I assume, it's been quite a while), that the question, whether two elements of a set are equal or not, might be not as obvious as it seems at first glance.
Mark44 said:
On what basis are you claiming that 1/2 isn't equal to 2/4?
Of course I usually don't make a difference. I only take this as an example (meant to be a bit funny), if I want to point out what equivalence (classes) mean. Let me turn around the question: Why do we need 2/4 if it is equal to 1/2? Don't we tell the kids in school why they are equal, what cancellation is? Why would it be necessary? By the rules in ## \mathbb{Q}## they are equal, of course. However, the rules were first and equality a consequence. Additionally in my language there is a subtle difference (although very similar) between the word for "the same" and "the identical". Kind of made me sensible on the issue. (And to my excuse: My sentence with a Graßmann algebra also contained remainders as example which is a quite simple one. The mentioning of both intended to describe the huge variety of sets, to which equality of elements mean different things.)
Mark44 said:
You saw a proof that the rationals were uncountable? :oldbiggrin:
Caught, lol.

Edit: Plus I've been a Newbie at the time and wasn't very good at tailoring my answers to the needs of OP. (A weakness, that sometimes catches me even now. I work on it.)
 
Last edited:
  • #21
A set is a collection that does not keep track of repetitions or order. It is not the job of the set to determine when two elements are equal. That is done by the context that the set is used in.
If you have defined a context where 1/2 is to equal 2/4, then { 1/2, 1/2, 2/4 } has just one element {1/2}.
If you have defined a context where '1/2' is not equal to '2/4', then { 1/2, 1/2, 2/4 } has two elements {1/2, 2/4} in that context.
In a context where 1 = .99999..., {1, .999999...} = {1} = {.99999...} = {.99999..., 1}
 
  • Like
Likes Heinera

Related to Why can sets contain duplicate elements?

1. Why do sets allow duplicate elements?

Sets are a data structure that is used to store unique elements. However, some programming languages, such as Python, allow sets to contain duplicate elements. This is because the concept of uniqueness in sets is based on the value of an element, not its position. So, if an element has the same value as another element, it is considered a duplicate and will not be added to the set.

2. What is the purpose of allowing duplicate elements in sets?

The purpose of allowing duplicate elements in sets is to give flexibility to the programmer. In some cases, having duplicate elements in a set may be useful for certain algorithms or data processing tasks. It also allows for faster execution time in certain situations, as checking for duplicates can be time-consuming.

3. How does allowing duplicate elements affect the operations performed on sets?

Allowing duplicate elements in sets does not affect the basic operations of sets, such as adding and removing elements. However, it does affect the behavior of certain operations, such as finding the union or intersection of two sets. In these cases, duplicate elements are only counted once.

4. Are there any downsides to having duplicate elements in sets?

Having duplicate elements in sets can lead to confusion and unexpected results if the programmer is not aware of this feature. It can also affect the efficiency of some algorithms that rely on sets, as duplicate elements may need to be filtered out before performing certain operations.

5. How can I check for and remove duplicate elements in a set?

If you want to ensure that your set does not contain duplicate elements, you can use the built-in function or method in your programming language to remove duplicates. For example, in Python, you can use the set() function to create a new set from a list, which automatically removes duplicates. You can also use a loop to iterate through the set and remove any duplicate elements manually.

Similar threads

  • Set Theory, Logic, Probability, Statistics
Replies
7
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
14
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
1
Views
778
  • Set Theory, Logic, Probability, Statistics
Replies
20
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
10
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
14
Views
3K
  • General Math
Replies
1
Views
752
  • Set Theory, Logic, Probability, Statistics
Replies
5
Views
1K
  • High Energy, Nuclear, Particle Physics
Replies
7
Views
1K
  • Set Theory, Logic, Probability, Statistics
2
Replies
40
Views
6K
Back
Top