What is Discrete Mathematics?

COS1501 - Theoretical Computer Science I · Introduction to Discrete Mathematics

What is Discrete Mathematics?

Discrete mathematics is a branch of mathematics that deals with objects that can take only distinct, separate values. This contrasts with continuous mathematics, which deals with objects that can vary smoothly. Discrete mathematics is fundamental in computer science because it provides the mathematical foundations for various concepts used in algorithms, data structures, and programming.

Key Concepts in Discrete Mathematics

Discrete mathematics includes several key areas:

  • Logic: The study of reasoning and argumentation.
  • Set Theory: The study of collections of objects.
  • Functions: Relationships between sets of data.
  • Relations: Ways to associate elements from different sets.
  • Counting Principles: Techniques for counting and arranging objects.

Logic

Logic is the foundation of mathematical reasoning. It involves propositions, which are statements that can be either true or false. For example, the statement “2 + 2 = 4” is true, while “2 + 2 = 5” is false.

Propositional Logic

In propositional logic, we use logical operators to form compound statements. The main logical operators are:

  • AND (∧): True if both statements are true.
  • OR (∨): True if at least one statement is true.
  • NOT (¬): Inverts the truth value of a statement.

For example, consider the statements:

  • P: “It is raining.”
  • Q: “I will take an umbrella.”

The compound statement “P AND Q” (P ∧ Q) is true only if both P and Q are true. If it is raining and you take an umbrella, the statement holds.

Remember: The truth table for AND is:

 P     Q     P ∧ Q
T T T
T F F
F T F
F F F

Set Theory

Set theory is the study of sets, which are collections of distinct objects. Sets can be finite or infinite. For example, the set of natural numbers {1, 2, 3, ...} is infinite.

Basic Set Operations

Common operations in set theory include:

  • Union (∪): The set of elements that are in either set.
  • Intersection (∩): The set of elements that are in both sets.
  • Difference (−): The set of elements in one set but not in another.

For example, let A = {1, 2, 3} and B = {2, 3, 4}. The union A ∪ B is {1, 2, 3, 4}, the intersection A ∩ B is {2, 3}, and the difference A − B is {1}.

Watch out: Remember that the order of elements in a set does not matter, and there are no duplicate elements.

Functions

A function is a relation that uniquely associates each element from one set (the domain) with exactly one element from another set (the codomain). Functions are often written as f(x), where x is an element from the domain.

Example of a Function

Consider the function f: A → B, where A = {1, 2, 3} and B = {a, b, c}. The function can be defined as:

f(1) = a
f(2) = b
f(3) = c

This means that the number 1 is associated with the letter a, and so on.

Relations

A relation is a set of ordered pairs. For example, if we have two sets A = {1, 2} and B = {a, b}, a relation R from A to B can be represented as R = {(1, a), (2, b)}. This indicates that 1 is related to a and 2 is related to b.

Types of Relations

Relations can be classified as:

  • Reflexive: Every element is related to itself.
  • Symmetric: If a is related to b, then b is related to a.
  • Transitive: If a is related to b and b is related to c, then a is related to c.

Counting Principles

Counting principles are techniques used to count the number of ways to arrange or select objects. Two important principles are:

The Addition Principle

If there are m ways to do one thing and n ways to do another, and these two actions cannot happen at the same time, then there are m + n ways to do either action.

The Multiplication Principle

If there are m ways to do one thing and n ways to do another, and these actions can happen in sequence, then there are m × n ways to do both actions.

Example of Counting Principles

Suppose you have 3 shirts and 2 pairs of pants. The number of different outfits you can create is:

Number of outfits = Number of shirts × Number of pants
Number of outfits = 3 × 2 = 6

The possible outfits are: (Shirt 1, Pants 1), (Shirt 1, Pants 2), (Shirt 2, Pants 1), (Shirt 2, Pants 2), (Shirt 3, Pants 1), and (Shirt 3, Pants 2).

Tip: Always identify whether you should use the addition or multiplication principle based on the problem context.

Applications of Discrete Mathematics in Computer Science

Discrete mathematics is widely used in computer science. It helps in designing algorithms, understanding data structures, and developing software. For example, logic is used in programming to control the flow of a program, while set theory is used in database management to handle data efficiently.

Summary

  • Discrete mathematics deals with distinct values.
  • Key areas include logic, set theory, functions, relations, and counting principles.
  • Logic forms the basis of reasoning in mathematics.
  • Set theory studies collections of objects and their relationships.
  • Functions and relations describe relationships between sets.
  • Counting principles help in determining the number of arrangements or selections.

Check your understanding

  1. What is the difference between discrete and continuous mathematics?
  2. Define a function and provide an example.
  3. Explain the addition and multiplication principles with examples.
  4. What are the characteristics of a reflexive relation?