MIT 6.042J: Mathematics for Computer Science
MIT's discrete mathematics course for computer science, free on OpenCourseWare with lecture videos, notes, an open textbook, problem sets and exams. It covers proofs and induction, sets, relations and functions, graphs, number theory, counting and probability. It is the best free companion to a university discrete maths or theory course.
Course
Other
MIT OpenCourseWare
One semester
Intermediate
Free
What it is
Mathematics for Computer Science (6.042J) is MIT's introduction to the discrete mathematics that computer science relies on. The Spring 2015 edition on MIT OpenCourseWare, taught by Albert R. Meyer and Adam Chlipala, covers fundamental concepts of mathematics (definitions, proofs, sets, functions and relations), discrete structures (graphs, state machines and modular arithmetic) and discrete probability theory. The materials include lecture videos, notes, a full open textbook as a PDF, problem sets and exams, released under a Creative Commons BY-NC-SA licence.
Who it is for
First and second year students taking discrete maths, logic or theory courses, and self-taught developers who want the mathematical base for algorithms, cryptography and theory. You need school algebra and patience with proofs; no calculus is needed for most of the course.
Why it is worth your time
Many students find discrete maths abstract because it is taught as symbols without purpose. This course keeps linking the maths to computing: induction to recursion and program correctness, graphs to networks and scheduling, modular arithmetic to cryptography, counting and probability to algorithm analysis and hashing. The open textbook is one of the most complete free discrete maths books available and is used well beyond MIT.
Free or paid
Everything on OpenCourseWare is free and needs no registration, although MIT's Open Learning Library offers optional sign-in to track progress. There is no certificate.
How to use it
Use the textbook as your main reading and the videos when a chapter does not click. The key skill is proofs, so do problems by hand every week: start with the induction problems, write each proof in full sentences, and check it against the solutions only after a real attempt. If you are taking a university discrete maths course, map its syllabus to the textbook chapters and read those alongside your lectures.
How long it takes
It is a full semester course. Working through the core chapters on proofs, induction, graphs, counting and probability with problem sets is a few months of steady weekly study. You do not need every chapter; pick what your course or goals need.
Common questions
Is it too hard for a first-year student? It is rigorous but starts from first principles. Expect proofs to feel slow at first; that is normal and improves with practice.
Which edition should I use? The Spring 2015 edition has a complete set of videos and materials. The textbook is updated over the years, so a newer version may appear elsewhere on OCW; either works for self-study.
Does it cover automata? It includes state machines, but formal languages and automata theory are usually a separate course.
Ready to start?
Opens on MIT OpenCourseWare in a new tab.
Stuck on something specific?
Writing only gets you so far. If you want an answer to your situation rather than the general case, book a session and we will work through it together. Sessions are free for approved Sefism members, and a few slots open each week.
Follow along
New writing, resources and project ideas land here first.