MA/CS 109 Lecture 4. Coun3ng, Coun3ng Cleverly, And Func3ons

Similar documents
MA/CS 109 Lecture 7. Back To Exponen:al Growth Popula:on Models

Building your toolbelt

PROFESSOR: WELCOME BACK TO THE LAST LECTURE OF THE SEMESTER. PLANNING TO DO TODAY WAS FINISH THE BOOK. FINISH SECTION 6.5

EQ: How do I convert between standard form and scientific notation?

Math101, Sections 2 and 3, Spring 2008 Review Sheet for Exam #2:

Introduction to Algebra: The First Week

Solving Quadratic & Higher Degree Equations

Descriptive Statistics (And a little bit on rounding and significant digits)

Solving Quadratic & Higher Degree Equations

ASTRO 114 Lecture Okay. What we re going to discuss today are what we call radiation laws. We ve

Solving Quadratic & Higher Degree Equations

Pre-Test Unit 4: Exponential Functions KEY

Instructor (Brad Osgood)

MATH 22 FUNCTIONS: ORDER OF GROWTH. Lecture O: 10/21/2003. The old order changeth, yielding place to new. Tennyson, Idylls of the King

DIFFERENTIAL EQUATIONS

Q: How can quantum computers break ecryption?

Chapter 1 Review of Equations and Inequalities

Announcements. Topics: Homework: - sec0ons 1.2, 1.3, and 2.1 * Read these sec0ons and study solved examples in your textbook!

Vacuum Systems for Scien1fic Modeling

#29: Logarithm review May 16, 2009

Design and Optimization of Energy Systems Prof. C. Balaji Department of Mechanical Engineering Indian Institute of Technology, Madras

Algebra Exam. Solutions and Grading Guide

Physics Motion Math. (Read objectives on screen.)

MITOCW ocw f99-lec01_300k

Stat 20 Midterm 1 Review

STA Why Sampling? Module 6 The Sampling Distributions. Module Objectives

Chapter 18. Sampling Distribution Models /51

Polynomials; Add/Subtract

Rolle s Theorem. The theorem states that if f (a) = f (b), then there is at least one number c between a and b at which f ' (c) = 0.

Calculus II. Calculus II tends to be a very difficult course for many students. There are many reasons for this.

Do you know how to find the distance between two points?

Exponential and logarithm functions

( )( b + c) = ab + ac, but it can also be ( )( a) = ba + ca. Let s use the distributive property on a couple of

Biostatistics and Design of Experiments Prof. Mukesh Doble Department of Biotechnology Indian Institute of Technology, Madras

Conceptual Explanations: Radicals

Properties of Arithmetic

Honors Math 2 Unit 5 Exponential Functions. *Quiz* Common Logs Solving for Exponents Review and Practice

Do you know how to find the distance between two points?

M155 Exam 2 Concept Review

Ordinary Differential Equations Prof. A. K. Nandakumaran Department of Mathematics Indian Institute of Science Bangalore

