---
date: "2026-11-30"
title: "Sets and Functions"
---


**Part of [Math Camp: An Introduction to Mathematics and Statistics with Applications in Economics](https://fanwangecon.github.io/Stam4Econ/).**  
[Main Stam4Econ site](https://fanwangecon.github.io/Stam4Econ/) | [View this section in the book](https://fanwangecon.github.io/Stam4Econ/math_set/set_function.html) | [Author: Fan Wang](https://fanwangecon.github.io/) | [DOI: 10.5281/zenodo.24696926](https://doi.org/10.5281/zenodo.24696926)  
Date: 2026-11-30 | [HTML](https://fanwangecon.github.io/Stam4Econ/htmlpdfq/math_set/set_function.html) | [PDF](https://fanwangecon.github.io/Stam4Econ/htmlpdfq/math_set/set_function.pdf) | [QMD](https://fanwangecon.github.io/Stam4Econ/htmlpdfq/math_set/set_function.qmd)

## Sets

- $\mathbb{R}$ is the set of real numbers
- $\mathbb{Z}$ is the set of integers
- $\mathbb{N}$ is the set of natural numbers
- $\mathbb{Q}$ is the set of rational numbers, quotients of integers

And:

- Set $A$
- $\emptyset$ is the empty set
- $x \in A$
- $A \nsubseteq B$
- $A \subseteq B$
- $A \cup B = \left\{ x \mid x \in A \text{ or } x \in B\right\}$
- $A \cap B = \left\{ x \mid x \in A \text{ and } x \in B\right\}$
- $A$ and $B$ are disjoint if $A \cap B = \emptyset$
- Events $A_1, A_2 , \dots$ are a partition of $S$ if they are mutually disjoint and their union is $S$.
- $B \setminus A$ is the complement of A in B
- $A \setminus \left\{X_0\right\}$ denotes the set of points in $A$ not equal to $X_0$

## Function 

Function from $A$ to $B$: each point in $A$ corresponds to exactly one point in $B$, denoted as:

$$
f: A \to B
$$

- $f(a) = b$
- $A$ is the domain, and $f(A)$ is the image. 

$$
f(A) = \left\{ b \mid b = f(a), a \in A \right\}
$$

If for each point $y$ in $f(A)$, there is exactly one point $x$ in $A$ such that $y=f(x)$, then $f$ is one-to-one and invertible. The inverse is denoted as:

$$
f^{-1}: f(A) \to A
$$

## Example 

The following example is based on @nygaard_sorensen_wang_2022.

Consider the problem of a planner whose objective is to allocate a discrete amount of resources, $D_g$, among $N$ groups indexed by $g$.  The constraint set is

$$
\mathbb{C}^D \equiv \Bigg\{D_g \in \mathbb{N}_0, \underline{D}_g \le D_g \le \overline{D}_g,\sum_{g=1}^ND_g\leq {W}\Bigg\},
$$

where ${W}$ is an integer equal to the number of increments that fits within the budget, and $\underline{D}_g$ and $\overline{D}_g$ are the lower and upper bounds for each group's allocation, respectively.

We define the solution to the discrete optimal allocation problem as follows. Given $N$ groups, the solution to the discrete optimal allocation problem is a set of allocation functions 
$$
D_j^*\left({W},\lambda,\left\{\beta_g\right\}_{g=1}^N,\left\{\underline{D}_g,\overline{D}_g\right\}_{g=1}^N\right) : \mathbb{N}\times(-\infty,1]\times(0,1)^N \times\mathbb{N}_0^{2N} \rightarrow \left\{\underline{D}_j,\underline{D}_j+1,\dots,\overline{D}_j\right\}
$$
such that the vector $(D_1^*,...,D_N^*)$ satisfies some optimality conditions.

Note that:

- $\lambda$ and $\left\{\beta_g\right\}_{g=1}^N$ are parameters related to preferences, and $W$ and $\left\{\underline{D}_g,\overline{D}_g\right\}_{g=1}^N$ are parameters related to resource constraints.
- $j$ and $g$ both denote group indices, but we use separate letters due to nesting.
- The optimal decision for one group depends on constraints and preferences for all groups.