probability for computer scientists n.
Skip this Video
Loading SlideShow in 5 Seconds..
Probability for Computer Scientists PowerPoint Presentation
Download Presentation
Probability for Computer Scientists

Loading in 2 Seconds...

play fullscreen
1 / 35

Probability for Computer Scientists - PowerPoint PPT Presentation

  • Uploaded on

Probability for Computer Scientists. CS109. Cynthia Lee. Today’s Topics. Introductions Course structure and procedures What is this class? Why is it one of the most important in the major? Diving right in to the content: Some basic prerequisite math Counting Next lecture:

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about 'Probability for Computer Scientists' - lillith-harrington

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
today s topics
Today’s Topics
  • Introductions
  • Course structure and procedures
  • What is this class? Why is it one of the most important in the major?
  • Diving right in to the content:
      • Some basic prerequisite math
      • Counting

Next lecture:

    • Combinations, permutations

Cynthia Lee


Welcome to CS109!

  • Quick poll: how many of you have been in a class with me before?
We have several Outstanding TAs to help you this quarter*:

Laura Griffiths


Brandon Ewonus


Kevin Shin

* Some images are only an approximation.

what is cs109 all about
What is CS109 all about?

Probability and Computer Programming are two of the most important (academic) skills in the world today!!

cs view of probability
CS View of Probability

probability in industry
Probability in Industry

Microsoft's competitive advantage, [Bill Gates] responded, was its expertise in "Bayesian [probabilistic] networks.“

(from Los Angeles Times, Oct. 28, 1996)

  • “The sexy job in the next 10 years
  • will be statisticians.”
  • Hal Varian, Chief Economist at Google
  • (from New York Times, August 6, 2009)
getting help
Visit our “working office hours”

Starting Wednesday, there will be office hours available nearly every day

Please take advantage of these as a time to do your work, even if you don’t think you have a question/problem (yet)

Other help resources:


This goes to me and to the TAs, so you can get a fast response!

Use this for your questions about homework, course logistics, grading, extensions, or just about anything else

Getting Help
textbook handouts
Sheldon Ross, A First Course in Probability

(9th Ed.), Pearson Prentice Hall, 2013.

8th edition would also work

We will stay relatively close to the text for the first 2/3 of the quarter, and then go off into some other topics (machine learning) at the end of the quarter

Handouts will be our guide for material that is outside the book

Textbook, Handouts
your grade your choice
Your grade: your choice!
  • Breakdown of Final Grade:
    • 5% Lecture participation
    • 25% Midterm
    • 30% Final
    • 40% Pset assignments


  • Breakdown of Final Grade:
    • 25% Midterm
    • 35% Final
    • 40% Pset assignments
other grade notes
Other grade notes
  • Final letter grades will be no stricter than 90% = A-, 80% = B-, 70% = C-, 60% = D-, but I may curve more generously by a few percentage points if necessary to adjust for exam difficulty.
  • Undergraduates must take the course for 5 units.
  • Graduate and professional students may take the course for 3 units, but this does not change course requirements.
  • Please note that you need to earn a passing grade (55%) on the final exam in order to pass the class, regardless of total numeric grade at the end of the quarter.
6 assignments: 5 written problem sets and 1 primarily code-writing (with some written)

Assignments may be completed individually or in pairs

This policy change is new this quarter (lucky you!!). Although I do like group work, the change was in part catalyzed by a severe TA shortage this quarter. I suppose what I’m saying is, it may not be this way in future quarters, so don’t let the word get out or future students may be disappointed. 

Find a partner and have the same partner throughout the quarter

Please only “divorce” in extenuating circumstances

This is not a license for unlimited collaboration! Collaboration outside your pair is limited by the same standards that would apply to an individual assignment

Submit your assignments electronically on

Also new this quarter

late days
late day: allows you to submit a homework 1 Lecture Day late

After your free late days are exhausted (on this assignment or a previous), you are assessed 20% deduction per 24 hours.

Late Days
stanford honor code
The Honor Code is an undertaking of the students, individually and collectively:

that they will not give or receive aid in examinations; that they will not give or receive unpermitted aid in class work, in the preparation of reports, or in any other work that is to be used by the instructor as the basis of grading;

that they will do their share and take an active part in seeing to it that others as well as themselves uphold the spirit and letter of the Honor Code.

The faculty on its part manifests its confidence in the honor of its students by refraining from proctoring examinations and from taking unusual and unreasonable precautions to prevent the forms of dishonesty mentioned above. The faculty will also avoid, as far as practicable, academic procedures that create temptations to violate the Honor Code.

While the faculty alone has the right and obligation to set academic requirements, the students and faculty will work together to establish optimal conditions for honorable academic work.

see also:

Stanford Honor Code
lecture participation
Lecture participation:
  • Register yourself for socrative:
    • It is available as a web app (browser on phone or laptop), or a phone app (all major mobile platforms)
    • It is FREE
  • IF you choose to get credit for participation:
    • You may miss up to 6 days with no penalty
  • Whether you choose to get credit for participation, OR NOT:
    • If you come to class, sit in a cluster of about 3 students (2-4; more than 4 and it’s hard to hear each other)
    • Participate in a way that is fruitful for yourself and your groupmates, vote in the Socrative votes (can vary from about 1-5 per lecture)
    • Groups do not need to be the same each lecture, and do not need to be tied to your homework partner

You don’t know what automata is, do you? SOON!

lecture participation is this a flipped classroom
Lecture participation?...Is this a flipped classroom?

Yes and No.

  • We don’t expect you to watch videos of lecture outside of class.
  • We don’t expect you to do anything out of the ordinary, really.
  • Just come to class (ok that might be out of the ordinary for some of you upper class students ), where “lecture” will involve more talking to your friends than you might be used to.

The ideas, not your neighbors


Frequently Asked Question: “My friends and I sometimes struggle when solving these problems. Wouldn’t it be a more efficient use of time if you just taught us the right answer to begin with?”

  • Have you ever heard of a yoga class where the instructor did all the exercises at the front of class, while the class just watched attentively?
  • Me neither!
  • A yoga class where you just sit there would be a waste of time.
  • To learn, you must do the work with your own muscle (your brain). This won’t always be as “pretty” as when the yoga instructor demonstrates it for you, but struggle is necessary to learning.
  • Like a yoga instructor, I still teach you. But I do it while you actively engage.
getting started to do list
Getting started to-do list:
  • Visit our class website and orient yourself:
  • Sign up for Socrative (question-answering software)
  • Get ready for your first assignment on Wednesday!

You don’t know what automata is, do you? SOON!

some basic prerequisite math
Some Basic Prerequisite Math

Our first topic of the quarter

floor and ceiling
Floor and Ceiling
  • These are useful in both probability and discrete math:
    • Floor: The floor of a real number x is the largest integer less than or equal to x. We denote floor of ½ like this::
    • Ceiling: The ceiling of a real number x is the smallest integer greater than or equal to x. We denote ceiling of 8.0 like this:
  • Group question: in how many of the exercises to the left is the answer ≤ the input to the floor/ceiling?
    • None
    • 1
    • 2
    • 3
    • All 4, baby!
pigeonhole principle
Pigeonhole Principle
  • Fancy name for a really obvious concept (we’ll actually be seeing that several times this quarter…)
pigeonhole principle1
Pigeonhole Principle
  • Group Question: Consider a hash table with 100 buckets. 950 strings are hashed and added to the table. How many of the following statements are true?
    • It is possible that a bucket in the table contains no entries.
    • It is guaranteed that at least one bucket in the table contains at least two entries.
    • It is guaranteed that at least one bucket in the table contains at least 10 entries.
    • It is guaranteed that at least one bucket in the table contains at least 11 entries.
  • None is true
  • 1 is true
  • 2 are true
  • 3 are true
  • All 4, baby!
sum rule of counting
Sum Rule of Counting
    • Already (!) we have another fancy name for a pretty obvious concept
  • Definition: Sum Rule of Counting
  • ifoutcome of experiment can be from
  • set A, where |A| = m, or
  • set B, where and |B| = n, and
  • A  B = , // this line here is the kicker
  • then the number of outcomes of the experiment is |A| + |B| = m + n.
  • Example: You're Facebook and you have data centers in San Jose and Denver: 100 machines in SJ, and 250 machines in Denver. If I send a request to Facebook, and it is routed to exactly machine, how many possible outcomes (machines it could be routed to) are there?
  • Solution: A new user request can be sent to any of 100 + 250 = 350 machines.
      • Now you’re wondering why you didn’t matriculate at Stanford after 2ndgrade 
inclusion exclusion principle
Inclusion-Exclusion Principle
  • Definition: Inclusion-Exclusion Principle
  • if outcome of experiment can be from
  • set A or set B,
  • where A and B may overlap,
  • then the number of outcomes is: |A  B| = |A| + |B| - |A  B|
  • This removes that “kicker” restriction from the Sum Rule of Counting.
product rule of counting
Product Rule of Counting
  • Definition:Product Rule of Counting:
  • if an experiment has two parts,
  • outcome from set A in 1st part, where |A| = m, and
  • outcome from set B in 2nd part (regardless of the first part), where |B| = n,
  • then the total number of outcomes is |A| |B| = mn.
  • Example: You roll two 6-sided dice, one is red one is blue. How many possible outcomes are there?
  • Solution: There are 36 possible outcomes.
      • REALLY IMPORTANT: pay attention to how we define “outcomes.” If the question was asking about the sum of the two dice, we would get a different answer.
counting practice
Counting Practice
  • Group Question: How many ways can 4 bits be ordered that start or end with 1?
  • Be sure to discuss in your group which rules/principles (by name!) you applied in your calculations.