# Assistance on figuring out the range of a function.

I need help on figuring out the range of functions. By range of function, I mean the type of range where it's not just seeing from graphs and getting something like range $= \{1,2,3,4\}$ but those complicated type such as below:

Let $A$ be the set of all non-empty subsets of $\{1, 2, \ldots, 10\}$ and let $f$ be the following functions.

$f:A \to a - b$, where $a$ is the largest element of $X$ and $b$ is the smallest element of $X$.

What is the range of $f$?

Solution: the range of $f$ is $\{0, 1, \ldots, 9\}$

Could anyone explain to me on how the range is obtained as such? Also, I've seen many functions in examples having really complicated ranges such as $\{(0,1)\} \cup (\{x^2 :x \in \mathbb{Z}, x \geq 1\} \times \{-1,1\})$. I mean, how could I know how to figure out a range this complicated?

Would really appreciate if someone could break it down for me with some examples.

• Just some advice: Get your hands dirty. Make sure you understand how your function works and plug in a bunch of values. Maybe study an easier function which does the same thing, but it's domain is only the nonempty subsets of $\{1, 2, 3, 4 \}$ and try to list all the possible ordered pairs to find the outputs. – Ovi Jun 6 '17 at 6:03
• Please read this tutorial on how to typeset mathematics on this site. – N. F. Taussig Jun 6 '17 at 9:48

We have to show that for any $n$ between $0$ and $9$, there exists $A$ in the domain of $f$ so that $f(A)=n$. Indeed, the set $A = \{1,n+1\}$ works. Note that if $0\leq n \leq 9$, then $n+1\in \{1,2,...,10\}$. Further, for any $A$, we have $f(A) \geq 0$, and $f(A) \leq 10-1 = 9$. So the range is $\{0,2,...,9\}$.
• We are supposed to show that the range is $\{0, 1, \ldots, 9\}$. To obtain the missing element, consider singleton sets. – N. F. Taussig Jun 6 '17 at 9:47