Mathematical Fundamentals

Similar documents
Algorithm Analysis Recurrence Relation. Chung-Ang University, Jaesung Lee

Fall 2017 Test II review problems

Data Structure Lecture#4: Mathematical Preliminaries U Kang Seoul National University

IS 709/809: Computational Methods for IS Research. Math Review: Algorithm Analysis

Why do we need math in a data structures course?

Name CMSC203 Fall2008 Exam 2 Solution Key Show All Work!!! Page (16 points) Circle T if the corresponding statement is True or F if it is False.

1 Examples of Weak Induction

Chapter Summary. Mathematical Induction Strong Induction Well-Ordering Recursive Definitions Structural Induction Recursive Algorithms

Binomial Coefficient Identities/Complements

Data Structure Lecture#4: Mathematical Preliminaries U Kang Seoul National University

Problem Set 5 Solutions

Mathematical Induction. Rosen Chapter 4.1,4.2 (6 th edition) Rosen Ch. 5.1, 5.2 (7 th edition)

1 Recursive Algorithms

Cpt S 223. School of EECS, WSU

Induction and Recursion

1 Sequences and Summation

Math 324 Summer 2012 Elementary Number Theory Notes on Mathematical Induction

With Question/Answer Animations

Mathematical Induction

Lecture 2. Fundamentals of the Analysis of Algorithm Efficiency

Mathematical Induction

CS 220: Discrete Structures and their Applications. Mathematical Induction in zybooks

Induction and recursion. Chapter 5

CmSc 250 Intro to Algorithms. Mathematical Review. 1. Basic Algebra. (a + b) 2 = a 2 + 2ab + b 2 (a - b) 2 = a 2-2ab + b 2 a 2 - b 2 = (a + b)(a - b)

Math 210 Exam 2 - Practice Problems. 1. For each of the following, determine whether the statement is True or False.

MATH 324 Summer 2011 Elementary Number Theory. Notes on Mathematical Induction. Recall the following axiom for the set of integers.

n n P} is a bounded subset Proof. Let A be a nonempty subset of Z, bounded above. Define the set

Algorithm efficiency analysis

CMSC250 Homework 9 Due: Wednesday, December 3, Question: Total Points: Score:

SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION

Mathematical Induction Assignments

Propositional Logic, Predicates, and Equivalence

Mathematical Induction. How does discrete math help us. How does discrete math help (CS160)? How does discrete math help (CS161)?

Mathematical Structures Combinations and Permutations

Math 3000 Section 003 Intro to Abstract Math Homework 6

Analysis of Algorithm Efficiency. Dr. Yingwu Zhu

Math 283 Spring 2013 Presentation Problems 4 Solutions

MAT115A-21 COMPLETE LECTURE NOTES

Math Circle: Recursion and Induction

1 Basic Combinatorics

CHAPTER 4 SOME METHODS OF PROOF

Discrete Mathematics. Spring 2017

Recursive Definitions. Recursive Definition A definition is called recursive if the object is defined in terms of itself.

Recursive Definitions. Recursive Definition A definition is called recursive if the object is defined in terms of itself.

Proof by Induction. Andreas Klappenecker

Induction. Induction. Induction. Induction. Induction. Induction 2/22/2018

Introduction to Number Theory. The study of the integers

Recursion: Introduction and Correctness

MATH10040: Numbers and Functions Homework 1: Solutions

Notes on induction proofs and recursive definitions

MATH 271 Summer 2016 Practice problem solutions Week 1

CSCE 222 Discrete Structures for Computing. Proof by Induction. Dr. Hyunyoung Lee. !!!!!! Based on slides by Andreas Klappenecker

CS Non-recursive and Recursive Algorithm Analysis

Chapter12. Relations, Functions, and Induction

Carmen s Core Concepts (Math 135)

Basic Proof Examples

CSE 20 DISCRETE MATH WINTER

Algorithms: Background

Recursion and Induction

PUTNAM TRAINING NUMBER THEORY. Exercises 1. Show that the sum of two consecutive primes is never twice a prime.

