Lecture 1: Introduction

• "Discrete" is the opposite of "smooth" or "continuous". The real numbers are continuous, the integers are discrete. Most of the objects of study in computer science (e.g. data structures and algorithms) are discrete; 2800 develops mathematical tools that help analyze them.

• 2800 is the first proof-based mathematics course for many students. You will learn to develop mathematical abstractions, clearly describe them, and prove things about them.

• 2800 covers many of the mathematical tools that are useful in computer science, including functions, relations, combinatorics, probability, finite automata, modular arithmetic, graphs, and formal logic.

How to succeed in 2800

• Take time after the lecture to reproduce the lecture, starting from a short list of topics that were covered. Unlike

• Try to do the homework on your own before seeking help from colleagues, in office hours, or on Piazza.

• When reading proofs, write them too. The purpose of a proof is to make something obvious; so looking at a proof and saying "yep, that's obvious" doesn't mean that you understand or could reproduce the proof.

Sets

A set is a collection of elements. Any object is either in a set or not; and two sets are the same if exactly the same objects are in both of them.

This means that sets do not have order: 1 is in both $$\{1,2,3\}$$ and $$\{3,2,1\}$$, as are 2 and 3; nothing else is in either of them. Thus they are the same set.

This also means that sets ignore duplicates: 1 is in both $$\{1,2,3\}$$ and $$\{1,1,1,2,3,1,2,1\}$$, as are 2 and 3, and nothing else, so they are the same set.

Set notation

• The symbol "$$\in$$" ("\in" in LaTeX) means "is in" or just "in". For example, $$1 \in \{1,2,3\}$$, but $$4 \notin \{1,2,3\}$$.

• Curly braces usually indicate a set. I have already used $$\{1,2,3\}$$ to denote the set containing 1, 2, and 3.

• There is a "set comprehension" syntax that is useful for building other sets. For example, if $$A = \{1,2,3\}$$, we can write $$\{x \in A \mid x \gt 2\}$$. This should be read as "the set of all elements $$x$$ in the set $$A$$ such that $$x \gt 2$$." This is another way of writing $$\{3\}$$. You can use any description (as long as it is clear an unambiguous) in the predicate (the part after the vertical bar). For example $$\{x \in A \mid x \gt 2 \text{ or } x = 1\}$$.

• Informally, one can describe a set, for example: $$\{all~colors\}$$ is an informal way to write $$\{red, green, blue, tope, mauve, \dots\}$$. Be careful with this notation, for two reasons:
1. It can be hard to unambiguously determine whether something is in the set or not. Is "tangerine" in $$\{all~colors\}$$?
2. it is unclear whether $$\{all~colors\}$$ is the set containing all colors, or the set containing the set of all colors.
• A much better approach is to describe the set in English: Let $$C$$ be the set of all colors. In general, the test of whether you've given a good definition is not the notation you use, but whether the definition is clear and unambiguous. Sometimes notation helps with this, but other times it makes your writing less clear.

• The symbol $$\emptyset$$ (LaTeX \emptyset) stands for the empty set (which contains no elements).

Functions

Definition: A function is an unambiguous rule; for every input there should be an unambiguous output. The domain is the set of inputs. The codomain describes the type of outputs; there may be elements of the codomain that do not have an element of the domain that map to them. The image is the set of outputs that actually have an input mapped to them.

We'll discuss functions in more detail next lecture.

Note: Our definition of function corresponds to MCS's definition of total function.

Note: some books use "range" to mean "codomain", while others use "range" to mean "image". I try to avoid the term "range" to avoid ambiguity.

Sudoku

Sudoku is a popular puzzle that involves filling in a grid of numbers while satisfying certain rules. In the next lecture we'll use the notions of sets and functions to model solved sudoku puzzles. In the mean time, try a sudoku puzzle if you haven't before, and think about how you would model a solved board.