UW-Madison · CS240 · Introduction to Discrete Mathematics

CS240: ace the component, not just read the notes

Your complete guide to University of Wisconsin-Madison's introduction to discrete mathematics course. See where the marks are, work real practice questions, and study with an AI tutor that knows CS240.

3 credit points Intermediate undergrad Offered Fall / Spring Department of Computer Sciences and Department of Mathematics

Sia generates CS240 practice questions, walks through propositional and sets step by step, and quizzes you on the material the component that weights most heavily.

Try a real exam-style question

Worked example

Multiple choice · solution revealed after you answer

An algorithm on an input of size n splits it into two halves, solves each recursively, and does O(n) work to combine. Which recurrence describes its running time, and what does it solve to?

Worked solution

Read the structure off the description: two recursive calls, each on half the input, plus linear combining work.

That gives T(n) = 2T(n/2) + O(n).
Unfold it: each level does O(n) total combining work, and there are log n levels because the input halves each time.
Multiply: O(n) per level times log n levels gives O(n log n). This is exactly the merge sort recurrence.

The trap: Writing one recursive call instead of two, which describes binary search rather than a divide-and-conquer algorithm that solves both halves. Constructing the recurrence correctly is the step that decides the answer; solving it afterwards is mechanical, which is why the outcome names constructing recurrences before solving them. classic slip!

Overview

What CS240 is, and where it sits

COMP SCI/MATH 240 is the discrete mathematics course shared by the computer sciences and mathematics departments, and it is the bridge between programming and theory. It carries 3 credits at intermediate level and takes calculus as its prerequisite.

The content spans logic, sets, partial order and other relations, and functions, then the basic machinery of mathematics itself, definitions, proofs, sets, functions and relations, applied to discrete structures: integers, bits, strings, trees and graphs. Propositional logic, Boolean algebra and predicate logic follow, then mathematical induction and recursion, invariants and algorithmic correctness, recurrences and asymptotic growth analysis, and the fundamentals of counting.

The published outcomes state the real demand plainly. The first is demonstrating proficiency with the basic skills for constructing and evaluating mathematically rigorous arguments and proofs. Others include proving properties by induction across several domains including loop invariants and program correctness, constructing and solving recurrences, applying asymptotic analysis, and connecting a simple language to a finite state machine or regular expression in both directions. This is the course that makes later algorithms and theory courses possible.

How it differs from its first-year siblings. COMP SCI/MATH 240 is a requisite for later theory courses including introduction to the theory of computing, and it is one of the two discrete-mathematics routes accepted for them.

Always treat your own course outline and the exam timetable as authoritative.

Difficulty & time commitment

Is CS240 hard, and how much time does it take?

CS240 is manageable if you keep a weekly rhythm and treat the back half as the main event. The pattern is consistent: it starts gently and steepens, and the heaviest assessment is the part that separates grades.

Difficulty
3.7 / 5
Hard. Gentle early, demanding back half. Hard to fail with steady work; a top grade takes consistent practice.
Coursework
0%
Coursework carries most of the grade. The heaviest single component is the component at 0%.
First thirdLogic, sets, relations, functions
Middle thirdInduction and recursion
Final thirdCounting, recurrences, automata

The difficulty curve and the assessment weighting point the same way: the back half is harder and worth more. Front-loading effort there is the highest-return decision in the course.

Is this course for you

Who tends to do well, and who tends to struggle

You will likely do well if

  • You are willing to write proofs badly for a few weeks before writing them well.
  • You do problem sets rather than reading solutions.
  • You can hold a formal definition precisely rather than approximately.
  • You connect the abstraction back to code, which the invariant material rewards.

You may struggle if

  • You came from the programming sequence expecting more of the same.
  • You skip the logic weeks as preliminaries; every later definition uses them.
  • You memorise proof templates without understanding what makes them valid.
  • You leave induction until you need it for recurrences.
do this ↘
What top students do differently
  • Write one full proof per week by hand and have someone else read it for gaps.
  • For each theorem, construct a counterexample to a weakened version; it shows which hypothesis matters.
  • Practise turning an algorithm into a recurrence, which is the step that carries the marks.
  • Do the finite state machine translations in both directions until they are symmetric in your head.

Syllabus

The 9 topics, topic by topic

The exam-weight marker on each topic shows where the marks concentrate. The amber topics carry the highest exam weight.

T1

T1 · Propositional and predicate logic

Course description

The formal language everything else is written in, plus Boolean algebra.

T2

T2 · Sets, relations and functions

Course description

Including partial orders. The vocabulary of every definition later in the course.

High exam weightQuiz me on sets →
T3

T3 · Proof technique

Learning outcome 1

Constructing and evaluating rigorous arguments. The first outcome, and the skill the course exists to install.

T4

T4 · Mathematical induction

Learning outcome 2

Proving properties of formulas, recursively defined structures, loop invariants and program correctness.

