Skip to content

Unit 1: Sets

Definition. A set is a collection of objects. The objects in the set are called its elements or members. Order does not matter, and repeating an element does not change the set.

We use capital letters to denote sets, and lowercase elements to denote their elements. The statement a∈Aa\in A means that aa is an element of AA. If aa is not an element of AA, write a∉Aa\notin A. For a finite set, ∣A∣\lvert A\rvert is the number of distinct elements in AA, also known as the size or cardinality.

Sets ignore both order and repetition. For example,

{1,2,3}={3,2,1}={1,1,2,3,3}.\{1,2,3\}=\{3,2,1\}=\{1,1,2,3,3\}.

All three expressions describe the same set because they have exactly the same members. Each set still has cardinality 33 (including the last set).

The empty set, written ∅\varnothing or {}\{\}, is defined as a set with no elements. A singleton is a set that has exactly one element. If you have nested sets (a set within a set), you count that set as one element. For example,

∣∅∣=0,∣{∅}∣=1.\lvert\varnothing\rvert=0, \qquad \lvert\{\varnothing\}\rvert=1.

Note that the second set is not empty (Its one element is ∅\varnothing (the empty set)) and thus has a cardinality of 11.

// add the universal set here

There are two common ways to describe a set:

  • Roster notation lists the elements: A={1,4,7}A=\{1,4,7\}.
  • Set-builder notation describes a property the elements satisfy: A={x∈Z∣1≤x≤7 and x is odd}A=\{x\in\mathbb Z\mid 1\leq x\leq 7\text{ and }x\text{ is odd}\}.

The symbol ∣\mid in set-builder notation means “such that.” The expression before it gives the form of an element, and the condition after it decides whether that element belongs to the set.

Roster notation is most useful when the list is short or follows an unmistakable pattern. Set-builder notation is better when the membership rule is more important than the list itself. For instance,

{m∈Z∣mn=60 for some n∈Z}\{m\in\mathbb Z\mid mn=60\text{ for some }n\in\mathbb Z\}

is the set of all integer divisors of 6060 (Z\mathbb Z means the set of integers). In roster form, the same set is

{−60,−30,−20,−15,−12,−10,−6,−5,−4,−3,−2,−1,1,2,3,4,5,6,10,12,15,20,30,60}.\{-60,-30,-20,-15,-12,-10,-6,-5,-4,-3,-2,-1, 1,2,3,4,5,6,10,12,15,20,30,60\}.

// this list goes off the page, please change to a smaller number so the list is smaller

// add subset notation somewhere above because you list it below in laters sections but don’t introduce it here

Example. Rewrite A={x∈Z∣x2<10}A=\{x\in\mathbb Z\mid x^2<10\} using roster notation.

The integers whose squares are less than 1010 are −3,−2,−1,0,1,2,3-3,-2,-1,0,1,2,3. Therefore,

A={−3,−2,−1,0,1,2,3}.A=\{-3,-2,-1,0,1,2,3\}.

In set theory, we use many standard number systems.

N={1,2,3,…},\mathbb N=\{1,2,3,\ldots\}, Z={…,−2,−1,0,1,2,…},\mathbb Z=\{\ldots,-2,-1,0,1,2,\ldots\}, Q={ab∣a,b∈Z, b≠0},\mathbb Q=\left\{\frac{a}{b}\mid a,b\in\mathbb Z,\ b\neq0\right\}, R={real numbers},\mathbb R=\{\text{real numbers}\},

and

C={a+bi∣a,b∈R, i2=−1}.\mathbb C=\{a+bi\mid a,b\in\mathbb R,\ i^2=-1\}.

They satisfy

N⊆Z⊆Q⊆R⊆C.\mathbb N\subseteq\mathbb Z\subseteq\mathbb Q\subseteq\mathbb R\subseteq\mathbb C.

Definition. A set is well-defined if every object either belongs to the set or does not belong to it, but not both.

The definition basically means that a well-defined set is very precise so that the values in the set can be determined with no ambiguity, regardless of how difficult it is to actual list out all of the values in the set. The set of prime numbers larger than one million is well-defined; the set of “large numbers” is not unless large is given a precise meaning.

