Prerequisites and background

TL;DR: CS 121 is a proof-based course that requires a certain level of mathematical maturity and comfort with discrete mathematics. One good way to gain this background is via CS 20, but (especially if you took Math 23/25/55) you can also pick up these concepts via the self study program listed below. The material below is useful for CS 124 as well.

CS 121 expects students to have “experience in formal mathematics at the level of CS 20”. The main requirement is the ability to read, write (and hopefully even enjoy!) mathematical proofs, as well as comfort with (or the ability to pick up) notions from discrete mathematics such as sets, functions, logical operators, asymptotic growth, discrete probability and graphs. See below for more discussion on these topics, as well as advice on how to catch up on them.

If you have not taken Math 23, Math 25, or Math 55, please assess yourself by taking the CS 20 placement test. If you do not find the majority of the questions easy, you should probably take CS 20 before taking CS 121.

Useful resources

The following is recommended for all students to go over as a way to prepare for the mathematical contents of CS 121:

Resources for math background

If you don’t have significant experience and comfort with mathematical proofs, have not taken Math 23/25/55, and don’t find the above placement test easy, then I do recommend you take CS 20 before CS 121. But if it’s not possible for you to take CS 20, or if you feel confident enough about your math skills that you prefer to skip CS 20, it is possible to pick up the required background for CS 121 via self study.

There are a number of great resources available on the web to catch up on those. Some example include the Lehman-Leighton-Meyer notes we discuss below, Jim Aspnes’ online available book Notes on Discrete Mathematics the lecture notes for Berkeley CS 70 and the book by Rosen (which has a freely available version online).

Self study using MIT 6.042j

Below is a concrete suggestion of how to catch up on the most essential background that would be useful for CS 121. The time to work over this material can vary considerably depending on your background, but you should start early to allow yourself at least 40 hours to do so. THe plan below uses the MIT course 6.042j Mathematics for Computer science whose lectures videos, transcripts, and exercises are available online. This course has a very extensive set of lecture notes by Lehman, Leighton and Meyer (henceforth “LLM”) and a previous version by Lehman and Leighton (henceforth “LL”). These lecture notes are also the ones that were used in CS 20 until recently. I don’t know of official solutions to the problem sets, but it seems some solutions are available online.

The following notions are the ones that are most crucial for CS 121, as well as other theoretical CS courses such as CS 124:

Since proofs are so important, if you have not had experience with proofs, I suggest complementing the above with some additional reading. I’ve heard good things about the book How to read and do proofs by Daniel Solow as an introductions to proofs for people with no prior exposure.

There are also some nice handouts from other courses. Stanford’s CS 103 class has a nice set of handouts on proofs, mathematical vocbulary, indirect proofs, and proof writing checklist. This writeup by Hutching is also a good read.

For additional material on probability, see also notes 13 till 18 of Berkeley CS 70. You might also find these notes from Stanford CS229 or this book useful.

Note that we will not use probability until we’re halfway through the course, so you can defer going over this material till later. However, probability is an extremely useful topic, not just for CS 121 but also for algorithms, machine learning, and essentially any form of quantitative reasoning. Moreover the human brain is not well designed for probabilistic reasoning , and it can take time to develop good intuitions for it. So, starting early is always a good thing.