T5

T5 · Discrete structures: integers, bits, strings, trees, graphs

Learning outcome 3

The objects computing actually manipulates, treated formally.

T6

T6 · Recurrences and asymptotic growth

Learning outcome 4

Constructing a recurrence from an algorithm, solving simple ones, and reading the growth rate off the result.

T7

T7 · Algorithmic correctness and termination

Learning outcome 4

Proving that an algorithm does what it claims and stops, using invariants.

T8

T8 · Counting

Learning outcome 5

Basic combinatoric techniques applied to counting problems.

High exam weightQuiz me on counting →
T9

T9 · Finite state machines and regular expressions

Learning outcome 6

Translating between a simple language, a machine that recognises it, and a regular expression, in both directions.

How it's assessed

Assessment structure

If you read nothing else

A component-by-component weighting breakdown is not published for this course. Rather than estimate one, we publish only what the course itself states. Check your current course outline for the exact percentages.

No component weighting is published. The university catalogue publishes course description, credits, requisites, course designation and learning outcomes, but not assessment weights, and instructor syllabi carrying them are set per section and per term. Rather than estimate a breakdown or reuse a superseded one, none is asserted here. Check the syllabus your instructor posts for this term. Not published in the catalogue. Format is set per section by the instructor.

How to actually pass it

A weekly rhythm, two checklists, and the traps to avoid

The course rewards consistency over cramming, and practice over re-reading. Here is the loop that works, then what to have nailed before each exam.

The weekly loop

Before lecture
Read the definitions; the lecture will use them immediately.
Same week
Attempt every problem before looking at any solution.
Same week
Rewrite one of your own proofs to be shorter and clearer.
Every fortnight
Redo an earlier induction cold.

Before the mid-semester checklist

  • Propositional and predicate logic, and Boolean algebra
  • Sets, relations including partial orders, and functions
  • Basic proof techniques, written out in full
  • Induction over formulas and over recursive structures

Before the final heaviest topics

  • Invariants and algorithmic correctness
  • Constructing and solving recurrences
  • Asymptotic growth analysis
  • Counting techniques
  • Finite state machines and regular expressions, translated both ways

The mistakes that cost marks

01

Constructing the wrong recurrence. The number of recursive calls and the size of each subproblem decide the answer. Getting them right is the whole task.

02

Induction without a proper base case. A proof that skips or fudges the base case proves nothing, and it is the most common lost mark in the course.

03

Treating definitions as approximations. In discrete mathematics the definition is the object. Paraphrasing it changes what you have proved.

04

Reading proofs instead of writing them. Recognising a valid argument and producing one are different skills, and only the second is examined.

Formula & concept sheet

The vocabulary and formulas you must own

Propositional logic
Reasoning about statements combined with connectives such as and, or and not.
Predicate logic
Logic with quantifiers, allowing statements about all or some members of a domain.
Partial order
A relation that is reflexive, antisymmetric and transitive; not every pair need be comparable.
Mathematical induction
Proving a property for all n by establishing a base case and an inductive step.
Loop invariant
A condition true before and after each iteration, used to prove a loop correct.
Recurrence
An equation expressing a quantity in terms of its value on smaller inputs.
Asymptotic growth
How a quantity grows as input size increases, ignoring constants.
Combinatorics
The mathematics of counting arrangements and selections.
Finite state machine
An abstract machine recognising a language, equivalent in power to a regular expression.

Common acronyms: {'term': 'QR-B', 'def': 'Quantitative Reasoning Part B designation'} · {'term': 'ADT', 'def': 'Abstract data type'} · {'term': 'L&S', 'def': 'College of Letters & Science'}.

Where it fits

Prerequisites, related courses & why it matters

Requires MATH 217 or MATH 221.

Why it matters beyond the grade. Discrete mathematics is the prerequisite for algorithms, theory of computing and cryptography, and proof fluency is what separates students who can read the literature from those who cannot.

FAQ

Frequently asked questions

What is the prerequisite?

MATH 217 or MATH 221, that is, calculus.

Is this a mathematics course or a computer science course?

Both. It is cross-listed as COMP SCI 240 and MATH 240, and it applies mathematical technique to the structures computing uses: integers, bits, strings, trees and graphs.

How much proof is involved?

A great deal. The first published outcome is demonstrating proficiency with the basic skills for constructing and evaluating mathematically rigorous arguments and proofs.

Why do computing students need it?

It is a requisite for later theory courses, and the induction, invariant and recurrence techniques are what algorithm analysis is built on.

How is it graded?

No weighting is published in the catalogue; assessment is set per section.

Is it still running?

Yes. The catalogue records it as last taught in Summer 2026.

Study CS240 with Sia

Work through propositional, sets, proof technique and the rest of the course with a tutor that knows it and quizzes you on the topics the assessments weight most heavily.

Start studying with Sia