The following are generally referred to as the laws or rules of exponents. x a x b = x a+b (5.1) 1 x b a (5.2) (x a ) b = x ab (5.

Dimensional Analysis and Exponential Models Review Solutions

What is Crater Number Density?

Chapter 1: January 26 January 30

P vs. NP. Data Structures and Algorithms CSE AU 1

Please bring the task to your first physics lesson and hand it to the teacher.

Final Review Sheet. B = (1, 1 + 3x, 1 + x 2 ) then 2 + 3x + 6x 2

Evaluation Module: Care for the Chronically ill Person Spring 2010 Responsible for the evaluation process: Project manager, Mette Bro Jansen

CSE 373: Data Structures and Algorithms Pep Talk; Algorithm Analysis. Riley Porter Winter 2017

How to use these notes

Note that we are looking at the true mean, μ, not y. The problem for us is that we need to find the endpoints of our interval (a, b).

N/4 + N/2 + N = 2N 2.

Volume vs. Diameter. Teacher Lab Discussion. Overview. Picture, Data Table, and Graph

ABE Math Review Package

Section 2.7 Solving Linear Inequalities

1.1 Administrative Stuff

MITOCW MITRES18_005S10_DiffEqnsGrowth_300k_512kb-mp4

Polynomial Operations

Main topics for the First Midterm Exam

When we use asymptotic notation within an expression, the asymptotic notation is shorthand for an unspecified function satisfying the relation:

C. Finding roots of trinomials: 1st Example: x 2 5x = 14 x 2 5x 14 = 0 (x 7)(x + 2) = 0 Answer: x = 7 or x = -2

MITOCW watch?v=poho4pztw78

Fundamentals of Mathematics I

Logarithms and Exponentials

Sequences and Series

MI 4 Mathematical Induction Name. Mathematical Induction

MATH 408N PRACTICE MIDTERM 1

Astronomy 102 Math Review

One-to-one functions and onto functions

Lecture Space Bounded and Random Turing Machines and RL

Ch1 Algebra and functions. Ch 2 Sine and Cosine rule. Ch 10 Integration. Ch 9. Ch 3 Exponentials and Logarithms. Trigonometric.

MITOCW ocw f99-lec17_300k

Name Solutions Linear Algebra; Test 3. Throughout the test simplify all answers except where stated otherwise.

Algebra & Trig Review

Solving with Absolute Value

CSE332: Data Structures & Parallelism Lecture 2: Algorithm Analysis. Ruth Anderson Winter 2019

Pendulum Activity! Frequency, Length, and Gravity. Materials

Introduction to Logarithms What Is a Logarithm? W. L. Culbertson, Ph.D.

Understanding Exponents Eric Rasmusen September 18, 2018

C if U can. Algebra. Name

ACCESS TO SCIENCE, ENGINEERING AND AGRICULTURE: MATHEMATICS 1 MATH00030 SEMESTER / Lines and Their Equations

Complete Week 18 Package

Math 131, Lecture 20: The Chain Rule, continued

Chapter 5 Simplifying Formulas and Solving Equations

Section 20: Arrow Diagrams on the Integers

Lecture 12: Quality Control I: Control of Location

base 2 4 The EXPONENT tells you how many times to write the base as a factor. Evaluate the following expressions in standard notation.

Algebra II. Slide 1 / 261. Slide 2 / 261. Slide 3 / 261. Linear, Exponential and Logarithmic Functions. Table of Contents

CS 301. Lecture 18 Decidable languages. Stephen Checkoway. April 2, 2018

Menu. Lecture 2: Orders of Growth. Predicting Running Time. Order Notation. Predicting Program Properties

2. FUNCTIONS AND ALGEBRA

Lesson 3: Graphs of Exponential Functions

Calculus I. Activity Collection. Featuring real-world contexts: by Frank C. Wilson

MITOCW MITRES18_005S10_DiffEqnsMotion_300k_512kb-mp4

QUADRATICS 3.2 Breaking Symmetry: Factoring

farads or 10 µf. The letter indicates the part tolerance (how close should the actual value be to the marking).

LECTURE 15: SIMPLE LINEAR REGRESSION I

Calculus of One Real Variable Prof. Joydeep Dutta Department of Economic Sciences Indian Institute of Technology, Kanpur

Lecture 10: Powers of Matrices, Difference Equations

CSE332: Data Structures & Parallelism Lecture 2: Algorithm Analysis. Ruth Anderson Winter 2018

Transcription:

MA/CS 109 Lecture 4 Coun3ng, Coun3ng Cleverly, And Func3ons

The first thing you learned in math The thing in mathema3cs that almost everybody is good at is coun3ng we learn very early how to count. And we count things pencils, straws, cards, When we get older we count mostly one thing Money.

Last Time Counted the number of ways to assign 50 TA s to 50 classes and to assign 100 TA s to 100 classes (one per class). But what about 52 TA s to 52 classes or 37 TA s to 37 classes. For each number of TA s and classes there is a number of ways to assign them

Func3ons A func3on is a rela3onship between two different quan33es such that each value of the first quan3ty is related to one value of the second quan3ty. t P P(t)

Why are func3ons nice? 1. They answer a bunch of ques3ons at once (the func3on giving the number of ways to assign N TA s to N classes tells us how many ways for all possible N at once). 2. We can ask more interes3ng and sophis3cated ques3ons when we have a func3on we know a rela3onship between two quan33es, not just par3cular values.

What sort of ques3ons? How fast does the func3on value grow as the input grows? Lots of applica3ons we know the number of web pages keeps growing every day it has to take Google longer and longer to search those pages. At what point will there be so many web pages that Google can t possibly search them all? (And will that happen soon?)

Simple example Here s another toy example. Suppose a teacher wants to call on a student during a lecture to answer a ques3on. If there are 5 students, then there are 5 ways to call on a student. If there are 8 students, there are 8 ways to choose the student to call on if there are 17 students you get the idea. IF there are N students, then there are N ways to pick one student.

Nota3on Let N be the number of students. Let L(N) be the number of ways to pick one student to answer a ques3on. Then L(N)= N (the number of ways to pick a student is the same as the number of students.) (Why is the func3on called L?)

Pay off of abstract view We can see the func3on draw a graph. This allows us (among other things) to see how fast it grows as N gets big. L(N) 12 10 8 6 4 2 0 0 2 4 6 8 10 12 N

Pay off of abstract view No3ce that the number of students and the number of ways of picking one student grow at the same rate. 12 L(N) 10 8 6 4 2 0 0 2 4 6 8 10 12 N

Pay off of abstract view That is the rate of growth of L (the size of L(N+1)- L(N)=(N+1)- N=1 is always the same Property of lines). 12 L(N) 10 8 6 4 2 0 0 2 4 6 8 10 12 N

Another Func3on Suppose you have N students and you want to pick 2 students to answer ques3ons (you don t care if you ask the same student twice). How many ways are there to choose a student for ques3on 1 and a student for ques3on 2? Mul3plica3on Principle again N ways to pick student 1 and N ways to pick student 2 (CAN pick the same student twice) so Q(N) = N x N = N 2 ways. (Why Q?)

How fast does Q grow? Red is Q, blue is L (Note scale) 120 120 100 100 80 80 60 60 40 40 20 20 0 0 2 4 6 8 10 12 0 0 10 20

Keep going. Choose 3 students from N (repeats allowed) for ques3ons 1, 2 and 3: C(N)=NxNxN=N 3 Choose 4 students from N (repeats allowed) for ques3ons 1,2,3 and 4: F(N) = NxNxNxN = N 4 Keep going all day

The bigger the power, the faster the growth 1400 45000 1600000 1200 40000 1400000 1000 800 600 400 35000 30000 25000 20000 15000 10000 1200000 1000000 800000 600000 400000 200 5000 200000 0 1 4 7 10 13 16 19 22 25 28 31 34 0 1 4 7 10 13 16 19 22 25 28 31 34 0 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 Blue is quadra3c growth (Q(N)=N 2 ) in all three graphs, Red is cubic growth (C(N)=N 3 ) in middle, right graphs, Green is quar3c growth (F(N)=N 4 ) in the right graph.

Rate of Growth We say that the rate of growth of the cubic func3on is faster than the quadra3c func3on because eventually (for N big) N 3 is hugely bigger than N 2. The rate of growth of the fourth degree quar3c func3on is faster than the cubic func3on and so on

Rate of Growth: A liile algebra How fast does N 2 =Q(N) grow? How much does Q change when N is changed by 1. Well, look at how much Q(N)=N 2 changes from N to (N+1). We compute (N+1) 2 - N 2 = N 2 + 2N + 1 N 2 = 2N +1 Increasing N by 1 increases N 2 to (N+1) 2, the amount of increase is by 2N+1. So the rate of growth of N 2 is propor3onal to N. (The larger N is the faster N 2 grows.)

Rate of Growth Turns out C(N)=N 3 grows at a rate that increases quadra3cally (like Q(N)=N 2), While F(N)=N 4 grows at a rate that increases cubically and so on. So Moral The bigger the power the faster the growth Lots and lots faster!

Can t even see quadra3c func3on grow on the right 1400 45000 1600000 1200 40000 1400000 1000 800 600 400 200 35000 30000 25000 20000 15000 10000 5000 1200000 1000000 800000 600000 400000 200000 0 1 4 7 10 13 16 19 22 25 28 31 34 0 1 4 7 10 13 16 19 22 25 28 31 34 0 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 Blue is quadra3c growth (N 2 ) in all three graphs, Red is cubic growth (N 3 ) in middle and right graph, Green is quar3c growth (N 4 ) in the right graph.

Even Faster Growth? Are there func3ons that grow faster than any power? and do these func3ons occur in our daily lives??

Even Faster Growth? Are there func3ons that grow faster than any power? and do these func3ons occur in our daily lives?? YES! Exponen3al Growth!

Even Faster Growth? Are there func3ons that grow faster than any power? and do these func3ons occur in our daily lives?? YES! Exponen3al Growth! Exponen3al growth have a rate of growth related to the size of the func3on So The Bigger the value, the Faster it Grows

The Bigger it is the Faster it Grows Sounds like the tag line of a horror movie And some3mes it is you have a dangerous generator of exponen3al growth lurking in your wallet right now (Ba Dah, Ba Dah, Ba Dah,..)

CREDIT CARD DEBT!!! Any sort of compound interest that is any 3me when you hear The amount you owe grows by.% per year This is saying the amount you owe grows at a rate propor3onal to what you owe so the more you owe, the faster your debt grows EXPONENTIAL GROWTH!!!

How fast is Exponen3al Growth? Suppose you charge $100 on a credit card you get for free in college you forget the charge and move away and the credit card company doesn t find you un3l your 40 th reunion How much do you owe now (assuming 18% per year interest). First year 100 + 0.18 x 100 = 118 Second year 118 + 0.18 x 118 = 139.24

Aser 40 years debt= $75,037.83 80000 70000 60000 50000 40000 Characteris3c shape of graphs of exponen3al growth. 30000 20000 10000 0 0 5 10 15 20 25 30 35 40 45

Even small percentage rates have this shape. CO 2 in the atmosphere grows at a rate of 2% per year (increases by 600 percent in 100 years ) 800 700 600 500 400 300 200 100 0 0 20 40 60 80 100 120

Even small percentage rates have this shape. CO 2 in the atmosphere grows at a rate Of 1% per year (increases by 170 percent in 100 years, 630 percent 800 700 600 500 400 300 200 100 in 200 years) 0 0 50 100 150 200 250

The most important things you will learn in college or ever

The most important things you will learn in college or ever 1. Never trust anybody over 30. 2. Exponen3al growth can not go on forever.

D uh Of course exponen3al growth can t go on forever. Quadra3c, even linear growth can t go on forever on a finite planet But exponen3al growth is a lot more devious and poten3ally dangerous because of the shape of the graph

Linear growth to 100 Note that for linear growth, if we reach the limit at 3me 10, we are half way to 100 at 3me 5 and nine tenths of the way to 100 at 3me 9 We see the end coming. 120 100 80 60 40 20 0 0 2 4 6 8 10 12

Exponen3al growth to 100 For exponen3al growth, if we reach the limit at 3me 10 then at 3me 5 we are only at about 10% of the way to 100, at 3me 9 we are s3ll only at 63%. The fastest growth comes at the end. The limit sneaks up on us. 120 100 80 60 40 20 0 0 2 4 6 8 10 12

This is what makes exponen3al growth dangerous. The rate of increase increases so fast that the values eventually grow very quickly. Everything seems find and suddenly- - - BAMM, you are at the limit. This doesn t mean the world ends or there is catastrophe at least it doesn t always mean that. But it does mean that things will change and if the limit of growth is strict then change will come quickly!

Example World popula3on growth has been exponen3al for millennia and predic3ons of dire catastrophe because of overpopula3on have been around for a long 3me From hips://www.learner.org/courses/envsci/visual/visual.php?shortname=past_pop_growth

Example Predic3ng the end of the world as we know it because of popula3on growth is actually preiy accurate For example, look at agriculture From hips://www.learner.org/courses/envsci/visual/visual.php?shortname=past_pop_growth

Yes, we would have run out of food due to popula3on growth except that something changed! We (as a species) got a lot beier at growing food! Also, cultural change has reduced popula3on growth in many countries From: Washington Post, A brief History of U.S. corn in one chart, Brad Plumer, Aug 16, 2012

Glass half full! The above is the pessimist s view exponen3al growth is dangerous! The op3mist says Thank goodness for exponen3al growth. It is a miracle. By inves3ng in an account that has exponen3al growth (where the return is a percent of the investment) my money will eventually grow very fast I will re3re rich!!

So if you can recognize exponen3al growth, then you can expect there to be change (good or bad) and the change may have to happen rapidly. If you see change coming it is like seeing the future! Two problems: 1. How do we recognize exponen3al growth. 2. How do we predict what changes will happen?

Easier problem 1. How do we recognize exponen3al growth Need another new func3on. Turns out this func3on is extremely useful but also you need to think to understand it. Logarithms! hips://opinionator.blogs.ny3mes.com/2010/03/28/ power- tools/ (By the way, this is a nice ar3cle )

Logarithms We use the type of Logs that computer scien3sts love Logs base 2: Log base 2 of a number a is the number b such that 2 b =a. We write Log 2 (a)= b. So Log 2 (2) = 1 because 2 1 =2 Log 2 (4) = 2 because 2 2 =4 Log 2 (8) = 3 because 2 3 =8

Quiz Log 2 (16) = 4 because 2 4 =16 Log 2 (32) = 5 because 2 5 =32

Quiz Log 2 (16) = because 2? =16 Log 2 (32) = because 2? =32 Log 2 (25) = because 2? =25

Quiz Log 2 (16) = 4 because 2 4 =16 Log 2 (32) = 5 because 2 5 =32 Log 2 (25) = between 4 and 5 because 2 4 =16 and 2 5 =32. (Ask Google Log 2 (25) ~ 4.644 because 2 4.644 is about 25.

Impress Prof Snyder Computer Scien3sts use powers of 2 (and Log 2 ) a lot because they use the TWO digits 0 and 1 to represent states of a bit To impress Prof Snyder (and make the CS part of the class easier Memorize 2 1 =2 2 6 =64 2 2 =4 2 7 =128 2 3 =8 2 8 =256 2 4 =16 2 9 =512 2 5 =32 2 10 =1024

And Remember 2 10 = 1024 which is approximately 1000 (so Log 2 (1000) = 9.966 which is almost 10 Note that Log 2 of 1000 is only (about) 10 Log 2 (2000) is about 11, Log 2 (4000) is about 12 So Log 2 grows really, really slowly

Use property of Log 2 In fact, Log 2 grows so slowly that it turns exponen3al growth (very fast growth) into linear growth. (This is the property of Logs that goes Log 2 (a N ) = N(Log 2 (a)). Logs turn exponen3a3on into mul3plica3on )

Looking at Data So suppose I have some data: Time Money Time 0 100 Time 1 170 Time 2 289 Time 3 491 Time 4 835 Time 5 1491 Time 6 2413 Time 7 4103 Time 8 6975 Time 9 11858 14000 12000 10000 8000 6000 4000 2000 0 0 2 4 6 8 10 Displays rapid growth Is it Exponen3al growth?

Log charts Compute the Log 2 of money and plot that That is, make a Log 2 plot - - Time Money Log base 2 (money) 0 100 6.643 1 170 7.409 2 289 8.175 3 491 8.939 4 835 9.706 5 1491 10.471 6 2413 11.237 7 4103 12.002 8 6975 12.768 9 11858 13.533 16000 3200 1600 100 32 2 0 2 4 6 8 10 The Log plot is a line!

Log charts You have a Log chart if the ver3cal axis is not evenly divided more spread out. Time Money Log base 2 (money) 0 100 6.643 1 170 7.409 2 289 8.175 3 491 8.939 4 835 9.706 5 1491 10.471 6 2413 11.237 7 4103 12.002 8 6975 12.768 9 11858 13.533 16000 3200 1600 100 32 2 0 2 4 6 8 10 The Log plot is a line!

One more example of exponen3al growth Croissant. Make a croissant by encasing a layer of buier between 2 layers of dough. Then you spread (roll out) this package into a thin sheet and fold so that there are now three layers of buier. You repeat the process and 3 layers become 9, Repeat again and 9 layers become 27 Each repeat is called a turn (because you rotate the dough 90 degrees before folding).

How many layers aser 4 turns? Why not do 10 turns?...