CS109: Probability for Computer Scientists
Stanford University: Spring 2019
Monday, Wednesday, Friday 10:30am to 11:50am in Nvidia Auditorium

This is the website for the CS109 offering from Sring 2019. To access the course for Summer 2019, please go to this course page.


Staff / Office Hours
icon Piazza
Course Reader


Problem Set 1
Problem Set 2
Problem Set 3
Problem Set 4
Problem Set 5
Problem Set 6


Tuesday, May 7th
A-N: Hewlett 200
O-Z: Cubberly Aud

Tuesday, June 11th
A-M: Hewlett 200
N-R: Hewlett 201
S-Z: STLC 111

Teaching Team



Chris Piech
Gates 202
Tuesday 1:30-3:30pm


We are officially done with CS109! The teaching team wishes you a wonderful summer with a high probability of good times. Thank you for the great course and see you all around!

Final Exam

The CS109 final is coming up: it is next Tuesday (June 11th) from 8:30 to 11:30am. The final is open notes, open book, closed calculator.

The best way to study is with the practice exams. The practice exam page has been updated with exam location!

Final PSet

The final problem set is now availible. You will derive update equations for a simple deep learning architecture and will implement two machine learning algorithms, Naive Bayes and Logistic Regression. You will then use these algorithms to make predictions on Heart tomography, Netflix movies and Ancestry.

PSet #5

The penultimate problem set is now availible. The problem set includes evaluating peer grading, a/b testing, general inference in webMd.

Midterm Distribution

The midterm solutions are now availible. If you have any questions about how to solve these problems, go talk to a TA or Chris. We would love to explain how to approach these (and similar) problems.

CS109 Contest

This quarter we are going to hold the thrid ever Stanford Probability for Computer Scientists Contest. The contest is completely optional. See the contest handout for more details.

Central Limit Theorem

In class we chatted about how if $Y$ is the sum of $n$ iid random variables (which all have expectation $\mu$ and variance $\sigma^2$) then:

$Y \sim N(n\mu, \frac{\sigma^2}{n})$

The proof is beyond the scope of the class. A friendly CS109 student from last quarter (Sophia Furfine) made a video of the proof in case you are curious!

Midterm next Tuesday

The CS109 midterm is coming up: it is next Tuesday (May 7th) from 7 to 9pm, location based on last name. The midterm is open notes, open book, closed calculator.

The best way to study is by working through the practice exams and section problems.

TAs will also be hosting extra office hours and conceptual office hours from now until the midterm. Check out the office hours page for times, locations, and the specific focus for each particular OH. Some OH will be focusing specifically on conceptual questions in preparation for the midterm, and all OH will prioritize homework problems "above the line" from problem set 4 over those "below the line".

OAE and alternate midterm assignments will be finalized in the coming days; look out for an email with your specific logistics. Email Noah (narthurs) if you requested an alternate midterm and haven't received your information by Monday before the exam.

Problem Set 4

PSet #4 has been released! It has you predict users based on biometric keystrokes. The pset clearly delineates the questions that you should do before the midterm :-).

Problem Set 3

PSet #3 has been released! It uses real probability density functions from the IPCC Climate Change report, has you predict elections and analyze a bloom filter (a probabilistic datastructure).

Galton Board

A Galton board is a physical Binomial distribution where the bucket index that a ball falls into R ~ Bin(n,p) where n is the number of levels and p is the probability of going right each time the ball hits a pin. Check out the JavaScript demo, and the cool video bellow:

Problem Set 2

PSet #2 has been released! Calculate the updated belief of the locaiton of a cell phone and hypothesize the genetic relationship between bats and whether they carry Ebola. Here is a Latex template for pset 2.

Join Gradescope

For pset submission in CS109 we are using gradescope. The entry code is 9B3B62.

If you're new to Gradescope, you can join the class by going to https://gradescope.com/ and clicking the button in the top right marked "Sign Up." Select "Student," then enter the entry code, your full name, email address, and 8 digit student id.

VPTL Tutoring

Stanford offers a free tutoring service for CS109 students called VPTL tutoring! It is ideal if you want to ask about a question/topic/problem in more detail than we have time for in OH. Book appointments here.

Sign up for Section!

Please sign up for section by filling out this form:

Once a week you are going to meet in a small group section. We are going to find the best weekly time for everyone. Section signups will close on Saturday at 11:59pm. Preferences are not first come first serve. SCPD students do not need to worry about this form.

Python tutorial friday

There will be THREE optional Python tutorials Friday (April 5th). The sessions are one hour each, from 12PM-1PM in Thornton 110 (led by Bernardo), 1PM-2PM in Huang 18 (led by Cooper), and 2PM-3PM in Thornton 110 (led by Sawyer). Each session will cover the same material. Python is not required for CS109. However a few problems in the psets require coding and seeing as Python is the language of computer science for probability, it's worth learning. On Friday we will post notes on Piazza and video will be on SCPD.

PSet #1 is out

PSet #1 has been released! It is due next Friday, Apr 12th at 10:00am. Submission will be via Gradescope. Further submission instructions will come out next week. Office hours will start tomorrow (Thursday), and the office hour calendar will have times and locations.

You can optionally write up your problem sets using LaTex. Here is a template for pset 1. See this intro to LaTex, and the LaTex code used to generate it. Though you may install LaTeX, it is often much easier to use an online LaTeX editor. A great option is: overleaf.com.


Welcome to CS109! We are looking forward to a fun quarter. Class starts Monday Apr 1st at 10:30am in Nvidia Auditorium.

What is CS109?

We put together some handouts to help you understand where we are going to go in CS109 and how we plan to get there.

The Administrivia handout has details on course logistics. Read this to get a sense for what CS109 is going to entail.

The   Course Schedule page shows you the topics that we are going to cover in CS109 and the corresponding readings. We will also post materials from lecture on the schedule page.

The Staff / Office Hour page has contact information for TAs and the office hour calendar. Office hours will start this Thursday.