316 courses ePortfolio Forums Blog FAQ

Discrete Structures

Purpose of Course  showclose

This course has been designed to provide you with a clear, accessible introduction to discrete mathematics. Discrete mathematics describes processes that consist of a sequence of individual steps (as compared to calculus, which describes processes that change in a continuous manner). The principal topics presented in this course are logic and proof, induction and recursion, discrete probability, and finite state machines. As you progress through the units of this course, you will develop the mathematical foundations necessary for more specialized subjects in computer science, including data structures, algorithms, and compiler design. Upon completion of this course, you will have the mathematical know-how required for an in-depth study of the science and technology of the computer age.

Course Information  showclose

Welcome to CS202: Discrete Structures. General information about this course and its requirements can be found below.
 
Course Designer: J. M. Perry
 
Primary Resources: This course comprises a range of different free, online materials. However, the course makes primary use of the following materials:
  • Srini Devadas and Eric Lehman’s Mathematics for Computer Science: “Logic”
  • University of California, San Diego: Edward Bender and S. Williamson’s Lectures in Discrete Mathematics: Arithmetic, Logic and Numbers: Unit BF: Boolean Functions and Computer Arithmetic
  • Saylor content
 
Requirements for Completion: In order to complete this course, you will need to work through each unit and all of its assigned materials.
 
Note that you will only receive an official grade on your final exam. However, in order to adequately prepare for this exam, you will need to work through the assigned materials in each unit.
 
In order to pass this course, you will need to earn a score of 70% or higher on the final exam. Your score on the exam will be tabulated as soon as you complete it. If you do not pass the exam, you may take it again.
 
Time Commitment: This course should take you about 105.5 hours to complete. Each unit includes a time advisory that lists the amount of time you are expected to spend on each subunit. These should help you plan your time accordingly. It may be useful to take a look at these time advisories and to determine how much time you have over the next few weeks to complete each unit, and then to set goals for yourself. For example, Unit 1 should take you approximately 9 hours to complete. Perhaps you can sit down with your calendar and decide to complete subunit 1.1 (a total of 3.5 hours) on Monday night; subunits 1.2 (a total of 2.75 hours) on Tuesday night; subunit 1.3 (a total of 2 hours) on Wednesday night; etc.
 
Tips/Suggestions: When completing the assigned readings, it may be helpful to take notes, so you can go back to study the concepts discussed.

Learning Outcomes  showclose

Upon successful completion of this course, you will be able to:
  • create compound statements, expressed in mathematical symbols or in English, to determine the truth or falseness of compound statements and to use the rules of inference to prove a conclusion statement from hypothesis statements by applying the rules of propositional and predicate calculus logic;
  • prove mathematical statements involving numbers by applying various proof methods, which are based on the rules of inference from logic;
  • prove the validity of sequences and series and the correctness of repeated processes by applying mathematical induction;
  • define and identify the terms, rules, and properties of set theory and use these as tools to support problem solving and reasoning in applications of logic, functions, number theory, sequences, counting, probability, trees and graphs, and finite state machines;
  • calculate probabilities and apply counting rules;
  • solve recursive problems by applying knowledge of recursive sequences;
  • create graphs and trees to represent and help prove or disprove statements, to make decisions or select from alternative choices, to calculate probabilities, to document derivation steps, or to solve problems; and
  • construct and analyze finite state automata (another name for machines), formal languages, and regular expressions.

Course Requirements  showclose

In order to take this course, you must:

√    Have access to a computer;

√    Have continuous broadband Internet access;

√    Have the ability/permission to install plug-ins or software (e.g. Adobe Reader or Flash);

√    Have the ability to download and save files and documents to a computer;

√    Have the ability to open Microsoft files and documents (.doc, .ppt, .xls, etc.);

√    Have competency in the English language;

√    Have read the Saylor Student Handbook;

√    Have completed the following prerequisite courses from The Core Program of the computer science discipline, including CS101 and/or CS102 for use of functions and procedures, conditional statements, loops, recursion, data types, and evaluation of expressions;

√    Have completed the following required mathematics courses in the computer science discipline, including CS103/MA101 and CS104/MA102; and

√    Have skills in basic algebra and calculus.

Unit Outline show close


