# rose learns.to('code');

## Set Representation

• Listing method
• Set builder notation (rules of inclusion)

## Listing Method

Representing a set S using the listing method consists of listing all the elements of S.

S1 = set of all vowels in the English alphabet

S1 = {a, e, i, o, u} (listing method)

S2 = set of all positive integers less than 10

S2 = {1,2,3,4,5,6,7,8,9} (listing method)

S3 = set of all positive even integers less than 10

S3 = {2,4,6,8} (listing method)

## Set Builder Notation

Assume we want to describe the set of all even integers.

Even\,=\{2n|n\,\in\,Z\}\\set \,builder\,notation
• the set of elements of two times n, such that n is an element of Z

Quick Review: Z = set of integers = {… , -3, -2, -1, 0, 1, 2, 3, …}

Assume we want to describe the set of all odd integers:

Odd\,=\,\{2n+1|n\,\in\,Z\}

Assume we want to describe the set of rational numbers Q.

Q={…,1/1,1/2,1/3,1/4,…}

We can’t really represent this set accurately using the listing method. However, using the set-builder method, we can represent Q more accurately as follow. We can write Q is the set of elements of the form n over m, such that n and m are elements of Z and m is different from zero.

Q\,=\,\{\frac{n}{m}|n,m\,\in\,Z\,and\,m\,\neq\,0\}

Quick Review: | means “such that” or “whereas”, x|x is in my bag means x such that x is in my bag. x|x is an odd number means x whereas x is an odd number.

Bag\,=\,\{pen,book,laptop,...\}\\Bag\,=\,\{x|x\,is\,in\,my\,bag\}

## Examples:

S1\,=\,\{3n|n\,\in\,N\,and\,n<6\}\\S1\,=\,\{3*1,3*2,3*3,3*4,3*5\}\\n\,=\,1,2,3,4,5\\S1\,=\,\{3,6,9,12,15\}

Quick Review:

• means less than or equal to
• Z is a set of integers
S2\,=\,\{2^n|n\,\in\,Z\,and\,0\,\leq\,n\leq\,4\}
• n is in the set Z (integer)
• n is more then or equal to 0
• n is less than or equal to 4
• n = {0, 1, 2, 3, 4}
S2\,=\,\{2^0,2^1,2^2,2^3,2^4\}\\2^0\,=\,1\\2^1\,=\,2*1\,=\,2\\2^2\,=\,2 *2\,=\,4\\2^3\,=\,2*2*2\,=\,8\\2^4\,=\,2*2*2*2\,=\,16\\Therefore,also:\\S2\,=\,\{1,2,4,8,16\}

Quick Review:

Negative Exponents

S3\,=\,\{2^{-n}|n\,\in\,Z\,and\,0\,\leq\,n\,<\,8\}
• n is in set Z (integers)
• n is more than or equal to 0
• n is less than 8
• n(-)
• n = {0, -1, -2, -3, -4, -5, -6, -7}
S3\,=\,\{2^0,2^{-1},2^{-2},2^{-3},2^{-4},2^{-5},2^{-6},2^{-7}\}\\S3\,=\,\{1,(\frac{1}{2}),(\frac{1}{2*2}),(\frac{1}{2*2*2}),(\frac{1}{2*2*2*2}),(\frac{1}{2*2*2*2*2}),(\frac{1}{2*2*2*2*2*2}),(\frac{1}{2*2*2*2*2*2*2})\}\\S3\,=\,\{1,\frac{1}{2},\frac{1}{8},\frac{1}{16},\frac{1}{32},\frac{1}{64},\frac{1}{128}\}

## Sample Exercises

Rewrite the following sets using the set builder method:

Problem 1:

S_1\,=\,\{\frac{1}{2},\frac{1}{4},\frac{1}{6},\frac{1}{8},\frac{1}{10}\}

Solution:

S_1\,=\,\{\frac{1}{2n}|n\,\in\,Z\,and\,0\,<\,n\,\leq\,5\}

Problem 2

S_2\,=\,\{1, 2,4,8,16,32,64,128\}

Solution:

S_2\,=\,\{2^n|n\,\in\,Z\,and\,0\,\leq\,n\,<\,8\}

Problem 3

S_3\,=\,\{...,-9,-6,-3,0,3,6,9...\}

Solution

S_3\,=\,\{3n|n\,\in\,Z\}\\because\;of\;the\;...\,no\;need\;for:\\and\,{-3}\,\leq\,n\,\leq\,3