There is also a difference between a difficult membership test and a flawed definition. Consider

A={n∈N∣n appears somewhere in the decimal expansion of π}.A=\{n\in\mathbb N\mid n\text{ appears somewhere in the decimal expansion of }\pi\}.

For a very long value of nn, checking membership may be practically impossible. Still, that string either appears or does not appear, so the set is well-defined. By contrast,

B={q∈Q∣q has denominator greater than 100}B=\{q\in\mathbb Q\mid q\text{ has denominator greater than }100\}

is ambiguous unless a particular representation is specified. The same rational number has many denominators:

12=51102.\frac12=\frac{51}{102}.

The description would place 1/21/2 both outside and inside BB depending on how it is written. Requiring lowest terms with a positive denominator would make the condition precise.


Set-builder notation and proofs both rely on statements that can be true or false.

Definition. A proposition is a declarative statement with exactly one truth value: true or false.

For propositions pp and qq, the main logical operations are:

OperationNotationMeaning
Negation¬p\neg pnot pp
Conjunctionp∧qp\land qpp and qq
Disjunctionp∨qp\lor qpp or qq, inclusively
Conditionalp⇒qp\Rightarrow qif pp, then qq
Biconditionalp⇔qp\Leftrightarrow qpp if and only if qq

A conditional is false only when its hypothesis is true and its conclusion is false. In particular, if pp is false, then p⇒qp\Rightarrow q is true regardless of qq; this is called vacuous truth.

One way to understand this is to treat a conditional as a promise: “whenever pp happens, qq happens.” The promise is broken only if pp happens without qq. If pp never happens, there is no counterexample to the promise. This convention is what makes statements such as

x∈∅⇒x∈Ax\in\varnothing\Rightarrow x\in A

true for every set AA. There is no element of ∅\varnothing that could violate the implication, so ∅⊆A\varnothing\subseteq A for every set AA.

When doing logic problems, we often write out the statements using a truth table:

ppqqp∧qp\land qp∨qp\lor qp⇒qp\Rightarrow qp⇔qp\Leftrightarrow q
TTTTTT
TFFTFF
FTFTTF
FFFFTT

Here, “or” is inclusive: p∨qp\lor q is true when one statement is true or when both are true.

The statement q⇒pq\Rightarrow p is the converse of p⇒qp\Rightarrow q. The statement ¬p⇒¬q\neg p\Rightarrow\neg q is its inverse. Neither is automatically equivalent to the original conditional. The contrapositive, ¬q⇒¬p\neg q\Rightarrow\neg p, is equivalent.

Example. Let pp be the statement “an integer is divisible by 44” and let qq be the statement “the integer is even.” Write the conditional, converse, inverse, and contrapositive, and decide which are true.

The original conditional is

p⇒q:if an integer is divisible by 4, then it is even.p\Rightarrow q: \quad \text{if an integer is divisible by }4,\text{ then it is even}.

This is true. Its contrapositive is also true:

¬q⇒¬p:if an integer is odd, then it is not divisible by 4.\neg q\Rightarrow\neg p: \quad \text{if an integer is odd, then it is not divisible by }4.

The converse says that every even integer is divisible by 44, which is false because 22 is even but not divisible by 44. The inverse is false for the same reason: 22 is not divisible by 44, but it is even.

The symbol ∀\forall means “for every,” while ∃\exists means “there exists.” If P(x)P(x) is a property of elements in a domain DD, then

∀x∈D, P(x)\forall x\in D,\ P(x)

claims that every element of DD has the property, while

∃x∈D such that P(x)\exists x\in D\text{ such that }P(x)

claims that at least one does.

The order of quantifiers changes the meaning. Compare

∀x∈R, ∃y∈R such that x+y=0\forall x\in\mathbb R,\ \exists y\in\mathbb R\text{ such that }x+y=0

with

∃y∈R such that ∀x∈R, x+y=0.\exists y\in\mathbb R\text{ such that }\forall x\in\mathbb R,\ x+y=0.

The first statement is true: after xx is chosen, take y=−xy=-x. The second is false because it asks for one fixed number yy that cancels every real number at once. In the first statement, yy may depend on xx; in the second, it may not.

