notebook/notes/set/bags.md

144 lines
5.8 KiB
Markdown

---
title: Bags
TARGET DECK: Obsidian::STEM
FILE TAGS: set::bag
tags:
- bag
- set
---
## Overview
Sets can contain the same element only once. This means $\{1, 1\} = \{1\}$. A **bag** (or **multiset**) can include a single element multiple times.
%%ANKI
Basic
What is a bag?
Back: A set in which we are allowed to include a single element multiple times.
Reference: “Multiset,” in _Wikipedia_, April 4, 2024, [https://en.wikipedia.org/w/index.php?title=Multiset&oldid=1217165725](https://en.wikipedia.org/w/index.php?title=Multiset&oldid=1217165725).
<!--ID: 1720360266774-->
END%%
%%ANKI
Basic
What alternative term do "bags" go by?
Back: Multisets.
Reference: “Multiset,” in _Wikipedia_, April 4, 2024, [https://en.wikipedia.org/w/index.php?title=Multiset&oldid=1217165725](https://en.wikipedia.org/w/index.php?title=Multiset&oldid=1217165725).
<!--ID: 1720360266800-->
END%%
%%ANKI
Cloze
The {multiplicity} of an element in a bag is the {number of instances given for that element}.
Reference: “Multiset,” in _Wikipedia_, April 4, 2024, [https://en.wikipedia.org/w/index.php?title=Multiset&oldid=1217165725](https://en.wikipedia.org/w/index.php?title=Multiset&oldid=1217165725).
<!--ID: 1720360266806-->
END%%
%%ANKI
Basic
How many bags exist with members $a$ and $b$?
Back: An infinite amount.
Reference: “Multiset,” in _Wikipedia_, April 4, 2024, [https://en.wikipedia.org/w/index.php?title=Multiset&oldid=1217165725](https://en.wikipedia.org/w/index.php?title=Multiset&oldid=1217165725).
<!--ID: 1720360266813-->
END%%
%%ANKI
Basic
What is the multiplicity of $a$ in bag $\{a, b\}$?
Back: $1$
Reference: “Multiset,” in _Wikipedia_, April 4, 2024, [https://en.wikipedia.org/w/index.php?title=Multiset&oldid=1217165725](https://en.wikipedia.org/w/index.php?title=Multiset&oldid=1217165725).
<!--ID: 1720360266819-->
END%%
%%ANKI
Basic
What is the multiplicity of $a$ in bag $\{a, a, a, b, b, c\}$?
Back: $3$
Reference: “Multiset,” in _Wikipedia_, April 4, 2024, [https://en.wikipedia.org/w/index.php?title=Multiset&oldid=1217165725](https://en.wikipedia.org/w/index.php?title=Multiset&oldid=1217165725).
<!--ID: 1720360266825-->
END%%
%%ANKI
Basic
What distinguishes a bag from a tuple?
Back: Order is irrelevant in the former.
Reference: “Multiset,” in _Wikipedia_, April 4, 2024, [https://en.wikipedia.org/w/index.php?title=Multiset&oldid=1217165725](https://en.wikipedia.org/w/index.php?title=Multiset&oldid=1217165725).
<!--ID: 1720360266830-->
END%%
%%ANKI
Basic
What is the cardinality of $a$ in bag $\{a, a, a, b, b, c\}$?
Back: N/A. Cardinality applies to bags, not members.
Reference: “Multiset,” in _Wikipedia_, April 4, 2024, [https://en.wikipedia.org/w/index.php?title=Multiset&oldid=1217165725](https://en.wikipedia.org/w/index.php?title=Multiset&oldid=1217165725).
<!--ID: 1720360266835-->
END%%
%%ANKI
Basic
What is the cardinality of bag $\{a, a, a, b, b, c\}$?
Back: $6$
Reference: “Multiset,” in _Wikipedia_, April 4, 2024, [https://en.wikipedia.org/w/index.php?title=Multiset&oldid=1217165725](https://en.wikipedia.org/w/index.php?title=Multiset&oldid=1217165725).
<!--ID: 1720360266840-->
END%%
%%ANKI
Basic
How is the cardinality of a bag calculated?
Back: By summing the multiplicities of each member.
Reference: “Multiset,” in _Wikipedia_, April 4, 2024, [https://en.wikipedia.org/w/index.php?title=Multiset&oldid=1217165725](https://en.wikipedia.org/w/index.php?title=Multiset&oldid=1217165725).
<!--ID: 1720360266845-->
END%%
%%ANKI
Basic
When viewed as a function, a multiset has domain what?
Back: The set comprising each member of the multiset.
Reference: “Multiset,” in _Wikipedia_, April 4, 2024, [https://en.wikipedia.org/w/index.php?title=Multiset&oldid=1217165725](https://en.wikipedia.org/w/index.php?title=Multiset&oldid=1217165725).
<!--ID: 1720360266850-->
END%%
%%ANKI
Basic
When viewed as a function, a multiset has range what?
Back: The set comprising the multiplicities of the multiset's members.
Reference: “Multiset,” in _Wikipedia_, April 4, 2024, [https://en.wikipedia.org/w/index.php?title=Multiset&oldid=1217165725](https://en.wikipedia.org/w/index.php?title=Multiset&oldid=1217165725).
<!--ID: 1720360266856-->
END%%
%%ANKI
Basic
When viewed as a function, a multiset has codomain what?
Back: The positive integers.
Reference: “Multiset,” in _Wikipedia_, April 4, 2024, [https://en.wikipedia.org/w/index.php?title=Multiset&oldid=1217165725](https://en.wikipedia.org/w/index.php?title=Multiset&oldid=1217165725).
<!--ID: 1720360266861-->
END%%
%%ANKI
Basic
Do all multisets correspond to sets?
Back: No.
Reference: “Multiset,” in _Wikipedia_, April 4, 2024, [https://en.wikipedia.org/w/index.php?title=Multiset&oldid=1217165725](https://en.wikipedia.org/w/index.php?title=Multiset&oldid=1217165725).
<!--ID: 1720360266867-->
END%%
%%ANKI
Basic
Do all sets correspond to multisets?
Back: Yes.
Reference: “Multiset,” in _Wikipedia_, April 4, 2024, [https://en.wikipedia.org/w/index.php?title=Multiset&oldid=1217165725](https://en.wikipedia.org/w/index.php?title=Multiset&oldid=1217165725).
<!--ID: 1720360266873-->
END%%
%%ANKI
Basic
Under what condition is a bag also a set?
Back: When the multiplicity of each element in the bag is $1$.
Reference: “Multiset,” in _Wikipedia_, April 4, 2024, [https://en.wikipedia.org/w/index.php?title=Multiset&oldid=1217165725](https://en.wikipedia.org/w/index.php?title=Multiset&oldid=1217165725).
<!--ID: 1720360266878-->
END%%
## Bibliography
* “Multiset,” in _Wikipedia_, April 4, 2024, [https://en.wikipedia.org/w/index.php?title=Multiset&oldid=1217165725](https://en.wikipedia.org/w/index.php?title=Multiset&oldid=1217165725).
* Oscar Levin, *Discrete Mathematics: An Open Introduction*, 3rd ed., n.d., [https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf](https://discrete.openmathbooks.org/pdfs/dmoi3-tablet.pdf).