4.1 Induction: An informal introduction

Undergraduate Notes in Mathematics. Arkansas Tech University Department of Mathematics. Introductory Notes in Discrete Mathematics Solution Guide

MATH 2200 Final LC Review

Mathathon Round 1 (2 points each)

3.1 Induction: An informal introduction

INTEGERS. In this section we aim to show the following: Goal. Every natural number can be written uniquely as a product of primes.

McGill University Faculty of Science. Solutions to Practice Final Examination Math 240 Discrete Structures 1. Time: 3 hours Marked out of 60

Quiz 3 Reminder and Midterm Results

INDUCTION AND RECURSION. Lecture 7 - Ch. 4

M381 Number Theory 2004 Page 1

Analysis of Algorithms I: Asymptotic Notation, Induction, and MergeSort

Proofs. Methods of Proof Divisibility Floor and Ceiling Contradiction & Contrapositive Euclidean Algorithm. Reading (Epp s textbook)

Math /Foundations of Algebra/Fall 2017 Foundations of the Foundations: Proofs

Intermediate Math Circles March 11, 2009 Sequences and Series

3 Finite continued fractions

F 2k 1 = F 2n. for all positive integers n.

Department of Computer Science University at Albany, State University of New York Solutions to Sample Discrete Mathematics Examination II (Fall 2007)

Appendix G: Mathematical Induction

MATH 55 - HOMEWORK 6 SOLUTIONS. 1. Section = 1 = (n + 1) 3 = 2. + (n + 1) 3. + (n + 1) 3 = n2 (n + 1) 2.

What can you prove by induction?

Section 4.1: Sequences and Series

Functions. Given a function f: A B:

CS 5321: Advanced Algorithms - Recurrence. Acknowledgement. Outline. Ali Ebnenasir Department of Computer Science Michigan Technological University

Analysis of Algorithms

Carmen s Core Concepts (Math 135)

Climbing an Infinite Ladder

Theoretical Cryptography, Lecture 10

PUTNAM TRAINING MATHEMATICAL INDUCTION. Exercises

Discrete Mathematics. Spring 2017

CS 5321: Advanced Algorithms Analysis Using Recurrence. Acknowledgement. Outline

PRINCIPLE OF MATHEMATICAL INDUCTION

Homework 7 Solutions, Math 55

Module 9: Mathematical Induction

CSE 20. Final Review. CSE 20: Final Review

Input Decidable Language -- Program Halts on all Input Encoding of Input -- Natural Numbers Encoded in Binary or Decimal, Not Unary

MATH 363: Discrete Mathematics

CS Analysis of Recursive Algorithms and Brute Force

Problem One: Order Relations i. What three properties does a binary relation have to have to be a partial order?

Recursion. Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry. Fall 2007

CHAPTER 4: EXPLORING Z

Transcription:

Mathematical Fundamentals Sets Factorials, Logarithms Recursion Summations, Recurrences Proof Techniques: By Contradiction, Induction Estimation Techniques Data Structures 1 Mathematical Fundamentals

Sets A collection of distinguishable members or elements, drawn from a base type. Each member is a primitive element or a set itself. Membership: Either in the set or not in the set. Data Structures Mathematical Fundamentals

Set Notation In the following A and B are sets. A = {1, 4, 7, } {x x is a positive integer} x A x A A A B, B A A B A B A B Data Structures 3 Mathematical Fundamentals

Sets (contd) Linear Ordering Any pair of set elements have a unique order, one of <, >, or =. Transitivity: a < b and b < c implies a < c. Finite Sequence Sequence of length n drawn from (0, 1,, n 1), and have an ordering. May contain duplicates. Data Structures 4 Mathematical Fundamentals

Other Notation KB ( 10 = 104 bytes), MB ( 0 = 1048576 bytes) Kb, Mb: Kilo or Mega bits. Factorial of n is defined as n! = n.(n 1).(n ).1, with 0! = 1 Permutation: Members of a sequence arranged in some order. Boolean variable Floor of x, x, returns the greatest integer less than x. Ceiling of x, x, returns smallest integer greater than x. Modulus returns remainder of integer division. Data Structures 5 Mathematical Fundamentals

