If you have any questions after reading this Syllabus, post on our discussion forum.
Instructor: Chris Gregg
cgregg @
CoDa E128
We are lucky to have a phenomenal group of Course Assistants:






While the initial foundations of computer science began in the world of discrete mathematics (after all, modern computers are digital in nature), recent years have seen a surge in the use of probability as a tool for the analysis and development of new algorithms and systems. As a result, it is becoming increasingly important for budding computer scientists to understand probability theory, both to provide new perspectives on existing ideas and to help further advance the field in new ways.
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. This is going to be a great quarter and we are looking forward to the chance to teach you.
Our goal in CS109 is to build foundational skills and give you experience in the following areas:
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!
The prerequisites for this course are CS106B and calculus at the level of MATH 21 or equivalent. We will be considering several applications of probability in CS that require familiarity with algorithms and data structures covered in CS106B. We will also assume that you already know how to program. The course programming language is Python, however if you are a strong programmer who never learned Python you will be fine. Past students have managed to take CS106B concurrently with CS109 and have done just fine.
Question: Can you take CS109 if you have another Stanford class at the same time? Answer: No. That generally means they also have overlapping finals.
Lectures are MWF from 1:30pm until 2:50pm. We will be holding live lectures in-person in Hewlett 200. 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. Lecture is a good place to learn, make friends and enjoy probability. Good times!
This term CS109 is recorded. Lectures will generally be available within 24 hours of the live lecture. You can access the recordings through Canvas.
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 are piloting an Oxford-style Tutorial system this quarter, which will mean that instead of large sections, you will have three-person tutorials with a CA or the instructor. These will be weekly, starting in week two, and participation and work done in tutorials will comprise 25% of your grade for the course. Should the CA or instructor feel that you are not prepared for tutorial, you will not earn many points for that tutorial session.
Active participation plays an important role in making you adept at combining probability and computer science. It has also been observed over many quarters that keeping up with the material highly correlates with improved class performance.
Each week you will meet for 50 minutes with two other students and one of our outstanding CAs (or the instructor) and work through problems together. Because the group is so small, there is nowhere to hide, and that is the point. You will do more talking, more explaining, and more thinking out loud than you would in a large section.
Tutorial sign-ups: details on how to get assigned to a tutorial will be announced in lecture on the first day of class and posted here and on Ed. You do not sign up for a tutorial through Axess. Tutorials begin in Week 2.
Tutorial attendance and participation is required for all students, every week. You should come to your tutorial caught up on lecture. In the case of a significant academic or medical-related conflict with your tutorial time, you can request a make-up tutorial, but that is not guaranteed.
The grade for the course will be determined according to the following breakdown:
| Component | Final grade |
|---|---|
| Problem Sets | 10% |
| Midterm | 30% |
| Final | 35% |
| Tutorial participation / work | 25% |
During the course, there will be seven problem sets assigned. We put a lot of love into these problems so that they can help train you to become gifted practitioners of probability and computer science. Use them as practice. Doing well on the problem sets is the best way to prepare for life after CS109 (and the exams). Each student is to submit individual work on the problem sets. The problem sets will often include coding tasks, which will be primarily in python. We also strongly encourage you to learn LaTex, which is the interchangable markup language for typing math on a computer. We will hold a Python review session on Friday after lecture for those of you who are less familiar with python.
This quarter in CS109 we are using "the psetapp", a webapp written by Chris Piech where you can solve your problem sets. Importantly, the psetapp allows you to check your work as you go! That way you can get immediate feedback as to whether you have figured out the solution. Things to know: (1) the psetapp auto saves your progress so you never need to hit a "save" button, (2) similarly, you don't need to hit submit. At the deadline you will no longer be able to edit your work and we will start grading your current saved solutions (3) You can check your answer as many times as you want. There is no penalty for retrying if you didn't get the answer correct the first time.
After you submit we will use a combination of manual and automatic grading. For every problem we expect that you show your work. For each math solution, you should provide a detailed enough explanation beyond just the math itself that someone who is fluent in CS109 would understand how to solve it. Never write down just the answer. For coding solutions, we expect you to use enough comments and good style that it is clear what process your code is using to solve the task.
After grades are released, you have one week to file a regrade request if you think that points were deducted incorrectly. Regrade requests are for significant misgrades only, such as bugs in the psetapp, and we reserve the right to regrade your entire pset.
There may be unforeseen circumstances that make it difficult to turn in homework assignments on time. Our philosophy is to treat you as adults and thus we have a generous late policy to reflect the many different needs that may come up. However, the course will end for everyone on the same date. As such if you are late on one problem set, you will have to work extra hard to catch up. Time management can be hard and we encourage you to give it the full respect it deserves. In practice, falling behind often impacts midterm and final exam scores.
In addition to the assignments, there will be one midterm and a final:
For more details about the format of the exams, see the midterm and final pages. We provide all the material you need to study early on, however we don't expect you to begin preparing until the week before the test.
No Final Alternatives: For a variety of reasons (including university policy), we generally do not provide alternate offerings for the final exam. Please make sure that you can attend the final exam at the specified time before enrolling in the class. Typically, you will not be able to make the final if you are taking another class at the same time as CS109. If you cannot make the final exam, you should plan on taking CS109 in a different quarter. If you start the course and for some reason you can't take the exam, we will offer you an incomplete and you can take the final with a future offering of CS109.
This course is participating in the proctoring pilot overseen by the Academic Integrity Working Group (AIWG). The purpose of this pilot is to determine the efficacy of proctoring and develop effective practices for proctoring in-person exams at Stanford. To find more details on the pilot or the working group, please visit the AIWG’s webpage.
This quarter CS109 will hold an extra credit challenge, 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.
CS109 is a fast-paced course, and catching up after joining the class late is hard. Our policy is that the latest you can add the course is the end of Week 2, and we will not provide extra time beyond the standard late day policy for finishing up pset1. In addition, attending tutorial 2 (in Week 3) is expected regardless of when you join the class, so make sure to get assigned a tutorial right away.
A few years ago, Chris Piech (another CS109 instructor) thought to himself, "you know what CS109 students would probably love? A course reader!" So Chris wrote, and coded, and created a CS109 Course Reader. It is something which he is going to update 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. It has gone through several quarters of iterations but you might still find some small bugs. Please check out the chapters and the demos: Course Reader. This is also a living document, if you notice any errors or typos post in the dedicated Ed thread to let us know!
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.
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).
In addition to regular office hours, we will host homework parties throughout the quarter. These are collaborative, drop-in sessions where you can work on homework alongside other students, with TAs available to help guide discussion and answer questions. Homework parties are a great place to get unstuck and they are also a chance to practice explaining ideas to others.
Not all office hours are the same! The office hour calendar will indicate specific details such as the time and location of each office hours. Office hours are either in person or online. If an office hour time on the calendar says it is in person, there will be no online option — and if the calendar says an office hours session is online, please don't show up at our TAs dorms :).
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.
Once you have your Accommodation Letter, submit it to CS109 using this form rather than emailing it. Please do this as early in the quarter as you can, and at least a week before any exam, so we have time to make arrangements.
Please read our full Honor Code Policy, which specifically prohibits you from soliciting or taking solutions from other students or websites like ChatGPT, Stack Overflow and Chegg.
Genuinely, teaching CS109 is a profound joy. Thanks for coming to learn with us. We can't wait 🌱.