$\DeclareMathOperator{\p}{Pr}$ $\DeclareMathOperator{\P}{Pr}$ $\DeclareMathOperator{\c}{^C}$ $\DeclareMathOperator{\or}{ or}$ $\DeclareMathOperator{\and}{ and}$ $\DeclareMathOperator{\var}{Var}$ $\DeclareMathOperator{\E}{E}$ $\DeclareMathOperator{\std}{Std}$ $\DeclareMathOperator{\Ber}{Bern}$ $\DeclareMathOperator{\Bin}{Bin}$ $\DeclareMathOperator{\Poi}{Poi}$ $\DeclareMathOperator{\Uni}{Uni}$ $\DeclareMathOperator{\Exp}{Exp}$ $\DeclareMathOperator{\N}{N}$ $\DeclareMathOperator{\R}{\mathbb{R}}$ $\newcommand{\d}{\, d}$


Updated 2021091817

If you have any questions after reading this Syllabus, head on over to our FAQ page, post on our discussion forum, or email us at our mailing list: cs109 @ cs.stanford.edu.

Teaching Team

Chris Piech

Professor: Chris Piech
piech @ cs
Durand 328
M 3:00pm-5:00pm

Tim Gianitsos

Head CA: Tim Gianitsos
tgianit @

We are lucky to have a phenomenal group of Course Assistants (photos coming soon).

Our superstar Course Assistants (CAs):

Tim Gianitsos
Georgia Sampaio
Derek McCreight
Roshini Ravi
Erin McCoy
Yunsung Kim
Lucy Lu
Haochen Shi
Chendi Wu
Ian Tullis
Shannon Yan
Daniel Guillen

I. Course Overview

CS109: Probability for Computer Scientists starts by providing a fundamental grounding in combinatorics, and then quickly moves into the basics of probability theory. We will then cover many essential concepts in probability theory, including particular probability distributions, properties of probabilities, and mathematical tools for analyzing probabilities. Finally, the last third of the class will focus on data analysis and machine learning as a means for seeing direct applications of probability in this exciting and quickly growing subfield of computer science. Read more here to learn what CS109 is all about. This is going to be a great quarter and we are looking forward to the chance to teach you.


The prerequisites for this course are CS103, CS106B or X, and Math 51 (or equivalent courses). Probability involves a fair bit of mathematics (set theory, calculus, and familiarity with linear algebra), and we'll be considering several applications of probability in CS that require familiarity with algorithms and data structures covered in CS106B/X. Here is a quick rundown of some of the mathematical tools from CS103 and Math 51 that we'll be using in this class: multivariate calculus (integration and differentiation), linear algebra (basic operations on vectors and matrices), an understanding of the basics of set theory (subsets, complements, unions, intersections, cardinality, etc.), and familiarity with basic proof techniques. We'll also do combinatorics in the class, but we'll be covering a fair bit of that material ourselves in the first week. Past students have managed to take CS106B concurrently with CS109 and have done just fine. CS103 is the pre-requisite that we rely on the least. See our FAQ for more information.

Learning Goals

