---
date: '2024-12-13'
description: also known as multiset.
id: bags
modified: 2026-09-28 09:05:52 GMT-04:00
noindex: true
tags:
  - math
title: bags
created: '2024-12-13'
published: '2024-12-13'
pageLayout: default
slug: thoughts/bags
permalink: https://aarnphm.xyz/thoughts/bags.md
generator:
  quartz: v4.6.0
  hostedProvider: Cloudflare
  baseUrl: aarnphm.xyz
full: https://aarnphm.xyz/llms-full.txt
---
> \[!abstract\] definition
>
> A bag, or _multiset_, records how many times each element occurs. Order does not matter.[^multiset]

Using double braces for bags, $\{\!\{1,2,3,1,1\}\!\}$ contains three copies of $1$ and one each of $2$ and $3$. Reordering those entries gives the same bag.

The bag $\{\!\{1,2,3\}\!\}$ contains each element once. An ordinary set can be viewed this way. With ordinary set braces, repeated entries have no effect: $\{1,2,3,1,1\}=\{1,2,3\}$.

[^multiset]: Cornell CS 312, [A multiset data structure](https://www.cs.cornell.edu/courses/cs312/2005sp/hw/ps3/ps3.htm).