// put this notation in the first section (the notation of “for every”, “there exists”)

Negating a quantified statement switches the quantifier:

¬(∀x∈D, P(x))≡∃x∈D such that ¬P(x),\neg\left(\forall x\in D,\ P(x)\right) \equiv \exists x\in D\text{ such that }\neg P(x), ¬(∃x∈D such that P(x))≡∀x∈D, ¬P(x).\neg\left(\exists x\in D\text{ such that }P(x)\right) \equiv \forall x\in D,\ \neg P(x).

Example. Negate the statement “every real number has a real square root.”

Write the statement as

∀x∈R, ∃y∈R such that y2=x.\forall x\in\mathbb R,\ \exists y\in\mathbb R\text{ such that }y^2=x.

Switch each quantifier and negate the final property:

∃x∈R such that ∀y∈R, y2≠x.\exists x\in\mathbb R\text{ such that }\forall y\in\mathbb R,\ y^2\neq x.

In words, “there is a real number that is not the square of any real number.” This negation is true; x=−1x=-1 is a counterexample to the original statement.


Let AA and BB be subsets of a universal set UU.

Definition. The main set operations are

A∪B={x∣x∈A or x∈B},A\cup B=\{x\mid x\in A\text{ or }x\in B\}, A∩B={x∣x∈A and x∈B},A\cap B=\{x\mid x\in A\text{ and }x\in B\}, A×B={(a,b)∣a∈A and b∈B},A\times B=\{(a,b)\mid a\in A\text{ and }b\in B\}, Ac={x∈U∣x∉A},A^c=\{x\in U\mid x\notin A\},

and the symmetric difference

A△B=(A∩Bc)∪(Ac∩B).A\mathbin{\triangle}B=(A\cap B^c)\cup(A^c\cap B).

The union contains elements in at least one set. The intersection contains elements shared by both. The symmetric difference contains elements in exactly one of the two sets.

// put this in the first section

// add a better intro after moving the set operations

These operations are set versions of the logical operations above. Membership in a union uses “or,” membership in an intersection uses “and,” and membership in a complement uses “not”:

x∈A∪B⟺(x∈A)∨(x∈B),x\in A\cup B\Longleftrightarrow (x\in A)\lor(x\in B), x∈A∩B⟺(x∈A)∧(x∈B),x\in A\cap B\Longleftrightarrow (x\in A)\land(x\in B), x∈Ac⟺¬(x∈A).x\in A^c\Longleftrightarrow \neg(x\in A).

This translation is why logical identities turn into set identities. De Morgan’s law for propositions and De Morgan’s law for sets are the same pattern written in two languages.

The set difference B∖AB\setminus A contains the elements of BB that are not in AA:

B∖A=B∩Ac.B\setminus A=B\cap A^c.

Unlike union and intersection, set difference is not symmetric. Usually,

B∖A≠A∖B.B\setminus A\neq A\setminus B.

Example. Let U={1,2,3,4,5,6}U=\{1,2,3,4,5,6\}, A={1,2,3}A=\{1,2,3\}, and B={2,3,4}B=\{2,3,4\}. Find A∪BA\cup B, A∩BA\cap B, AcA^c, and A△BA\mathbin{\triangle}B.

Combining all distinct elements gives

A∪B={1,2,3,4}.A\cup B=\{1,2,3,4\}.

The shared elements are

A∩B={2,3}.A\cap B=\{2,3\}.

The elements of the universe outside AA are

Ac={4,5,6}.A^c=\{4,5,6\}.

Finally, the elements belonging to exactly one set are

A△B={1,4}.A\mathbin{\triangle}B=\{1,4\}.

An element of A×BA\times B is an ordered pair, so position matters. If

A={1,2}andB={x,y},A=\{1,2\} \qquad\text{and}\qquad B=\{x,y\},

then

A×B={(1,x),(1,y),(2,x),(2,y)}.A\times B=\{(1,x),(1,y),(2,x),(2,y)\}.

The first coordinate must come from AA and the second from BB. Consequently, A×BA\times B and B×AB\times A usually contain different objects. For finite sets,