After you're finished with CS109, we hope you'll have achieved the following learning goals:

  • Reason about situations using probabilities, expectation, and variance.
  • Feel comfortable learning about new probability concepts beyond the scope of this class (e.g., through one's own research, studies, or interests).
  • Write programs to simulate random experiments and to test experiment hypotheses.
  • Understand and implement simple machine learning algorithms like Naive Bayes and Logistic Regression.

Course Topics

Here are the broad strokes of the course (in approximate order). More information is available on our Schedule page. We cover a very broad set of topics so that you are equipped with the probability and statistics you will see in your future CS studies!

  • Counting and probability fundamentals
  • Single-dimensional random variables
  • Probabilistic models
  • Uncertainty theory
  • Parameter estimation
  • Introduction to machine learning

II. Course Structure


If you are an undergraduate, you are required to take CS109 for 5 units of credit (this is by department and university policy, no exceptions). If you are a graduate student, you may enroll in CS109 for 3 or 4 units if it is necessary for you to reduce your units for administrative reasons. Taking the course for reduced units does not imply any change in the course requirements.


We will be holding live lectures in-person in STLC 111 MWF at 1:30p. Come to learn the material, engage in interesting problems collectively with the class. While lecture attendance isn't mandatory it is correlated with doing well in the course and mastering the material! The university has designated our course an "in person" lecture. As such we are not officially recorded. Having said that I will make a good faith effort to record my screen during lecture. I will typically have lecture posted within 6 hours of the live showing.


Active participation plays an important role in making you a master of probability for computer science. It has also been observed over many quarters that keeping up with the material highly correlates with improved class performance.

Each week for 50 minutes you will meet in a small group with one of our outstanding CAs (section leaders) and work through problems. If you have taken any of the CS106 classes, our sections will be very similar---except with more probability. Sign-ups for sections will go out on Wednesday, Sept 22nd and will be open until 5:00PM Pacific Saturday, Sept 25. We will let you know which section you are in by Monday, Sept 29 and you will have your first section that week (during Week 2).

Section attendance and participation is required for all students. Your attendance grade is based on how well you participate; a student that engages and helps others will recieve a better score than one who shows up late and doesn't participate. Students are allowed two (2) makeup sections (i.e. attending another CA's session in the same week) and one (1) unexcused section absence in the quarter without penalty.


The grade for the course will be determined according to the following breakdown:

ComponentFinal grade
Problem Sets 40%
Midterm 20%
Final 28%
Concept Checks 5%
Section participation 7%

Concept Checks

In CS109 you will learn a large amount of content. The class moves as a consistent pace and staying on top of the material is key to success in the class and mastering the material. To help you keep pace we use concept checks for every lecture. Concept checks will be posted right after lecture and are due TWO class periods later (before the start of that lecture). You can submit an unlimited number of times up to and including the deadline; we will only grade the final submission. Concept checks will make up 5% of your final course grade.

Late Policy (Concept Checks)

After the initial deadline on Gradescope, you can submit your concept check up to a week later (also via Gradescope) for partial credit (capped at 50%). No other extensions will be given for concept checks.

Problem Sets

During the course, there will be six problem sets assigned. Each student is to submit individual work on the problem sets. You may discuss with other students and course staff, but you must cite all discussion on your individually written final write-up of the problem set. All homework assignments should be turned in at the beginning of class (1:00pm Pacific) on the respective due date.

Late Policy (Problem Sets)

We anticipate that—more than ever—during this quarter, there may be unforeseen circumstances that make it difficult to turn in homework assignments on time.

  • All problem sets are due at 1:00pm Pacific on the on-time deadline listed on the assignment writeup. If you submit an assignment by the on-time deadline listed on the assignment writeup (generally 1:00pm Pacific), you receive a small extra credit on-time bonus, typically 1% of your final problem set grade. Of course being on time has other benefits -- when you do your work is closer to when you learned the material.
  • All students will be granted a penalty-free "grace period" for submission on all problem sets (except the final assignment). The grace period is one full class day and allows you to submit the assignment after the original deadline, with no impact on the final grade. As an example, a problem set due on Monday may be turned in on Wednesday before 1:00pm Pacific to submit for full credit; a problem set due on Friday may be turned in on the following Monday before 1:00pm Pacific to submit for full credit. This grace period is meant to give built-in flexibility for any unexpected snags—however, we strongly recommend that students submit by the original deadline if possible, in order to avoid falling behind on the class cadence.
  • Submissions turned in up to one class day after the grace period you will lose one letter grade amount of points. We don't accept homeworks after two class periods. Of course if there is an exceptional situation please let us know and we can figure something out.
  • Note that no assignments are accepted beyond the last class day of the regular quarter (Friday Dec 3rd).


In addition to the assignments, there will a midterm and a final:

  • Midterm: Tuesday, Oct 26th, 7:00 - 9:00pm
  • Final: Thursday, Dec 9th, 12:15-3:15pm

In addition to the assignments, there will be a 2-hour midterm exam and a 3-hour final exam. The midterm exam will be administered from 7:00-9:00pm on Tuesday, Oct 26th. A week before the exam we will give more information on what you should do if you have an exceptional circumstance regarding the midterm and cannot make the regularly scheduled midterm exam.