Some Important Functions Constant f(n) = c where c is a constant. Linear f(n) = n Quadratic f(n) = n n log n f(n) = n log n Data Structures 6 Mathematical Fundamentals

Logarithms A logarithm of base b for value y is the power to which y must must raise b to get y Applications log b y = x b x = y b log by = y Algorithm analysis (binary search, tree structures) Encoding values. Properties: For positive values m, n log nm = log n + log m log n/m = log n log m log n r = r log n log a n = log b n log b a Data Structures 7 Mathematical Fundamentals

Recursion An algorithm is recursive if it calls itself to do part of its work. Requirements Needs a Base case - simple input that can be solved without recursion. Recursive part - which leads towards the base case. Examples Factorial(n) Fibonacci Sequence Towers of Hanoi Data Structures 8 Mathematical Fundamentals

Summations, Recurrences Summations are useful in adding up algorithm costs, and are represented as f(i) = f(1) + f() + + f(n) Some Summations in Closed Form: i = i = n(n + 1) 1 = 1 1 i i n(n + 1)(n + 1) 6 i = n+1 1 Data Structures 9 Mathematical Fundamentals

Recurrence Relations Useful in analyzing recursive algorithms. Recurrence relations defines a function by including smaller instances of the problem, such as n! = n.(n 1)!, 1! = 0! = 1 F ib(n) = F ib(n 1) + F ib(n ), F ib(1) = F ib() = 1 Towers of Hanoi recurrence: T (n) = T (n 1) + 1 Data Structures 10 Mathematical Fundamentals

Mathematical Proof Techniques Proof by Contradiction Assume the theorem is false. Find a logical contradiction from this assumption. If the logic used is correct, then the original assumption is wrong and the theorem is correct. Example There is no largest integer. Data Structures 11 Mathematical Fundamentals

Example Problems (proof by contradiction) 1. Let a Z. If a is even, then a is even.. Let n Z. If n is odd, then n is odd. 3. There is no largest integer. 4. is irrrational (not of the form a/b, where a, b Z) 5. if a, b Z, a 4b 3 0. 6. if a, b Z, a 4b 0. 7. if a a + 7 is even, then a is odd. Data Structures 1 Mathematical Fundamentals

Proof by Induction To prove a theorem T is true, express T in terms of positive integer n, and then proceed similar to recursion: Base case: T holds for n = c Induction Step: If T holds for n 1, then T holds for n. Data Structures 13 Mathematical Fundamentals

Example: Proof by Induction Base Step: n = 1 1 i = 1 = 1(1 + 1)/ i=n i = n(n + 1) Induction Hypothesis: Let result be true for some k, where 1 < k < n i=k i = k(k + 1) Data Structures 14 Mathematical Fundamentals

General Case. Example: Proof by Induction We need to prove the case for n = k + 1, i.e. i=k+1 = (k + 1)(k + ) Proof. i=k+1 i = [1 + + 3 +... + (k 1) + k + (k + 1)] = [1 + + 3 +... + (k 1) + k] + (k + 1) [ i=k ] = i + (k + 1) = k(k + 1) + (k + 1) // by Induction Hyp. = k + k + (k + 1) = k + 3k + (k + 1)(k + ) = Data Structures 15 Mathematical Fundamentals

Sample Problems (Proof by Induction) i = n(n + 1) n (i 1) = n. i n(n + 1)(n + 1) = 6 i 3 = n (n + 1) 4 i (i + 1) = n (n + 1) 4 i (i + ) = n (n + 1) 4 Data Structures 16 Mathematical Fundamentals

Sample Problems (Proof by Induction) i=0 1 n(n + 1)(n + 7) = i 6 a i = an+1 1 a 1 i = n+1 1 i=0 n 1 i 1 = (n 1) for a > 1 If n N(whole numbers, 0, 1,,..), n n+1 k 1 1 c and 5c stamps can be used to create any denomination greater than or equal to 4. Data Structures 17 Mathematical Fundamentals