∣A×B∣=∣A∣∣B∣,\lvert A\times B\rvert=\lvert A\rvert\lvert B\rvert,

because each of the ∣A∣\lvert A\rvert choices for the first coordinate can be paired with each of the ∣B∣\lvert B\rvert choices for the second.

Cartesian products become important immediately in linear algebra. For example,

R2=R×R\mathbb R^2=\mathbb R\times\mathbb R

is the set of all ordered pairs (x,y)(x,y), while R3\mathbb R^3 is the set of all ordered triples. A point, a vector, and a list of coordinates can all be viewed as elements of a Cartesian product.


Definition. The set AA is a subset of BB, written A⊆BA\subseteq B, if every element of AA is also an element of BB:

A⊆B⟺∀x (x∈A⇒x∈B).A\subseteq B \quad\Longleftrightarrow\quad \forall x\,(x\in A\Rightarrow x\in B).

If A⊆BA\subseteq B and A≠BA\neq B, then AA is a proper subset of BB, written A⊊BA\subsetneq B.

Membership and containment are different kinds of statements. If

A={1,2,3},A=\{1,2,3\},

then 1∈A1\in A, but 1⊆A1\subseteq A makes no sense unless 11 has separately been defined as a set. On the other hand, {1}⊆A\{1\}\subseteq A, but {1}∉A\{1\}\notin A because the members of AA are numbers, not singleton sets.

A superset statement reverses the same relationship:

A⊇B⟺B⊆A.A\supseteq B\quad\Longleftrightarrow\quad B\subseteq A.

Containment is transitive. If every element of AA lies in BB and every element of BB lies in CC, then every element of AA must lie in CC.

Proof (Transitivity of subsets). Suppose A⊆BA\subseteq B and B⊆CB\subseteq C. Let x∈Ax\in A. Since A⊆BA\subseteq B, we have x∈Bx\in B. Since B⊆CB\subseteq C, this gives x∈Cx\in C. Therefore, every element of AA belongs to CC, so

A⊆C.A\subseteq C.

Set equality is proved by mutual containment:

A=B⟺A⊆B and B⊆A.A=B \quad\Longleftrightarrow\quad A\subseteq B\text{ and }B\subseteq A.

Proof (De Morgan’s Law for sets). We prove

(A∪B)c=Ac∩Bc.(A\cup B)^c=A^c\cap B^c.

Let x∈(A∪B)cx\in(A\cup B)^c. Then x∉A∪Bx\notin A\cup B, so xx is not in AA and is not in BB. Therefore, x∈Ac∩Bcx\in A^c\cap B^c, which proves

(A∪B)c⊆Ac∩Bc.(A\cup B)^c\subseteq A^c\cap B^c.

Conversely, let x∈Ac∩Bcx\in A^c\cap B^c. Then x∉Ax\notin A and x∉Bx\notin B, so x∉A∪Bx\notin A\cup B. Thus, x∈(A∪B)cx\in(A\cup B)^c, proving the reverse containment. Therefore,

(A∪B)c=Ac∩Bc.(A\cup B)^c=A^c\cap B^c.

Proof (Cartesian product distributes over union). We prove

(A∪B)×C=(A×C)∪(B×C).(A\cup B)\times C=(A\times C)\cup(B\times C).

Let (x,y)∈(A∪B)×C(x,y)\in(A\cup B)\times C. Then x∈A∪Bx\in A\cup B and y∈Cy\in C. The first statement means x∈Ax\in A or x∈Bx\in B. Therefore, either (x,y)∈A×C(x,y)\in A\times C or (x,y)∈B×C(x,y)\in B\times C, so

(x,y)∈(A×C)∪(B×C).(x,y)\in(A\times C)\cup(B\times C).

This proves the forward containment. For the reverse, let

(x,y)∈(A×C)∪(B×C).(x,y)\in(A\times C)\cup(B\times C).

Then (x,y)(x,y) lies in at least one of the two products. In either case, x∈A∪Bx\in A\cup B and y∈Cy\in C. Hence, (x,y)∈(A∪B)×C(x,y)\in(A\cup B)\times C. The two containments prove the sets are equal.