The final examination is Wednesday, December 9th from 12:15pm-3:15pm. For a variety of reasons (including university policy), there will be no alternate time for the final exam. Please make sure that you can attend the final exam at the specified time before enrolling in the class. If you cannot make the final exam, you should plan on taking CS109 in a different quarter

Extra Credit Challege

CS109 has traditionally held an extra credit challege, where students apply the principles in this class to explore a topic of their own choice. Participation in the contest is completely optional and prizes involve extra credit to your final course grade. More details about the contest to be posted midway through the quarter.

III. Course Resources

Brand New Course Reader

Over the break Chris thought to himself "you know what CS109 students would probably love? A course reader!" So Chris spent a good amount of the break writing and coding up notes for CS109. It is something which he is going to release as we go. Please let Chris know if you are curious about something or if you find a typo. Please don't expect anything perfect. This is something brand new after all. Please check out the chapters and the demos: Course Reader draft.

Optional Textbook

Sheldon Ross, A First Course in Probability (10th Ed.), Pearson Prentice Hall, 2018.

This is an optional textbook, meaning that the text is not required material, but students may find Ross offers a different and useful perspective on the important concepts of the class. Suggested, optional reading assignments from the textbook (10th Ed.) are in the schedule on the course website. The 8th, 9th, and 10th editions of the textbook are all fine for this class.

Borrowing the textbook online: HathiTrust, a library archive of which Stanford is a member, has granted the university online access to the 8th edition (2010) for the duration of the Fall quarter. The "check out" system works similarly to print reserves: A user can check out the book an hour at a time as long as they are actively using it. Access guidelines are on the HathiTrust How To Use It webpage. Once you're logged in, the book is at this link.

All students should retain receipts for books and other course-related expenses, as these may be qualified educational expenses for tax purposes. If you are an undergraduate receiving financial aid, you may be eligible for additional financial aid for required books and course materials if these expenses exceed the aid amount in your award letter. For more information, review your award letter or visit the Student Budget website.

"Working" Office Hours

To help make you more successful in this class , the course staff will hold "working" office hours. The idea is to encourage you to work on your problem sets at these office hours, so you can immediately ask any questions that come up while working on your problem sets. While you are certainly not required to attend any of these working office hours, they are simply meant to encourage you to interact with the course staff more often in order to help you better understand the course material. Besides, our job is to help everyone learn the material for this class, and being more accessible to you when you are actually working on your assignments (rather than when you just have a problem) will help the course go more smoothly for you (and it'll be more fun for us).

More information on office hours will be released in the first week of class on this page.


Students who may need an academic accommodation based on the impact of a disability must initiate the request with the Office of Accessible Education (OAE). Professional staff will evaluate the request with required documentation, recommend reasonable accommodations, and prepare an Accommodation Letter for faculty. For students who have disabilities that don't typically change appreciably over time, the letter from the OAE will be for the entire academic year; other letters will be for the current quarter only. Students should contact the OAE as soon as possible since timely notice (for example, at least a week before an exam) is needed to coordinate accommodations. Students should also send your accommodation letter to instructors as soon as possible. If you require additional, or different, accommodations specific to the Fall 2020 learning environment, please contact your disability adviser directly.

IV. Honor Code

Each student is expected to do their own work on the problem sets and exams in CS109. Students may discuss problem sets with each other as well as the course staff. Any discussion of problem set questions with others should be noted on a student's final write-up of the problem set answers. Each student must turn in their own write-up of the problem set solutions. Excessive collaboration (i.e., beyond discussing problem set questions) can result in honor code violations. Questions regarding acceptable collaboration should be directed to the class instructor prior to the collaboration.

It is a violation of the honor code to copy problem set or exam question solutions from others, or to copy or derive them from solutions found online or in textbooks, previous instances of this course, or other courses covering the same topics (e.g., STATS 116 or probability courses at other schools).Copying of solutions from students who previously took this or a similar course is also a violation of the honor code. Finally, a good point to keep in mind is that you must be able to explain and/or re-derive anything that you submit.

Please read our full Honor Code Policy, which specifically prohibits you from soliciting or taking solutions from other students or websites like Stack Overflow and Chegg.

Looking Forward to a Great Quarter

Genuinely, teaching CS109 is a profound joy. Thanks for coming to learn with us. We can't wait 🌱.