Expand All Resources Collapse All Resources
  • Unit 1: The Logic of Compound Statements  

    Great thinkers have studied logic since the time of the Greek philosopher Aristotle; its rules serve as the basis for the study of every branch of knowledge − including (and perhaps especially) computer science. Logic is an abstraction and formalization of reasoning we use every day, in mathematics, science, and, in particular, computer science. Logic deals with logical systems consisting of symbols that represent statements that are either true or false, definitions of operations for combining statements (for example, addition is an operation in arithmetic for combining numbers), rules for manipulating statement and operator symbols, and rules for inferring new statements from given statements. In Unit 1 and Unit 2, we will study two logical systems: the propositional calculus and the first order predicate calculus.
     
    The following guidance will help you get started in our study of logic in discrete structures. The definitions and rules are called axioms or postulates (we use these terms synonymously). We use axioms and known true statements to prove the truth or falseness of theorems. A theorem is a statement that has a hypothesis (assumptions) and a conclusion. Much of our work will involve proving theorems. You may notice that several different notations are used in logic, depending on the author, text, or reference. In this course, we use several different notations so that you are introduced to these differences.
     
    Logic is an extensive field of study and selected topics are included in discrete structures. These topics vary depending on the institution or school, course, instructor, and text. To expose you to some of the variation, we use two main resources, as well as include supplementary resources and our own original content. In this unit, we will examine various rules of logic (i.e. negations, conjunctions, and disjunctions) in order to determine how they can create conditional statements, arguments, and rules but also prove the truthfulness or falseness of any argument, whether presented in mathematical terms or in everyday language.
     
    Note: Discrete structures is the term used for discrete mathematics for computer science. Discrete mathematics is often referred to as finite mathematics.

    Unit 1 Time Advisory   show close
    Unit 1 Learning Outcomes   show close
  • 1.1 Compound Statements  

    Note: In logic, we define operations on statements, which result in new statements, i.e. compound statements, much like in arithmetic where we have operations on numbers that result in a new number. We will see some of these logic operations in the next subunit.

  • 1.1.1 The NOT, AND, OR, and XOR Symbols  
    • Reading: Massachusetts Institute of Technology: Srini Devadas and Eric Lehman’s Mathematics for Computer Science: “Logic”

      Link: Massachusetts Institute of Technology: Srini Devadas and Eric Lehman’s Mathematics for Computer Science: “Logic” (PDF)
       
      Also Available in:
      EPUB
       
      Instructions: Read Section 1 through the end of Section 1.1.1 on pages 1 - 3. This reading discusses logical symbols or operators that apply to propositions (the operands) to form a compound statement. A proposition is a statement that is either true (T) or false (F). Propositions are often denoted by single letters, for example, P or Q. The resulting truth or falseness of the compound statement is determined either using a truth table based on the truth or falseness of the operands or, as we will see later, by applying inference rules to prove that the compound statement is inferred from true statements.
       
      Truth tables for operations - negation, conjunction, and disjunction -are derived from the definition of the operation, as seen in this reading.
       
      Reading this selection and taking notes should take approximately 30 minutes.
       
      Terms of Use: This resource is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. It is attributed to Srini Devadas, Eric Lehman and Massachusetts Institute of Technology: Massachusetts Institute of Technology OpenCourseWare. The original version can be found here.

    • Reading: University of California, San Diego: Edward Bender and S. Williamson’s Lectures in Discrete Mathematics: “Arithmetic, Logic and Numbers: Unit BF: Boolean Functions and Computer Arithmetic”

      Link: University of California, San Diego: Edward Bender and S. Williamson’s Lectures in Discrete Mathematics: “Arithmetic, Logic and Numbers: Unit BF: Boolean Functions and Computer Arithmetic” (PDF)
       
      Also Available in:
      EPUB
       
      Instructions: Read Section 1: “Boolean Functions and Computer Arithmetic” up to example 6 on pages BF-1 to BF-4. Example 4 includes XOR. This reading presents material similar to Devadas and Lehman, but uses the language of Boolean functions. Throughout our study, we will see the relationship of English statements, logic, Boolean functions, and sets, and will learn how to translate between them to represent the same meaning. Exclusive OR is defined in example 4. Example5 discusses the relation of Boolean functions and logic.
       
      XOR is the exclusive OR symbol. It differs from OR in that the resulting value is true if and only if exactly one of the operands is true. Thus, the result value in the truth table for XOR is false (F) for the row where each operand has the value true (T).
       
      Truth tables for operations, such as exclusive OR, are derived from the definition of the operation, as seen in this reading.
       
      Reading this selection and taking notes should take approximately 30 minutes.
       
      Terms of Use: The linked material above has been reposted by the kind permission of Edward Bender and S. Williamson. Please note that this material is under copyright and cannot be reproduced in any capacity without explicit permission from the copyright holder.

  • 1.1.2 Translating from English to Symbols  
    • Reading: Massachusetts Institute of Technology: Srini Devadas and Eric Lehman’s Mathematics for Computer Science: “Logic”

      Link: Massachusetts Institute of Technology: Srini Devadas and Eric Lehman’s Mathematics for Computer Science: “Logic” (PDF)
       
      Also Available in:
      EPUB
       
      Instructions: Read the beginning paragraphs in the Logic section up to Section 1, and then read Section 1.2 and Section 1.3 on pages 3 - 6.
       
      This reading (and the following readings for this section) shows the relationship of natural language, in our case English, to the language of logic. Logic deals with simple statements, called propositions, that are either true or false, and operators - for example, NOT, AND, and OR - that combine propositions to form compound statements. Translating from English to logic involves analyzing English statements, i.e. parsing them, into elementary statements that can be expressed as propositions, connected by conjunctions, which usually can be expressed as logic operations. However, since natural languages are not always precise, we have to be careful to understand the semantics, or meaning, of an English statement and then express that same meaning using logic.
       
      Reading this selection and taking notes should take approximately 30 minutes.
       
      Terms of Use: This resource is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. It is attributed to Srini Devadas, Eric Lehman and Massachusetts Institute of Technology: Massachusetts Institute of Technology OpenCourseWare. The original version can be found here.

    • Reading: University of California, San Diego: Edward Bender and S. Williamson’s Lectures in Discrete Mathematics: “Arithmetic, Logic, and Numbers: Unit Lo: Logic”

      Link: University of California, San Diego: Edward Bender and S. Williamson’s Lectures in Discrete Mathematics: “Arithmetic, Logic and Numbers: Unit Lo: Logic” (PDF)
       
      Also Available in:
      EPUB
       
      Instructions: Read the beginning of Logic, “Section 1: Propositional Calculus,” from pages Lo-1 to page Lo-3, up to the “Implication” paragraph. This reading also applies to Subunit 1.1.3 of this course.
       
      These brief readings further introduce the use of logic in representing English or natural language statements, as well as for statements in mathematics. The translation discussion is continued in section 1.1.5 below.
       
      Reading this selection and taking notes should take approximately 15 minutes.
       
      Terms of Use: The linked material above has been reposted by the kind permission of Edward Bender and S. Williamson. Please note that this material is under copyright and cannot be reproduced in any capacity without explicit permission from the copyright holder.

    • Reading: The Saylor Foundation’s “Translating from English to Logic Symbols”

      Link: The Saylor Foundation’s “Translating from English to Logic Symbols” (PDF)
       
      Instructions: Download this reading for a brief summary and review of translating English to logic symbols.
       
      Reading this selection and taking notes should take approximately 15 minutes.

  • 1.1.3 Double Negative Property  
    • Reading: University of California, San Diego: Edward Bender and S. Williamson’s Lectures in Discrete Mathematics: “Arithmetic, Logic and Numbers: Unit BF: Boolean Functions and Computer Arithmetic”

       
      Link: University of California, San Diego: Edward Bender and S. Williamson’s Lectures in Discrete Mathematics: “Arithmetic, Logic and Numbers: Unit BF: Boolean Functions and Computer Arithmetic” (PDF)
       
      Also Available in:
      EPUB
       
      Instructions: Read example 3 on page BF-2 in Section 1: “Boolean Functions and Computer Arithmetic” of the Bender and Williamson reading.
       
      We have seen that some statements in English can be translated to logic. We have also seen in the Bender and Williamson reading in 1.1.1, the equivalence of logic and Boolean functions. The term “equivalence” is used here in the context of equivalence of representations. The term “equivalence” in logic is used to mean that two propositions have the same truth value. Thus, the same word has two similar, yet different, meanings depending on the context in which it is used. Assignment of true to a proposition corresponds to a Boolean function that maps the proposition to 1. Assignment of false to a proposition corresponds to a Boolean function that maps the proposition to 0. The logic operators are translated to operations on Boolean functions.
       
      NOT is a unary operator, meaning it has one operand. The other operators AND, OR, and XOR are binary operators, meaning they have two operands. “NOT P,” as a Boolean function is written as, NOT (P), or ~P, where P is in the set {0,1}. As a unary logic operator, it is defined by the truth table referenced in subunit 1.1.1, and as a Boolean function it is defined in example 3 in Devadas and Lehman.
       
      The truth table for NOT P, can be used to evaluate the truth or falseness of NOT (NOT P), which is T when P is T, and F when P is F. Thus, it has the same values as P. We say that NOT (NOT P) and P are equivalent as logic operators. Using Boolean functions, NOT (NOT (P)) is evaluated as follows: P is either 0 or 1. When P is 1, NOT (NOT (1)) = 1. When P is 0, NOT (NOT (0)) = 0. Thus, NOT (NOT) (P) = identity function.
       
      Reading this selection and taking notes should take approximately 30 minutes.
       
      Terms of Use: The linked material above has been reposted by the kind permission of Edward Bender and S. Williamson. Please note that this material is under copyright and cannot be reproduced in any capacity without explicit permission from the copyright holder.

  • 1.1.4 Negations of AND and OR: DeMorgan’s Law  
  • 1.1.5 Tautologies and Contradictions  
    • Reading: University of California, San Diego: Edward Bender and S. Williamson’s Lectures in Discrete Mathematics: “Arithmetic, Logic and Numbers: Unit Lo: Logic”

      Link: University of California, San Diego: Edward Bender and S. Williamson’s Lectures in Discrete Mathematics: “Arithmetic, Logic and Numbers: Unit Lo: Logic” (PDF)
       
      Also Available in:
      EPUB

      Instructions: Study definition 1 (Tautology, contradiction) in Section 1 on pages Lo-2 and Lo-3. In Subunit 1.1.2 of this course, we introduced translation between English statements and logic. This reading, in addition to tautology and contradiction, adds to the translation story by discussing the relationship with set theory. Thus, you can translate from and to English, logic, and set symbols. The discussion of translation will continue when you study implication in the Subunit 1.2.1.
       
      Reading this selection and taking notes should take approximately 30 minutes.
       
      Terms of Use: The linked material above has been reposted by the kind permission of Edward Bender and S. Williamson. Please note that this material is under copyright and cannot be reproduced in any capacity without explicit permission from the copyright holder.

  • 1.2 Conditional Statements  

    Note: As you have likely noticed there is a similarity between the language of logic and a natural language, such as English. In fact, there is a similarity between implication in logic and the conditional statement in English, i.e. an if statement. In the follow subsections, we will study the application of operations to the logical if statement. 

  • 1.2.1 Logical Equivalences Using Conditional Statements  
  • 1.2.2 Negation of a Conditional Statement  

    Note: Conditional English sentences can be difficult to interpret, particularly when they are negated. Logic helps us to correctly interpret such statements. This topic, negation of a conditional statement, is addressed in the reading on implication in Subunit 1.2.1.

  • 1.2.3 Contrapositive of a Conditional Statement  

    Note: Given a conditional statement, we can derive several new statements from it by inserting negation and/or inverting the antecedent and consequent. For example, from P implies Q, we can derive NOT Q implies NOT P. These two statements, namely the implication, P implies Q, and the derived statement are logically equivalent. This derivation is called the contrapositive of the implication. Contrapositive is discussed in the Bender and Williamson reading in Subunit 1.2.1.

  • 1.2.4 Converse and Inverse of a Conditional Statement  

    Note: In addition to negation of a conditional statement and contrapositive, two other common derivations from a conditional statement are the converse and inverse. These are discussed in the readings for Subunit 1.2.1.

  • 1.2.5 If and Only If, Necessary and Sufficient Conditions  
  • 1.2.6 Proving Validity or Invalidity of an Argument Using Truth Tables  
  • 1.3 Modus Ponens and Modus Tollens  

    Note: A proof, or an argument, is a series of statements where each statement logically follows from the previous one(s). Logically follows means that there is a logic rule of inference that derives it from the previous statement(s). One famous rule of inference is modus ponens, which we will study in the next subunits.

  • 1.3.1 Rules of Inference  
  • Unit 1: Assesment 1  
  • Unit 1: Assesment 2  
    • Assessment: University of California, San Diego: Edward Bender and S. Williamson’s Lectures in Discrete Mathematics: “Arithmetic, Logic, and Numbers: Unit Lo: Logic”

      Link: University of California, San Diego: Edward Bender and S. Williamson’s Lectures in Discrete Mathematics: “Arithmetic, Logic and Numbers: Unit Lo: Logic” (PDF)
       
      Also Available in:
      EPUB
       
      Instructions: Given that a set P is a subset of set Q, let a be an element that is not in Q. Prove using the propositional calculus that a is not in set P. Hint: Translate the statements to the predicate calculus and use rules of inference. For background reading for this problem, select the hyperlink “Lo PDF” to download the file for the Logic Unit. In this Logic Unit, you may want to reread the material from example 1 up to example 3 as a review. Keep in mind the difference between implication, which is a Binary function, or logic operator for combining two statements, and a rule of inference, such as Modus Ponens, with which we form proofs or arguments.
       
      Answer: Assume, without loss of generality, that sets P and Q consist of members from a universal set U. Let y be any member of U, and a be a specific member of U.
       
      Then, we have to prove that NOT (a in P) logically follows from [(y in P) --> (y in Q)] / [NOT (a in Q)].

      The truth table for this follows.
       

      1 y in P y in Q y in P
      ---->
      y in Q
      a in Q NOT (a in Q) [(y in P) -->
      (y in Q)] /
      (NOT (a in Q))
      2 F F T F T T
      3 F F T T F F
      4 F T T F T T
      5 F T T T F F
      6 T F F F T T
      7 T F F T F F
      8 T T T F T T
      9 T T T T F F
       
      SINCE y is a variable, it HOLDS for a specific value, y = a, and we can REPLACE y with a in the table. This yields a table for [(a in P) --> (a in Q)] / [NOT (a in Q)].

      The hypothesis included that a is not in Q. This occurs for the rows: 2, 4, 6, and 8. Rows 4 and 8 are not applicable because they state (a in Q) and (a not in Q), which can’t occur, at least not in our reality. Look at row 6; it states that the implication, (a in P) --> (a in Q) is false; our hypothesis states otherwise, namely we assume it’s true. Therefore, only row 2 is applicable; row 2 states a in P is false, which is what we wanted to prove, i.e. a is not in P.
       
      Of course we could have proved this assessment using set theory, but because this is a unit on logic, we wanted to demonstrate the translation from sets to logic, and then use logic to prove the hypothesis.
       
      Completing this assessment should take approximately 30 minutes.
       
      Terms of Use: The linked material above has been reposted by the kind permission of Edward Bender and S. Williamson. Please note that this material is under copyright and cannot be reproduced in any capacity without explicit permission from the copyright holder.

  • Unit 1: Assesment 3  
  • Unit 2: The Logic of Quantified Statements  

    In the previous unit, we discussed the logical analysis of compound statements, including those comprised of simple statements joined by OR, AND, NOT, etc. operators. This analysis provides us with a better understanding of human reasoning, but cannot be used to determine the validity of the majority of mathematical situations. In some cases, it becomes necessary to separate statements into parts, just as we parse sentences in order to facilitate comprehension.
     
    In this unit, we will learn to analyze and understand the special roles that keywords and predicates (i.e. for all and some) play − exercises that constitute the foundation of predicate calculus.

    Unit 2 Time Advisory   show close
    Unit 2 Learning Outcomes   show close
  • 2.1 Quantified Statements  
    • Reading: Massachusetts Institute of Technology: Srini Devadas and Eric Lehman’s Mathematics for Computer Science: “Logic”

      Link: Massachusetts Institute of Technology: Srini Devadas and Eric Lehman’s Mathematics for Computer Science: “Logic” (PDF)  

      Also Available in:
      EPUB
       
      Instructions: Read Section 3 through 3.1 on pages 11 and 12. This reading introduces the universal quantifier and the existential quantifier. Logic without quantifiers is called propositional calculus; logic with quantifiers is called the (first order) predicate calculus.
       
      Reading this selection and taking notes should take approximately 45 minutes.
       
      Terms of Use: This resource is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. It is attributed to Srini Devadas, Eric Lehman and Massachusetts Institute of Technology: Massachusetts Institute of Technology OpenCourseWare. The original version can be found here.

    • Reading: University of California, San Diego: Edward Bender and S. Williamson’s Lectures in Discrete Mathematics: “Arithmetic, Logic and Numbers: Unit Lo: Logic”

      Link: University of California, San Diego: Edward Bender and S. Williamson’s Lectures in Discrete Mathematics</em>: “Arithmetic, Logic and Numbers: Unit Lo: Logic”(PDF)
       
      Also Available in:
      EPUB

      Instructions: Read Section 2: “Predicate Logic” up to and including Definition 4 on pages Lo-12 and Lo-13. As you read this text, consider that statements in the first order predicate calculus, or for us, simply, the predicate calculus, involve variables that can take on values from a set in a reference domain. We interpret the statement by introducing a domain of discourse or reference domain that the symbols (statements and operators), the rules, and variables represent or refer to. This is essentially what we do when we translate from English to logic. In other words, translation is using one domain, e.g. logic, to represent another domain, and setting up an association between symbols in one to those of the other. Just keep in mind, that the variables in a predicate calculus statement take on the values from a particular set, for example, the set of all boys in Chicago or the set of positive integers.

      For an understanding of the universal quantifier, study Definition 4, on page Lo-12, which is critically important for the study of logic, science and mathematics. This definition also defines the existential quantifier. These two quantifiers are often used together, as the examples in the next subunits will show.
       
      Reading this selection and taking notes should take approximately 1 hour.
       
      Terms of Use: The linked material above has been reposted by the kind permission of Edward Bender and S. Williamson. Please note that this material is under copyright and cannot be reproduced in any capacity without explicit permission from the copyright holder.

  • 2.1.1 Translating between Formal and Informal Languages  
    • Reading: Massachusetts Institute of Technology: Srini Devadas and Eric Lehman’s Mathematics for Computer ScienceM: “Logic”

      Link: Massachusetts Institute of Technology: Srini Devadas and Eric Lehman’s Mathematics for Computer Science: “Logic” (PDF)
       
      Also Available in:
      EPUB
       
      Instructions: Read Sections 3.2 on page 12 and 3.6 on pages 14 and 15. This reading also pertains to the topic in subunit 2.1.2. This reading shows how logic (a formal language) can be used to describe sets (another formal language).

      Reading this selection and taking notes should take approximately 45 minutes.

      Terms of Use: This resource is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. It is attributed to Srini Devadas, Eric Lehman and Massachusetts Institute of Technology: Massachusetts Institute of Technology OpenCourseWare. The original version can be found here.

    • Reading: University of California, San Diego: Edward Bender and S. Williamson’s Lectures in Discrete Mathematics: “Arithmetic, Logic and Numbers: Unit Lo: Logic”

      Link: University of California, San Diego: Edward Bender and S. Williamson’s Lectures in Discrete Mathematics: “Arithmetic, Logic and Numbers: Unit Lo: Logic” (PDF)
       
      Also Available in:
      EPUB
       
      Instructions: Read Definition 5 up to and including example 8 on pages Lo-13 and Lo-14. This reading also applies to the topic for Subunit 2.1.2 of this course. This reading gives important examples of using logic to represent statements in mathematics. As you read this text, please keep in mind that formal language includes logic, binary functions, sets, and programming languages. Informal language includes English and other natural languages. Please note that translating from informal to informal language for subunit 2.1.2 involves rewriting an informal statement into a different but equivalent statement.
       
      Reading this selection and taking notes should take approximately 1 hour.
       
      Terms of Use: The linked material above has been reposted by the kind permission of Edward Bender and S. Williamson. Please note that this material is under copyright and cannot be reproduced in any capacity without explicit permission from the copyright holder.

  • 2.1.2 Translating from Informal to Informal Language  

    Note: The Bender and Williamson reading for 2.1.1 addresses translating from informal to informal language(s). In our study of logic, our primary interest is translating between logic and English (or natural languages). In addition, you will find it useful to translate between informal (that is, natural) languages. For example, suppose you have an English statement that you find difficult to translate to logic. Rewriting or translating the statement to an equivalent English statement usually makes the translation to logic easy. Translating between informal or natural languages also occurs when we translate from one natural language to another, for example, from English to Spanish.

  • 2.2 Operating on Quantified Statements  
    • Reading: Massachusetts Institute of Technology: Srini Devadas and Eric Lehman’s Mathematics for Computer Science: “Logic”

      Link: Massachusetts Institute of Technology: Srini Devadas and Eric Lehman’s Mathematics for Computer Science: “Logic” (PDF)  
      Also Available in:
      EPUB
       
      Instructions: Read Sections 3.3 and 3.4 on page 13. We have seen the use of quantifiers in representing statements in other languages, e.g. English, mathematics, and programming. The next step is to see how statements with quantifiers can be combined and transformed using logic rules. This reading looks at statements that have both types of quantifiers, i.e. universal and existential, used together; it also looks at the order in which the quantifiers appear.
       
      Reading this selection and taking notes should take approximately 30 minutes.
       
      Terms of Use: This resource is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. It is attributed to Srini Devadas, Eric Lehman and Massachusetts Institute of Technology: Massachusetts Institute of Technology OpenCourseWare. The original version can be found here.

    • Reading: University of California, San Diego: Edward Bender and S. Williamson’s Lectures in Discrete Mathematics: “Arithmetic, Logic and Numbers: Unit Lo: Logic”

      Link: University of California, San Diego: Edward Bender and S. Williamson’s Lectures in Discrete Mathematics: “Arithmetic, Logic and Numbers: Unit Lo: Logic” (PDF)
       
      Also Available in:
      EPUB

      Instructions: Read example 15 on page Lo-19. Here you read about the use of quantifiers together with the use of logic operations, such as AND, OR.

      As you study and read, you should THINK about the material, both on what it means in relation to what you already know and how it relates to other topics you have studied. To help you think about the material, you should look at the exercises, even if the instructions don’t explicitly state this.

      Reading this selection and taking notes should take approximately 30 minutes.

      Terms of Use: The linked material above has been reposted by the kind permission of Edward Bender and S. Williamson. Please note that this material is under copyright and cannot be reproduced in any capacity without explicit permission from the copyright holder.

  • 2.2.1 Negations of Quantified Statements  
  • 2.2.1.1 Negating a Universal Statement  

    Note: The reading for 2.2.1 includes negation of statements having quantifiers. Given a statement in logic, as you have seen with the propositional logic, we can negate it. We can do the same for a statement in predicate logic. Then, once we negate it, how can we rewrite the negated statement as a logically equivalent statement, so that the negation applies to the parts of the statement, rather than the entire statement? Why do we care? Because by doing so, we often simplify the statement or put it into a more convenient form for a particular purpose. In effect, we can study ways to translate from logic to logic in order to obtain a statement that is more convenient for what we might need. 

  • 2.2.1.2 Negating an Existential Statement  

    Note: The reading for 2.2.1 also includes the negation of an existential quantifier.

  • 2.2.2 Contrapositive of a Statement Having a Universal or Existential Quantifier  

    Note: The reading for 2.2.1 also includes other “transformations,” in addition to negation, of a logic statement that uses quantifiers. In particular, that reading addresses the contrapositive of a statement having a quantifier. 

  • 2.2.3 Converse of a Statement Having a Universal or Existential Quantifier  

    Note: Just as with negation and contrapositive, the reading for 2.2.1 covers the converse of a statement having a quantifier.

  • 2.2.4 Inverse of a Statement Having a Universal or Existential Quantifier  

    Note: Just as with negation and contrapositive, the reading for 2.2.1 covers the converse of a statement having a quantifier.

  • 2.3 Statements Containing Multiple Quantifiers  
  • 2.3.1 Translating Statements with Multiple Quantifiers from Formal to Informal Language  

    Note: This topic is covered by the reading in subunit 2.3. The direction of the translation in this topic, from formal to informal language, is typically done to communicate a result obtained from logic, back to the language in which the problem was specified.

  • 2.3.2 Translating Statements with Multiple Quantifiers from Informal to Formal Language  

    Note: This topic is covered by the reading in subunit 2.3. The “direction” of this translation, from a natural language to logic, is done to apply logic to a problem in some other discipline or everyday task (e.g. history, science; making a decision, debating). Furthermore, in applying logic, we also find it useful to translate from logic to logic (to transform a statement into a more convenient form), and to translate from a natural language to a natural language to simplify translation to logic.

  • 2.3.3 The Definition of a Limit  
    • Reading: The Saylor Foundation’s “Definition of a Limit”

      Link: The Saylor Foundation’s “Definition of a Limit” (PDF)
       
      Instructions: Read this text in its entirety to better understand the definition of a limit and primarily to illustrate the use of the notation from this unit.

      Limits are studied in continuous mathematics, such as the differential and integral calculus, and in analysis. Discrete mathematics (which is studied in discrete structures) provides the concepts that are used in defining topics in continuous mathematics. This is illustrated with the reading for this topic.
       
      Reading this selection and taking notes should take approximately 15 minutes.

  • Unit 2: Assessment 1  
  • Unit 2: Assessment 2  
  • Unit 3: Introduction to Number Theory and Proof Methods  

    In this unit, we will learn the properties of integers, real numbers, rational numbers, irrational numbers, and operations on all of these types of numbers. Our goal will be to learn how to determine the validity or falsity of a mathematical statement via a number of methods, including counterexample and exhaustion. We will apply these methods to not only prove the validity of the properties of the number types we are studying in this unit, but provide a practical approach to them so that future mathematical arguments can be proved or disproved using these methods.

    Unit 3 Time Advisory   show close
    Unit 3 Learning Outcomes   show close
  • 3.1 Direct Proofs and Indirect Proofs  
    • Reading: Massachusetts Institute of Technology: Srini Devadas and Eric Lehman’s Mathematics for Computer Science: “Proofs”

      Link: Massachusetts Institute of Technology: Srini Devadas and Eric Lehman’s Mathematics for Computer Science: “Proofs” (PDF)
       
      Also Available in:
      EPUB
       
      Instructions: Read the opening discussion, “Proofs,” Section 1, “The Axiomatic Method,” and Sections 2 - 6, inclusive. In Unit 3, you will get a chance to apply a lot of what you have thought about and mastered in Units 1 and 2. Our domain of discourse is number theory, in particular proofs in elementary number theory.
       
      Consider the following comparison of direct and indirect proofs. A direct proof is an argument that shows that the conclusion logically follows from the premises or assumptions by applying rules of inference in a sequence of steps.
       
      Sections 1, 2, 4, and 5 deal with direct proofs. Section 2, “Proving an Implication,” refers to statement such as P implies Q, and proving that Q is a consequence of P. In a logic system, P logically follows from the axioms and valid statements of the logic system, is another way of saying that P is a consequence of the axioms and valid statements or P is implied by them. This is what is meant by proving an implication.
       
      Section 3 is related to indirect proof. Section 6 discusses indirect proof, also known as proof by contradiction, directly. An indirect proof, in contrast, is a proof in which the theorem to be proved is assumed false, and from this assumption, it is shown that a contradiction follows. Because the logic system is consistent, i.e. there are no contradictions, the theorem must be true. (Two statements are contradictions when they cannot both be true, and they cannot both be false.)
       
      Reading this selection and taking notes should take approximately 1 hour.

      Terms of Use: This resource is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. It is attributed to Srini Devadas, Eric Lehman and Massachusetts Institute of Technology: Massachusetts Institute of Technology OpenCourseWare. The original version can be found here.

    • Reading: University of California, San Diego: Edward Bender and S. Williamson’s Lectures in Discrete Mathematics: “Arithmetic, Logic and Numbers: Unit SF: Sets and Functions”

      Link: University of California, San Diego: Edward Bender and S. Williamson’s Lectures in Discrete Mathematics: “Arithmetic, Logic and Numbers: Unit SF: Sets and Functions” (PDF)
       
      Also Available in:
      EPUB
       
      Instructions: Read example 1 - example 4 on pages SF-3 - SF-6. It discusses proofs for sets.
       
      Reading this selection and taking notes should take approximately 30 minutes.
       
      Terms of Use: The linked material above has been reposted by the kind permission of Edward Bender and S. Williamson. Please note that this material is under copyright and cannot be reproduced in any capacity without explicit permission from the copyright holder.

  • 3.1.1 Odd and Even Numbers  
  • 3.1.2 Prime Numbers  
  • 3.1.3 Proving and Disproving Universal Statements  

    Note: Statements often involve universal quantifiers. The following subunits examine ways used to prove or disprove such statements. 

  • 3.1.3.1 Proof by Using the Method of Exhaustion  
  • 3.1.3.2 Disproof by Counterexample  
  • 3.1.4 Proving and Disproving an Existential Statement  
  • 3.2 Numbers: Direct Proofs and Counterexamples  

    Note: Logic has application to other parts of mathematics, not just to reasoning about the world. The following subunits apply logic to statements about numbers. 

  • 3.2.1 Rational Numbers  
  • 3.2.2 Irrational Numbers  
  • 3.2.3 Proving Properties of Rational Numbers  
  • 3.3 Divisibility: Direct Proofs and Counterexamples  

    Note: The following subunits continue the appliction of logic to number theory.

  • 3.3.1 Divisibility  

    Note: The following subunits examine important properties of divisibility.

  • 3.3.1.1 Divisibility Definition  
  • 3.3.1.2 Divisors of Zero and Division by Zero  

    Note: Division by zero is covered in the Bender and Williamson above.
     
    We say that division by zero is undefined. Why do we say that? Consider the following line of reasoning: suppose x is a non-zero number, and when it is divided by zero, the result is the specific number y. It can be proved that, if x / 0 = y, then x = 0 multiplied by y (i.e. x = 0 * y). But, then, x = 0 * y = 0, because any number multiplied by 0 is 0. However, we assumed that x was non zero, a contradiction.
     
    If x were 0, then x / 0 = 0 / 0 = y. Again, this implies that 0 = 0 * y. This, in turn, implies that y could be any number. This is, again, a contradiction, because we assumed that y was a specific number.
     
    Mathematical definitions and proofs are specified to adhere to certain rules. One of those rules is that results do not lead to contradictions. Therefore, we say that division by 0 is not defined.

  • 3.3.1.3 The Positive Divisors of a Positive Number  

    Note: This topic is also covered by the Bender and Williamson in Subunit 3.3.1.1. Theorem 1 on page NT-3 states that for any given integer, > or = 2, can be written as the product of prime numbers. Each of these primes will be a divisor of the given integer.

  • 3.3.1.4 Divisibility of Algebraic Expressions  
  • 3.3.2 Proving Properties of Divisibility  

    Note: The readings for the following subunits prove some properties of divisibility (in particular, the fundamental theorem of arithmetic), which we typically use often in arithmetic.

  • 3.3.2.1 Transitivity of Divisibility  
  • 3.3.2.2 Divisibility by a Prime  
  • 3.3.2.3 The Quotient-Remainder Theorem  
  • Unit 3: Assessment 1  
  • Unit 3: Assessment 2  
  • Unit 4: Mathematical Induction and Introduction to Sequences  

    In the field of computer science, we are often required to prove the correctness of an algorithm. Mathematics has a variety of methods in order to do just that, one of which is known as mathematical induction. In this unit, we will learn to use induction in order to determine whether mathematical sequences are valid or invalid. This lesson is extremely important, because mathematical sequences are the basis for the study of repeated processes.
     
    This unit will present induction first in an abstract form and then through specialized proofs of sequences. We will examine mechanisms for finding the general formula for a sequence and apply mathematical induction to prove a given formula’s validity.

    Unit 4 Time Advisory   show close
    Unit 4 Learning Outcomes   show close
  • 4.1 Sequences  

    Note: Sequences of numbers often arise in the applications of mathematics. Sometimes a sequence is defined using a formula; sometimes a sequence is defined by just listing the terms of the sequence in order. 

  • 4.1.1 Finding Terms of Sequences Given by Explicit Formula  
    • Reading: University of California, San Diego: Edward Bender and S. Williamson’s Lectures in Discrete Mathematics: “Arithmetic, Logic and Numbers: Unit IS: Induction, Sequences, and Series”

      Link: University of California, San Diego: Edward Bender and S. Williamson’s Lectures in Discrete Mathematics: “Arithmetic, Logic and Numbers: Unit IS: Induction, Sequences, and Series” (PDF)
       
      Also Available in:
      EPUB
       
      Instructions: Read Section 2, “Sequences” on pages IS-12 - IS-19. In addition, read the examples mentioned below. This reading also applies to subunits 4.1.2 and 4.1.3.
       
      See the definition of alternating sequence, immediately before example 14. Please pay particular attention to examples 7, 14 (optional), and 17 for information specific to the topics in subunits 4.1.2 and 4.1.3. Given a sequence, f(k), f(k + 1), f(k + 2), f(k + 3), ..., where k is a fixed integer, we may be able to determine a general expression for each term of this sequence. The general expression will have the form f(n), where n is a variable that takes on values from the set {n, n > k}. If we can determine the form for f, we write f(n)n >= k. See the exercises for section 2 for examples.
       
      Reading this selection and taking notes should take approximately 3 hours.
       
      Terms of Use: The linked material above has been reposted by the kind permission of Edward Bender and S. Williamson. Please note that this material is under copyright and cannot be reproduced in any capacity without explicit permission from the copyright holder.

  • 4.1.2 An Alternating Sequence  

    Note: This topic is covered by the reading in Subunit 4.1.1. If one takes the first term of a sequence, then the sum of the first two terms, then the sum of the first three terms, and so on, the result is a new sequence, called a series. Alternating series are defined on page IS-24 of the Bender and Williamson reading above. An alternating sequence is defined just like an alternating series; namely, the signs of the adjacent terms of the sequence alternate in their signs. 

  • 4.1.3 Finding an Explicit Formula to Fit Given Initial Terms  

    Note: The problem of finding an explicit formula for a sequence or series is, in general, a hard problem. In some cases, there might not even exist such a formula.
     
    Finding an explicit formula pertains to three situations:
    1.    Given a sequence of numbers, find a general formula for the nth term of the sequence that depends on the n-1 term.
    2.    Given a sequence of numbers, find a general formula for the nth term of the sequence that depends on n.
    3.    Given a sequence of numbers, find a general formula for the nth term of the sequence that depends on one or more of the preceding terms.
     
    If the sequence has certain properties - such as the ability of each term to be calculated from the preceding term - as in an arithmetic sequence (where a fixed number is added to the n-1 term to obtain the nth term), or a geometric sequence (where a fixed number is used to multiply the n-1 term, to obtain the nth term), then one could use that information to deduce a formula for each term. Thus, one makes assumptions about the relationship of the n-1 term and the nth term. Or, if one is given a formula for each term that depends on that term, one could deduce a formula for the nth term.
     
    Examples 7 and 17 of the reading in Subunit 4.1.1 touch on this topic.
    An example for the third situation above is that of the Fibonacci series - f(n) = n + (n-1) and f(0) = 0, f(1) = 1.  (Note: Fibonacci numbers also appear in Section 7.1.4 below).Chapter 1, Section 2 and Chapter 2, Section 2 in the reading in Subunit 4.2 below touch on this topic for series. 

  • 4.2 Summation  
    • Reading: MIT: Srini Devadas and Eric Lehman’s Mathematics for Computer Science: “Sums and Approximations”

      Link: MIT: Srini Devadas and Eric Lehman’s Mathematics for Computer Science: “Sums and Approximations” (PDF)
       
      Also Available in:
      EPUB
       
      Instructions: Read this lecture. Take your time to understand the transition from one step to the next in the proofs. This can be time consuming, but it is rewarding. Don’t let the topic of the examples - annuities, for example - distract you. The domains (e.g. annuities, Taylor series, etc.) are important, but so is the method they illustrate. The method is more general than the specific domain of the example.
       
      The reading mentions induction as a way of proving some of the expressions and then continues to give insight into the source of the expression. We will cover induction in Subunit 4.5 of this course.
       
      Reading this selection and taking notes should take approximately 3 hours. 

      Terms of Use: This resource is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. It is attributed to Srini Devadas, Eric Lehman and Massachusetts Institute of Technology: MIT OpenCourseWare. The original version can be found here.

      Note: This reading applies to Sections 4.2.1, 4.2.2, and 4.3.2 below.

  • 4.2.1 Computing Summations  
  • 4.2.2 Properties of Summation  
  • 4.3 Products  

    Note: As for summation, we will now look at products, calculating them and their properties. 

  • 4.3.1 Product Notation  
  • 4.3.2 Computing Products  
  • 4.4 Factorial Notation  
  • 4.4.1 The First Ten Factorials  

    Note the first ten factorials: 10! 9! 8! 7! 6! 5! 4! 3! 2! 1! = 101 x 92 x 83 x 74 x 65 x 56 x 47 x 38 x 29 x 110

  • 4.4.2 Computing with Factorials  
  • 4.5 Mathematical Induction  
  • 4.5.1 Application of Principle of Mathematical Induction  
  • 4.5.2 Proof by Induction of the Sum of First n Integers  
  • 4.5.3 Proof by Induction of the Sum of a Geometric Sequence  
  • 4.5.4 Proving Divisibility by Induction  
  • 4.5.5 Proving an Inequality by Induction  
  • 4.6 Loop Invariants  
  • 4.6.1 Basis Property  

    Note: The reading “Loop Invariants” in subunit 4.6defines the four components of a loop invariant. The first of these is the basis property, which is the start condition for performing the statements of the loop. The basis property is the value of an expression that is true before performing the statements of a loop.

  • 4.6.2 Inductive Property  

    Note: The inductive property is the key property of a loop invariant. If the statements of the loop are performed, the basis property is still true after performing the statements of the loop.

  • 4.6.3 Eventual Falsity of Guard  

    Note: The eventual falsity of the guard is necessary to stop the loop so that it is not performed continuously, i.e. an infinite loop.

  • 4.6.4 Correctness of the Post-Condition  

    Note: The fourth property of a loop invariant is the correctness of the post-condition − the value of the base expression when the guard is false, i.e. when the loop terminates. 

  • Unit 4: Assessment 1  
  • Unit 4: Assessment 2  
  • Unit 5: Set Theory  

    Computer scientists often find themselves working with sets of homogeneous or heterogeneous values. Scientists have devised set theory in order to respond to these situations. In this unit, we will learn the basics of set theory, taking a look at definitions and notations and using the proof methods and counterexample means we introduced earlier to establish set properties.
     
    Set theory is a fundamental tool of mathematics and often used as the starting point for its study and to define basic concepts, such as functions, numbers, and limits.

    Unit 5 Time Advisory   show close
    Unit 5 Learning Outcomes   show close
  • 5.1 Definition of Set Theory  

    Note: Set theory may seem strange until you get used to it. Then, it’s so natural that you will often think in terms of sets -but this comes with familiarity. So think carefully about the following material, because it is VERY important.

  • 5.1.1 Set Notation  
    • Reading: University of California, San Diego: Edward Bender and S. Williamson’s Lectures in Discrete Mathematics: “Sets, Equivalence and Order: Unit SF: Sets and Functions”

      Link: University of California, San Diego: Edward Bender and S. Williamson’s Lectures in Discrete Mathematics: “Sets, Equivalence and Order: Unit SF: Sets and Functions” (PDF)
       
      Also Available in:
      EPUB
       
      Instructions: Study the notation used for sets in Section 1 on pages SF-1 to SF-2. This reading also applies to Subunits 5.1.2 and 5.2.1 - 5.2.5.

      A set is a collection of elements, called members of the set. Sets are denoted using capital letters; elements are denoted using small letters. We write a ∈A for an element of A; and a ÏA, for a not an element of A. Examples of sets can be found everywhere. All the units in this course comprise a set. The collection of people related to you comprises a set. Sets can be described using English descriptions, predicates in logic, or mathematical functions, in particular Boolean functions. A set can also be defined by listing the members of the set. A set can be finite, having a finite number of members; a set can be infinite. The number of elements of a set is one obvious property of a set.
       
      The members, or elements, of a set can be anything, even sets themselves. For example, {a, b, {a, b}} is a set of 3 members, and one of the members is a set.
       
      Reading this selection and taking notes should take approximately 30 minutes.
       
      Terms of Use: The linked material above has been reposted by the kind permission of Edward Bender and S. Williamson. Please note that this material is under copyright and cannot be reproduced in any capacity without explicit permission from the copyright holder.

  • 5.1.2 Set Equality  
    • Reading: University of California, San Diego: Edward Bender and S. Williamson’s Lectures in Discrete Mathematics: “Sets, Equivalence, and Order: Unit SF: Sets and Functions”

      Link: University of California, San Diego: Edward Bender and S. Williamson’s Lectures in Discrete Mathematics: “Sets, Equivalence, and Order: Unit SF: Sets and Functions” (PDF)
       
      Also Available in:
      EPUB
       
      Instructions: Study Definition 1 on page SF-1. Typically, when an object is defined in mathematics, we next define when two of those objects are equal. Then we define operations on those objects. Now, for the objects are sets. When are two sets equal?
       
      If A and B are sets, and if a ∈A, implies a ∈B, then we say A is a subset of B, denoted A Ì B. The number of subsets of a set A, is denoted 2A (the reason for this notation will become clear when you study functions.)
       
      A = B, if and only if, A Ì B and B Ì A. A and B are assumed to be subsets of a universal set E. Ø is the empty set or the set that has no members.
       
      Note that the order of the elements in a set does not change the set. Work sufficient examples to ensure that you completely understand the concept of set equality.
       
      Reading this selection and taking notes should take approximately 1 hour.
       
      Terms of Use: The linked material above has been reposted by the kind permission of Edward Bender and S. Williamson. Please note that this material is under copyright and cannot be reproduced in any capacity without explicit permission from the copyright holder.

  • 5.2 Set Operations  

    Note: Recall that in logic, operations for building compound statements were defined. We do the same for sets, i.e. define operations for building new sets from old sets.

  • 5.2.1 The Union Operator  
  • 5.2.2 The Difference Operator  
  • 5.2.3 The Intersection Operator  
  • 5.2.4 The Complement of a Set  
    • Reading: University of California, San Diego: Edward Bender and S. Williamson’s Lectures in Discrete Mathematics: “Sets, Equivalence, and Order: Unit SF: Sets and Functions”

      Link: University of California, San Diego: Edward Bender and S. Williamson’s Lectures in Discrete Mathematics: “Sets, Equivalence, and Order: Unit SF: Sets and Functions” (PDF)
       
      Also Available in:
      EPUB
       
      Instructions: This time, focus on complement of a set. Complement is set difference with respect to the largest set, called the universal set, namely, E - A is the complement of A. E is the universal set, the set of all elements; when sets are defined, the type of the elements is specified. For example, in a set of all red cars, the type of the members in this example, is car. We also say that the domain of the elements is the (universal) set of all cars. The complement is also written A’. Note: A’ = {x : x Ï A} = {x : x Î E and x Ï A}, where E is the universal, containing all theelements.
       
      Reading this selection and taking notes should take approximately 30 minutes.
       
      Terms of Use: The linked material above has been reposted by the kind permission of Edward Bender and S. Williamson. Please note that this material is under copyright and cannot be reproduced in any capacity without explicit permission from the copyright holder.

  • 5.2.5 Cartesian Products  
  • 5.2.6 Binary Relation  
  • 5.2.6.1 Reflexive  

    Note: A binary relation on A is reflexive, if (a, a) ∈R.

  • 5.2.6.2 Symmetric  

    Note: A binary relation is symmetric if (a, b) ∈R, then (b, a) ∈R.

  • 5.2.6.3 Transitive  

    Note: A binary relation is transitive if (a, b) ∈ R, (b, c) ∈ R, then (a, c ) ∈ R. There is an important consequence of a binary relation being reflexive, symmetric, and transitive. A binary relation that has all 3 properties is called an equivalence relation. If a binary relation on A is an equivalence relation, it determines a partition of A. A partition of A is a set of subsets of A, which are mutually disjoint, and whose union is A.

  • 5.3 Set Identities and Proof of Set Identities  
  • 5.3.1 Commutative Laws  
  • 5.3.2 Associative Laws  
  • 5.3.3 Distributive Laws  
  • 5.3.4 Identity Laws  
  • 5.3.5 Complement Laws  
  • 5.3.6 Double Complement Laws  
  • 5.3.7 Idempotent Laws  
  • 5.3.8 Universal Laws  
  • 5.3.9 DeMorgan’s Laws  
  • 5.3.10 Absorption Laws  
  • 5.3.11 Set Difference Laws  
  • Unit 5: Assessment 1  
  • Unit 5: Assessment 2  
  • Unit 6: Introduction to Counting and Probability  

    Counting is not always as easy as it sounds. Say, for example, you are asked to arrange three balls of three different colors. What are the possibilities? What if two of them have the same color? This is an example of a set of problems known as “counting problems.” In this unit, we will learn different types of counting using possibility trees and general counting theorems. Once we understand the concepts of counting, we will discuss the probability of event occurrence, which refers to the likelihood that a certain outcome for a given problem set will occur. Events can be dependent or independent, making them subject to different sets of rules. Throughout the unit, we will relate counting and probability to computer science topics such as counting list and array elements, password computation, and brute force attacks.
     
    In this unit, we are going to rely on the Devadas and Lehman reference as primary. Use the Bender and Williamson reference as a supplement.

    Unit 6 Time Advisory   show close
    Unit 6 Learning Outcomes   show close
  • 6.1 Definitions and Basic Counting  
  • 6.1.1 What Is a Sample Space?  
  • 6.1.2 What Is an Event?  
  • 6.1.3 Equally Likely Probability Formula  
    • Reading: Massachusetts Institute of Technology: Srini Devadas and Eric Lehman’s Mathematics for Computer Science: “Introduction to Probability”

      Link: Massachusetts Institute of Technology: Srini Devadas and Eric Lehman’s Mathematics for Computer Science“Introduction to Probability” (PDF)  

      Also Available in:
      EPUB

      Instructions: Read Section 1.5 and Section 1.6 on pages 6 - 9. This reading discusses the third and fourth steps of the four-step process for building a probabilistic model for solving probability problems. In the third step, probabilities are assigned using the possibility tree drawn during steps one and two. In step three, probabilities are assigned to the edges of the tree. At each level of the tree, the branches of a node represent possible outcomes for that node. If the outcomes of a node are assigned the same probability (the outcomes of a node add to 1), we say that they represent equally likely outcomes.
       
      Reading this selection and taking notes should take approximately 30 minutes.
       
      Terms of Use: This resource is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. It is attributed to Srini Devadas, Eric Lehman and Massachusetts Institute of Technology: Massachusetts Institute of Technology OpenCourseWare. The original version can be found here.

  • 6.1.4 Counting Elements of Lists and Sublists  
  • 6.1.5 Counting Elements of a One-Dimensional Array  

    Note: Section 1.3 of the reading for Subunit 6.1.4 illustrates the bijection rule for arrays and lists. The bijection rule can be applied to counting the elements of an array. The elements of a list can be mapped via a bijection to a one-dimensional array. Thus, because we can count the elements of a list, we can count the elements of such an array. (We count the elements of a list, by walking down the list and incrementing a tally, initialized to zero, by one for each item of the list.)

  • 6.2 Possibility Trees and Advanced Counting  
    • Reading: Massachusetts Institute of Technology: Srini Devadas and Eric Lehman’s Mathematics for Computer Science: “Counting I”

      Link: Massachusetts Institute of Technology: Srini Devadas and Eric Lehman’s Mathematics for Computer Science: “Counting I” (PDF)
       
      Also Available in:
      EPUB

      Instructions: You have read this selection in Subunit 6.1.4 above. Each of the analyses discussed in “Counting I” can be illustrated by drawing a tree. Take another look at Section 2.1 and Section 2.2 of the readings on the sum rule and the product rule. These will be covered in a subunit below but are mentioned here to explain what a possibility tree is. If you illustrate these rules by drawing a tree, it will depict all the elements of a union of disjoint sets (sum rule) and of the product of sets (multiplication rule). If these sets represent outcomes for events, then the tree is called a possibility tree.

      Reading this selection and taking notes should take approximately 15 minutes.

      Terms of Use: This resource is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. It is attributed to Srini Devadas, Eric Lehman and Massachusetts Institute of Technology: Massachusetts Institute of Technology  OpenCourseWare. The original version can be found here.

  • 6.2.1 Possibility Trees and the Multiplication Rule  
  • 6.2.2 Permutation  
  • 6.2.3 Counting Elements of Sets: Addition, Product, and Division Rules  
  • 6.2.4 The Difference Rule  

    Note: The difference rule is as follows: the number of elements in B - A equals (the number of elements in B) minus (the number of elements in B intersect A). In symbols # (B - A) = # (B) - # (B Ç A).

  • 6.2.5 Combinations  
  • 6.2.6 The Algebra of Combinations  
  • 6.2.6.1 Pascal’s Triangle  

    Pascal’s triangle is a simple, manual way to calculate binomial coefficients.
     
    Note: In the previous Saylor reading, look at the table at the bottom of the reading. The first column, (0,1,2,3,4,5), contains the numbers of the rows - the 0th row, 1st row, 2nd row, etc. - and corresponds to the exponent ‘n’ in (x + y)n .  

    Ignore the first column for the moment. Take the nth row and shift it n spaces to the left, i.e. the 0th row is not shifted, the 1st row is shifted 1 space to the left, the 2nd row is shifted 2 spaces to the left, the 3rd row is shifted 3 spaces to the left, etc. This shifting results in a shape of a triangle - ‘1’ is at the top of the triangle in the 0th row, ‘1   1’ is next in the 1st row offset by one space (so that the ‘1’ at the top is above the space in ‘1   1’), etc. This triangle for n from 0 to 5 generalizes to any n and is called Pascal’s triangle. These numbers are the coefficients for the binomial equation presented in the following subunit.

  • 6.2.6.2 The Binomial Theorem  
  • 6.3 Probability Process  
  • 6.3.1 Probability Axioms  
    • Reading: University of California, San Diego: Edward Bender and S. Williamson’s Lectures in Discrete Mathematics: “Sets, Equivalence and Order: Unit SF: Sets and Functions”

      Link: University of California, San Diego: Edward Bender and S. Williamson’s Lectures in Discrete Mathematics: “Lists, Decisions, and Graphs: Unit CL: Counting and Listing” (PDF)
       
      Instructions: Read Section 4 on pages CL-28 through CL-30.
       
      Some useful results are summarized here:

      • xε S P(x) = 1, where S is the sample space, also written P(S) = 1;
         
      • P(x) >=0, for x in the sample space;
         
      • Let E be an event, defined as a subset of S. P(E) = ∑xε EP(x);
         
      • If E and D are events such that E is contained in D, then P(E) <= P(D); and
         
      • P(E È D) = P(E) + P(D) for E, D disjoint.
      From the above the following can be proved: Let E be an event. E’ = S -E. P(E È E’) = P(E) + P(E’), P(S= E È E’) = 1; thus, 1 = P(E) + P(E’) and P(E’) = 1 - P(E).
       
      Reading this selection and taking notes should take approximately 30 minutes.
       
      Terms of Use: The linked material above has been reposted by the kind permission of Edward Bender and S. Williamson. Please note that this material is under copyright and cannot be reproduced in any capacity without explicit permission from the copyright holder.

  • 6.3.2 The Probability of the Complement of an Event  

    Note the probability of the complement of an event E is 1 - (probability of E). This result is often very useful, because for some problems the probability of E may be difficult to calculate, but the probability of the complement of E may be easy to calculate.

  • 6.3.3 The Probability of a General Union of Two Events  
  • 6.4 Conditional Probability and Independent Events  
  • 6.4.1 Computing a Conditional Probability  
  • 6.4.2 Bayes’s Theorem  
  • 6.4.3 Computing the Probability of Independent Events  
  • Unit 6: Assessment 1  
  • 6.6 Unit 6: Assessment 2  
  • Unit 7: Recursion  

    In previous sections, we learned about sequences in a general sense. In this unit, we will take a look at a specific type known as a recursive sequence. The unit will first present a number of examples that demonstrate how one computes the terms of a recursive sequence and analyzes certain kinds of problems recursively in order to generate a general recursive sequence. We will then learn to use the proof method of induction to prove the validity or falsity of a recursive sequence.
     
    In this unit, we are going to rely on the Bender and Williamson reference as primary. Use the Devadas and Lehman reference as supplementary. Switching primary references exposes us to some differences in notation and perspective.

    Unit 7 Time Advisory   show close
    Unit 7 Learning Outcomes   show close
  • 7.1 Recursively Defined Sequences  
  • 7.1.1 Computing Terms of a Recursively Defined Sequence  

    Note: Given a recursive relation, the terms of its recursively defined sequence are computed by evaluating the relation for the base value, say n = 1, then evaluating it for successive values of n. 

  • 7.1.2 Sequences that Satisfy the Same Recurrence Relation  

    Note: Given a recursive equation, also called a recursive relation, Theorem 7 on page DT-43 of the reading in Subunit 7.1 tells us how to verify a solution for it.

  • 7.1.3 Converting Sequences with Explicit Formulas to Recurrence (Recursive) Relation  

    Note: Let f(n) be an explicit formula for the nth term, An, of a sequence and assume that f(n) = A bn + K = A bn + K + Kb - Kb = A bn + Kb + K - Kb = b (A bn-1 + K) + K ( 1 - b) = b f(n - 1) + K(1 - b). Thus, f(n) = b f(n - 1) + C, a recursive equation, i.e. relation.

  • 7.1.4 The Towers of Hanoi and the Fibonacci Numbers  
  • 7.2 Solving Recurrence Relations  
    • Reading: University of California, San Diego: Edward Bender and S. Williamson’s Lectures in Discrete Mathematics: “Lists, Decisions and Graphs: Unit DT: Decision Trees and Recursion”

      Link: University of California, San Diego: Edward Bender and S. Williamson’s Lectures in Discrete Mathematics: “Lists, Decisions and Graphs: Unit DT: Decision Trees and Recursion” (PDF)
       
      Also Available in:
      EPUB
       
      Instructions: Read from example 27 to the end of the chapter on pages DT-46 - DT-50
       
      A solution to a recursive equation is a formula that computes A(n) without having to compute A(k), for k < n. Review the section on “Recursive Equations,” on page DT-44 up to example 26 on page DT-46.
       
      1. A solution to a recursive equation can be found by inspection of the terms of a given sequence (example 27); OR
      2. Apply theorem 8 if A(n) depends on A(n - 1) and theorem 9, if A(n) depends on A(n - 1) and A(n - 2).
       
      Reading this selection and taking notes should take approximately 1 hour and 15 minutes.
       
      Terms of Use: The linked material above has been reposted by the kind permission of Edward Bender and S. Williamson. Please note that this material is under copyright and cannot be reproduced in any capacity without explicit permission from the copyright holder.

      Note: This reading also applies to Subunits 7.2.1 and 7.2.2.

  • 7.2.1 Using the Method of Iteration  

    Note: We have seen in subunit 4.5 that mathematical induction and recursion are related. Likewise, recursion is related to iteration, as you will notice in Subunits 7.2.1.1 and 7.2.1.2. 

  • 7.2.1.1 Finding a Formula for a Recurrence Relation for an Arithmetic Sequence  

    Regarding Theorem 8 on page DT-48 of the reading in Subunit 7.2, if an = ban - 1 +c , then iterating, an = b( ban - 2+c) + c = b(b (b an - 3+ c ) + c ) + c= ....= a0 bn + c bn-1 + c bn-2 + .... + c. This is an example of 7.2.1.1 using the method of iteration for finding a formula for a recurrence relation for an arithmetic sequence.

  • 7.2.1.2 Finding a Formula for an Iterative Relation for a Geometric Sequence  
  • 7.2.2 Using Mathematical Induction  
  • 7.3 Recursive Functions  

    Note: Many well-know functions are defined recursively. Several such functions are presented in the next few subunits.

  • 7.3.1 McCarthy’s 91 Function  
  • 7.3.2 The Ackermann Function  
  • Unit 7: Assessment 1  
  • Unit 7: Assessment 2  
  • Unit 8: Graphs and Trees  

    Graphs serve innumerable functions: they can represent communications systems, chart knowledge, and even solve problems. In this unit, we will acquaint ourselves with special kinds of mathematical graphs while discussing graph concepts from degree and vertex to isomorphism. We will then turn to trees, which comprise a special category of graphs, as they serve special purposes and have different structures. We will conclude with a study of tree and graph properties. Trees and graphs have application to artificial intelligence, scheduling problems, and transportation systems.

    Unit 8 Time Advisory   show close
    Unit 8 Learning Outcomes   show close
  • 8.1 Introduction to Graph Theory  
  • 8.2 The Concept of Graph Degrees  

    Note: Think about a graph and imagine some properties that a graph might have that are characteristic of a graph - essential properties, i.e. not superficial properties like the labels for the nodes. Think some more about how we might define quantitative properties, i.e. those properties that take on numeric values. The following subunits present some thinking on these matters. 

  • 8.2.1 Total Degrees of a Graph  
  • 8.2.2 The Handshake Theorem  
  • 8.3 Isomorphism of Graphs  
    • Reading: Massachusetts Institute of Technology: Srini Devadas and Eric Lehman’s Mathematics for Computer Science: “Graph Theory”

      Link: Massachusetts Institute of Technology: Srini Devadas and Eric Lehman’s Mathematics for Computer Science: “Graph Theory” (PDF)
       
      Also Available in:
      EPUB
       
      Instructions: Read Section 1.6. Isomorphism of two graphs is a formal way of saying that two graphs are essentially the same. Essentially the same means that they are the same with respect to specified properties that characterize a graph.
       
      Let G and H be two graphs. To show G and H are isomorphic, construct a bijection from the vertices of G to the vertices of H that preserves adjacency. The adjacency matrix, defined in section 4, is helpful in supping the construction of an isomorphic mapping.
       
      G and H are not isomorphic if:

      • there is no bijection from the vertices of G to H;
         
      • there is no bijection that preserves adjacency of vertices; and
         
      • G and H have different properties, e.g. vertices have different degrees.
      Reading this selection and taking notes should take approximately 45 minutes.
       
      Terms of Use: This resource is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. It is attributed to Srini Devadas, Eric Lehman and Massachusetts Institute of Technology: Massachusetts Institute of Technology OpenCourseWare. The original version can be found here.

  • 8.4 Trees  
  • Unit 8: Assessment 1  
  • Unit 8: Assessment 2  
  • Unit 9: Regular Expressions and Finite-State Automata  

    Computer language compilers frequently use regular languages (which feature regular expressions) to match patterns within text or perform lexical analysis. This unit will introduce formal languages and state automata to prove the correctness or falsity of a language. We will see that some languages might not be valid for a state automaton, but that we can also define and create state automata for languages defined using regular expressions.
     
    The definition of regular expressions is recursive. This definition and that of regular sets and regular expressions requires careful contemplation on your part.
     
    The topic of formal languages and the related topic of finite state automata are not directly addressed in our two references. Our study of discrete structures has given us the background to develop these topics in instruction paragraphs.
     
    We begin with notation, terminology, and definitions and expressions for formal languages. Then we introduce finite automata and their relationship with regular expressions, and use them to solve problems.

    Unit 9 Time Advisory   show close
    Unit 9 Learning Outcomes   show close
  • 9.1 Formal Languages  
  • 9.1.1 Polish Notation  
  • 9.1.2 Languages Defined by Regular Expressions  
  • 9.1.2.1 Order of Precedence Rules  
  • 9.1.2.2 Deciding Whether Regular Expressions Define the Same Language  
  • 9.2 Finite State Automata  
  • 9.2.1 Automaton and Accepted Language  
  • 9.2.2 Designing a Finite State Automaton  
  • 9.2.3 Showing that a Language Is Not Regular  

    Not all languages are regular. Because a finite state machine has a finite number of states, it can only remember a finite number of inputs. Consider the set {on 1n for all n >= 0}. Because this set requires a recognizing machine to remember n 0’s for any n (so that it can then look for n 1’s), the number of states is infinite, i.e. not a finite state machine. Thus, the language is not regular. Hence, one way to show that a language is not regular is to show that the automaton that recognizes it has an infinite number of states. 

  • 9.2.4 Simplifying Finite State Automata  
  • Unit 9: Assignment 1  
  • Final Exam  

« Previous Unit Next Unit » Back to Top