Proof (Symmetric difference detects equality). We prove that

A△B=∅⟺A=B.A\mathbin{\triangle}B=\varnothing \quad\Longleftrightarrow\quad A=B.

Suppose A△B=∅A\mathbin{\triangle}B=\varnothing. If some element belonged to AA but not BB, or to BB but not AA, it would belong to the symmetric difference. Since the symmetric difference is empty, neither kind of mismatch exists. Thus, AA and BB have exactly the same elements, so A=BA=B.

Conversely, if A=BA=B, no element can belong to exactly one of the sets. Therefore, their symmetric difference has no elements:

A△B=∅.A\mathbin{\triangle}B=\varnothing.

Proof (A set described by squares). Let

A={x∈R∣x≥0}A=\{x\in\mathbb R\mid x\geq0\}

and

B={z∈R∣∃y∈R such that y2=z}.B=\{z\in\mathbb R\mid \exists y\in\mathbb R\text{ such that }y^2=z\}.

We prove A=BA=B. If x∈Ax\in A, then x≥0x\geq0, so x∈R\sqrt{x}\in\mathbb R and (x)2=x(\sqrt{x})^2=x. Hence, x∈Bx\in B, and therefore A⊆BA\subseteq B.

If x∈Bx\in B, then x=y2x=y^2 for some real number yy. Every real square is nonnegative, so x≥0x\geq0 and x∈Ax\in A. Therefore, B⊆AB\subseteq A, and A=BA=B.


The objects studied in linear algebra are often collected into sets of their own. If AA is a set of allowed coefficients, then

A[x]={anxn+⋯+a1x+a0∣n∈N, ai∈A}A[x]=\{a_nx^n+\cdots+a_1x+a_0\mid n\in\mathbb N,\ a_i\in A\}

is the set of polynomials with coefficients in AA. The notation

An[x]={f(x)∈A[x]∣deg⁡f<n}A_n[x]=\{f(x)\in A[x]\mid \deg f<n\}

restricts the degree.

The set of all m×nm\times n matrices with entries in AA is

Mm×n(A)={[a11⋯a1n⋮⋱⋮am1⋯amn]∣aij∈A}.M_{m\times n}(A) = \left\{ \begin{bmatrix} a_{11}&\cdots&a_{1n}\\ \vdots&\ddots&\vdots\\ a_{m1}&\cdots&a_{mn} \end{bmatrix} \mathrel{\mid} a_{ij}\in A \right\}.

When m=nm=n, this is often shortened to Mn(A)M_n(A).

Another useful example is

Cn(R)={f:R→R∣f has continuous derivatives through order n}.C^n(\mathbb R)=\{f:\mathbb R\to\mathbb R\mid f\text{ has continuous derivatives through order }n\}.

These examples look different, but each is still just a set: membership is determined by a precise rule.

Example. Decide which of the following objects belong to M2×3(R)M_{2\times3}(\mathbb R):

P=[10−23π5],Q=[123456],R=[10i234].P=\begin{bmatrix}1&0&-2\\3&\pi&5\end{bmatrix}, \qquad Q=\begin{bmatrix}1&2\\3&4\\5&6\end{bmatrix}, \qquad R=\begin{bmatrix}1&0&i\\2&3&4\end{bmatrix}.

The matrix PP has two rows, three columns, and only real entries, so

P∈M2×3(R).P\in M_{2\times3}(\mathbb R).

The matrix QQ has the wrong shape: it is 3×23\times2. The matrix RR has the correct shape, but i∉Ri\notin\mathbb R. Therefore,

Q,R∉M2×3(R).Q,R\notin M_{2\times3}(\mathbb R).

This example shows how a complicated-looking set-builder definition becomes a checklist for membership: check the dimensions, then check every entry.


A proof is not just a calculation that ends at the right formula. It is a chain of statements in which each step follows from a definition, an assumption, or an earlier result. The form of the claim usually suggests the proof method.

  • For a universal statement, begin with an arbitrary object satisfying the hypothesis.
  • For an existence statement, construct one object and verify it works.
  • For a set equality, prove both containments.
  • For an implication, try a direct proof or its contrapositive.
  • If the negation forces an impossibility, use contradiction.
  • If the statement is indexed by natural numbers, induction may connect one case to the next.

A direct proof of p⇒qp\Rightarrow q assumes pp and logically derives qq. A contrapositive proof instead assumes ¬q\neg q and derives ¬p\neg p.

The contrapositive is useful when the conclusion contains a condition that is easier to negate. For example, it is awkward to prove directly that n2n^2 even implies nn even. Its contrapositive says that if nn is odd, then n2n^2 is odd, which follows immediately by writing n=2k+1n=2k+1.

Proof (Divisibility of n3−nn^3-n). Let n∈Nn\in\mathbb N. Factor

n3−n=n(n−1)(n+1).n^3-n=n(n-1)(n+1).

These are three consecutive integers. At least one is even, so their product is divisible by 22. One of every three consecutive integers is divisible by 33, so the product is also divisible by 33. Since 22 and 33 are relatively prime,

6∣(n3−n).6\mid(n^3-n).

To prove a statement by contradiction, assume the statement is false and derive an impossibility.

Proof (There are infinitely many primes). Suppose there were only finitely many primes, listed as

p1,p2,…,pn.p_1,p_2,\ldots,p_n.

Consider

N=p1p2⋯pn+1.N=p_1p_2\cdots p_n+1.

No listed prime divides NN, because division by any pip_i leaves remainder 11. But every integer greater than 11 is prime or has a prime factor. Therefore, NN has a prime factor not in the supposedly complete list, a contradiction. Thus, there are infinitely many primes.

Induction proves a statement P(n)P(n) for every natural number from a starting value onward.

  1. Prove the base case.
  2. Assume P(k)P(k) is true for an arbitrary allowed kk.
  3. Use that assumption to prove P(k+1)P(k+1).

The key is that the inductive hypothesis is not a guess that every case is true. It temporarily grants one case, P(k)P(k), so that the proof can establish the link

P(k)⇒P(k+1).P(k)\Rightarrow P(k+1).

The base case starts the chain. The inductive step then carries truth from the base case to the next case, and from there to every later case. Without the base case, the implication alone proves nothing: a row of standing dominoes never falls unless the first one is pushed.

Proof (Sum of the first nn squares). We prove

12+22+⋯+n2=n(n+1)(2n+1)61^2+2^2+\cdots+n^2=\frac{n(n+1)(2n+1)}{6}

for every n∈Nn\in\mathbb N. For n=1n=1, both sides equal 11.

Assume the formula holds for some k∈Nk\in\mathbb N. Then

12+22+⋯+k2+(k+1)2=k(k+1)(2k+1)6+(k+1)2.1^2+2^2+\cdots+k^2+(k+1)^2 =\frac{k(k+1)(2k+1)}{6}+(k+1)^2.

Factor and simplify:

k(k+1)(2k+1)+6(k+1)26=(k+1)(k+2)(2k+3)6.\frac{k(k+1)(2k+1)+6(k+1)^2}{6} =\frac{(k+1)(k+2)(2k+3)}{6}.

This is exactly the claimed formula with n=k+1n=k+1. Therefore, the formula holds for all n∈Nn\in\mathbb N.

In strong induction, the inductive hypothesis assumes all earlier cases through kk:

P(1),P(2),…,P(k).P(1),P(2),\ldots,P(k).

The goal is still to prove P(k+1)P(k+1). Strong induction is useful when the next case depends on more than one earlier case, or when it breaks into a smaller value that may not be exactly kk.

Proof (Prime factorization exists). We prove that every integer n≥2n\geq2 is prime or can be written as a product of primes.

The base case n=2n=2 is prime. Now assume every integer from 22 through kk is prime or a product of primes. Consider k+1k+1.

If k+1k+1 is prime, the claim is already true. If it is composite, then

k+1=abk+1=ab

for integers a,ba,b satisfying

2≤a,b≤k.2\leq a,b\leq k.

By the strong inductive hypothesis, each of aa and bb is prime or a product of primes. Multiplying those factorizations gives a prime factorization of k+1k+1. Therefore, every integer n≥2n\geq2 is prime or a product of primes.