DISCRETE MATH • PROBLEM-SOLVING & DISCRETE MODELING

Translate Word Problems into Discrete Structures (Graphs, Sets)

Learn to extract the hidden mathematical skeleton from real-world scenarios using graphs, sets, and relations.

Historical Context & Motivation

The art of translating real-world problems into abstract mathematical structures has roots stretching back centuries, long before discrete mathematics emerged as a formal discipline. At its core, this process — sometimes called mathematical modeling — asks us to identify the essential objects, relationships, and constraints lurking within a verbal description and encode them in a framework amenable to rigorous analysis. The motivation is both practical and intellectual: once a problem is expressed as a graph, a set, or a relation, we gain access to a vast library of theorems and algorithms that would be inaccessible if we remained in the realm of natural language.

1736
Euler and the Königsberg Bridges
Leonhard Euler translated a real-world puzzle — whether one could traverse all seven bridges of Königsberg exactly once — into a graph with four vertices and seven edges, founding graph theory in the process.
1847
Boole's Algebra of Logic
George Boole formalized logical propositions using set-theoretic operations, demonstrating that verbal logical arguments could be rewritten as equations over sets.
1936
Turing Machines and Decision Problems
Alan Turing showed that computational questions — often stated in words — could be modeled as abstract machines, linking discrete modeling to the foundations of computer science.
1960s
Graph Algorithms in Operations Research
Dijkstra, Ford-Fulkerson, and others developed algorithms for shortest paths and network flows, each requiring the translation of logistics and routing problems into weighted graphs.
2000s–present
Social Networks and Big Data
Modern applications — social network analysis, recommendation systems, epidemiological modeling — routinely begin by translating messy real-world data into graph and set structures at massive scale.

The recurring theme across these milestones is a single powerful idea: natural language is ambiguous and unwieldy, but discrete structures are precise and computable. The central question this lesson addresses is: given a word problem, how do we systematically decide which discrete structure to use, and how do we perform the translation faithfully and completely?

Core Principles & Definitions

Before diving into translation techniques, we need to establish the foundational discrete structures that serve as our target representations. Each structure captures a different kind of information: membership, pairing, connectivity, or ordering. The translator's first task is to read the word problem and ask, "What type of information is central to this problem?" The answer determines which structure is most natural.

1

Sets & Membership

A set is an unordered collection of distinct elements. Use sets when the problem focuses on group membership, classification, or counting via inclusion-exclusion.
2

Relations & Ordered Pairs

A relation R on sets A and B is a subset of A × B. Relations capture pairwise connections like "is a prerequisite for" or "divides evenly." Properties such as reflexivity, symmetry, and transitivity guide classification.
3

Graphs (Undirected & Directed)

A graph G = (V, E) models objects (vertices) and their pairwise connections (edges). Directed graphs (digraphs) encode one-way relationships. Use graphs for connectivity, routing, scheduling, and network problems.
4

Functions & Mappings

A function f: A → B is a special relation where every element of A maps to exactly one element of B. Use functions when a problem involves assignment, encoding, or deterministic transformation.
5

Sequences & Recurrences

Ordered lists and recurrence relations model processes that evolve step-by-step, such as population dynamics, recursive algorithms, or staged decision-making. The key signal is temporal or iterative dependence.
KEY TAKEAWAY
Think of translating a word problem like a cartographer surveying terrain before drawing a map. The terrain (the word problem) contains mountains, rivers, and roads. The cartographer must decide: do I need a topographic map (a graph with weighted edges), a political boundary map (sets with membership), or a road atlas (a directed graph with paths)? Choosing the right map type is half the battle — the other half is faithfully recording every feature.

Visual Explanation: The Translation Pipeline

The process of translating a word problem into a discrete structure follows a systematic pipeline. We begin with the raw text, extract entities and relationships, classify the problem type, choose the appropriate structure, and finally construct the formal model. The diagram below illustrates this pipeline with an example problem woven through each stage.

The five-step translation pipeline. The top row shows the abstract process; the bottom panel traces a concrete example — a friendship/class-sharing problem — through each stage, culminating in a graph 2-coloring formulation.

Notice how the pipeline in the diagram above transforms vague prose into precise mathematics. In Step 1, we perform a grammatical parse: nouns suggest candidate elements or vertices, verbs suggest relationships or operations, and adjectives or adverbs often encode constraints. Step 2 converts those linguistic cues into formal objects. Step 3 is the critical classification stage — asking whether relationships are symmetric, transitive, or carry numerical weight determines whether we reach for an undirected graph, a partial order, or a weighted digraph. The final two steps construct and validate the model against the original problem statement.

Mathematical Framework

The translation process rests on a few core formalisms. Understanding these definitions precisely ensures that the discrete structure we build is faithful to the original word problem. We present the key definitions and notational conventions below, then connect them to the kinds of verbal cues that trigger each formalism.

SET DEFINITION
A = { x ∈ U : P(x) }
A is the set of all elements x drawn from a universe U that satisfy predicate P(x). Verbal cues: "all students who…", "the collection of…", "those items satisfying…"
GRAPH DEFINITION
G = (V, E) where E ⊆ { {u, v} : u, v ∈ V, u ≠ v }
V is the vertex set (entities), and E is the edge set (pairwise relationships). For a directed graph (digraph), E ⊆ V × V uses ordered pairs instead. Verbal cues: "connected to", "can reach", "is friends with."
RELATION ON A SET
R ⊆ A × A with (a, b) ∈ R ⟺ a R b
A relation R on set A captures how elements of A relate to one another. Check reflexivity (∀a: aRa?), symmetry (aRb ⟹ bRa?), and transitivity (aRb ∧ bRc ⟹ aRc?) to classify the relation as equivalence, partial order, etc.
INCLUSION-EXCLUSION PRINCIPLE
|A ∪ B| = |A| + |B| − |A ∩ B|
When a word problem asks "how many elements belong to at least one of several groups," inclusion-exclusion over sets is the natural framework. Generalizes to n sets with alternating sums of intersection sizes.

A key heuristic for choosing among these frameworks is to examine the arity of the relationships in the problem. If the problem centers on whether individual elements belong to categories, sets and membership are the natural model. If the problem involves pairwise connections between elements — friendships, roads, dependencies — then a graph is called for. If the problem imposes an ordering or hierarchy, a partially ordered set or directed acyclic graph (DAG) may be best. Finally, if the problem requires assigning exactly one output to each input (scheduling rooms to time slots, assigning tasks to workers), a function or bipartite matching is appropriate.

Choosing the Right Structure: A Decision Guide

One of the most challenging aspects of discrete modeling is selecting the correct structure from the toolbox. Below we present a decision guide organized by the type of question the word problem asks, followed by a detailed classification diagram. When you read a problem, ask yourself the sequence of questions shown in the diagram; each answer narrows the field of candidate structures until you arrive at the most natural representation.

A decision tree for selecting the appropriate discrete structure. Start at the top: determine whether the problem centers on membership/counting, pairwise connections, or assignment/mapping. Follow the branches to refine your choice based on symmetry, directedness, weights, and acyclicity.
Common verbal cues and the discrete structures they suggest
Verbal CueTarget StructureExample Question Pattern
"How many belong to at least one…"Sets + Inclusion-ExclusionSurvey: 40 take math, 30 take CS, 10 take both. How many total?
"Is it possible to travel from X to Y?"Graph (connectivity / reachability)Cities with one-way flights. Can we get from A to D?
"Assign each X to exactly one Y…"Function / Bipartite matchingAssign 5 tasks to 5 workers, one task per worker.
"In what order should we complete…"DAG + Topological sortCourse prerequisites: what is a valid semester schedule?
"Partition into groups with no conflicts…"Graph coloringSchedule exams so no student has two at the same time.
"Which elements are equivalent under…"Equivalence relation / PartitionIntegers grouped by remainder mod 3.

Worked Example: Course Prerequisites as a DAG

Consider the following word problem: "A computer science program offers five courses: Intro to CS (A), Data Structures (B), Algorithms (C), Databases (D), and Machine Learning (E). Data Structures requires Intro to CS. Algorithms requires Data Structures. Databases requires Data Structures. Machine Learning requires both Algorithms and Databases. A student takes one course per semester. What is the minimum number of semesters to complete all five courses?" We will translate this into a directed acyclic graph and use topological analysis to answer the question.

Translating Course Prerequisites into a DAG
1
Step 1 — Identify Entities (Vertices)The five courses are the objects of interest. We define the vertex set V = {A, B, C, D, E}, where A = Intro to CS, B = Data Structures, C = Algorithms, D = Databases, E = Machine Learning.
V = {A, B, C, D, E}
2
Step 2 — Identify Relationships (Edges)The phrase "requires" is directional: course X requires course Y means Y must come before X. This gives us directed edges from prerequisite to dependent course. We extract: A → B (Intro is prerequisite for Data Structures), B → C (Data Structures for Algorithms), B → D (Data Structures for Databases), C → E (Algorithms for ML), D → E (Databases for ML).
E = {(A,B), (B,C), (B,D), (C,E), (D,E)}
3
Step 3 — Verify Structure PropertiesPrerequisites should never be circular (you cannot have course X requiring Y while Y requires X). We check for cycles: following edges from any vertex, we never return to a visited vertex. The graph is indeed a DAG. This confirms that a valid course ordering exists.
G = (V, E) is a DAG ✓
4
Step 4 — Perform Topological AnalysisThe minimum number of semesters equals the length of the longest path in the DAG (since courses on the longest dependency chain cannot be parallelized). We trace all paths: A → B → C → E has length 4 (four courses, four semesters), and A → B → D → E also has length 4. Since C and D both depend only on B, they can be taken in the same semester (semester 3). The critical path has 4 levels.
Longest path = 4 edges, so minimum semesters = 4
5
Step 5 — Construct the ScheduleSemester 1: A (no prerequisites). Semester 2: B (requires only A, completed). Semester 3: C and D simultaneously (both require only B). Semester 4: E (requires C and D, both completed). This schedule achieves the minimum of 4 semesters.
Optimal schedule: {A} → {B} → {C, D} → {E}, 4 semesters

Strengths & Limitations of Each Structure

Each discrete structure excels in certain modeling scenarios and struggles in others. A common pitfall for students is forcing a problem into a familiar structure when a different one would yield a cleaner, more tractable model. The table below summarizes the comparative strengths and limitations of the primary structures discussed in this lesson, along with the types of questions each handles most naturally.

Comparative analysis of discrete structures for modeling
StructureStrengthsLimitations
SetsClean counting via inclusion-exclusion; natural for membership, classification, and Venn diagram reasoning. Well-suited for survey-type problems.Cannot capture pairwise relationships between elements or ordering. No notion of adjacency or distance.
Undirected GraphsExcellent for modeling mutual relationships: friendships, shared attributes, physical connections. Rich algorithmic toolkit (BFS, DFS, coloring, matching).Cannot model asymmetric relationships (one-way roads, prerequisites). No inherent notion of order among vertices.
Directed GraphsCapture one-way dependencies, flows, and hierarchies. DAGs enable topological sorting for scheduling. Support weighted edges for optimization.More complex to analyze than undirected graphs. Reachability is not symmetric, complicating connectivity checks.
RelationsGeneralize both graphs and functions. Classification via properties (reflexive, symmetric, transitive) reveals deep structure: equivalence classes, partial orders.Abstract; often converted to a graph or matrix for computation. May lack efficient algorithms if not further classified.
FunctionsIdeal for assignment and mapping problems. Injection/surjection/bijection classification directly answers counting and existence questions.Limited to deterministic, single-output mappings. Cannot model multi-valued or nondeterministic relationships.
KEY TAKEAWAY
Choosing a discrete structure is like choosing the right tool from an engineering workshop. A wrench (graph) is perfect for tightening bolts (connectivity problems), but you would not use it to measure length — you need a ruler (set with cardinality) for that. Similarly, a screwdriver (function) excels at driving screws (one-to-one assignments) but cannot handle a nail (a many-to-many relation). Mismatching tool to task does not make the problem unsolvable, but it makes the solution unnecessarily convoluted.

Connections to Advanced Theory

The translation skills developed in this lesson form the foundation for more sophisticated modeling techniques encountered in upper-division and graduate courses. In combinatorial optimization, word problems about resource allocation become integer linear programs over graph structures. In formal language theory, pattern-matching problems are translated into finite automata — a specialized kind of directed graph. In algebraic graph theory, the adjacency matrix representation of a graph connects discrete structures to linear algebra, enabling spectral analysis of networks.

How translation skills scale to advanced topics
This Lesson's ConceptAdvanced ExtensionWhere You'll Encounter It
Graph modeling of connectivityNetwork flow & max-flow min-cut theoremOperations research, algorithm design courses
Set-based counting (inclusion-exclusion)Möbius inversion on posetsEnumerative combinatorics
DAG for prerequisite orderingLattice theory & partial order completionsAbstract algebra, formal concept analysis
Function as assignment modelHungarian algorithm for optimal assignmentCombinatorial optimization, ML (bipartite matching)
Equivalence relations and partitionsQuotient structures (groups, topological spaces)Abstract algebra, topology

The common thread is that the ability to identify the right discrete structure in a word problem is not merely an introductory skill to be outgrown — it is the same skill that researchers and engineers use daily when formulating new problems. The structures become more elaborate (hypergraphs, matroids, simplicial complexes), but the translation methodology remains fundamentally unchanged: extract entities, characterize relationships, choose the structure, and build the formal model.

Practice Problems

PROBLEM 1CONCEPTUAL
A word problem states: "In a club of 20 members, some pairs of members are friends." You are asked whether every member can be reached through a chain of friendships starting from any other member. What discrete structure should you use to model this problem, and what specific graph property answers the question? Justify your choice.
PROBLEM 2BASIC CALCULATION
In a class of 50 students, 28 study Spanish, 22 study French, and 8 study both languages. Translate this into a set-theoretic model and compute how many students study at least one of the two languages, and how many study neither.
PROBLEM 3INTERMEDIATE
A software project has six modules: P, Q, R, S, T, U. The dependencies are: Q requires P; R requires P; S requires Q and R; T requires R; U requires S and T. Model this as a directed graph. Find all valid topological orderings of modules that respect the dependencies, and determine the minimum number of development phases if modules without mutual dependencies can be developed in parallel.
PROBLEM 4APPLIED
A university must schedule final exams for seven courses. Some courses share students and therefore cannot have exams at the same time. The conflict pairs are: (Math, Physics), (Math, CS), (Physics, Chemistry), (CS, Statistics), (Statistics, Economics), (Chemistry, Biology), (Biology, Economics). Model this as a graph and determine the minimum number of exam time slots needed (the chromatic number). Provide a valid schedule.
PROBLEM 5CRITICAL THINKING
A social media platform wants to identify communities of users. They define a "community" as a maximal group of users where every pair in the group has interacted at least once. They also want to know whether it is possible to divide all users into exactly two groups such that every interaction crosses the group boundary (i.e., no two users in the same group have ever interacted). Formulate both questions as graph-theoretic problems. Prove that if the second question has an affirmative answer, then the largest community found by the first question can have at most 2 members.

Lesson Summary

Translating word problems into discrete structures is a systematic, learnable skill that lies at the heart of discrete mathematical modeling. The process follows a five-step pipeline: read and parse the problem for nouns, verbs, and constraints; extract entities as potential vertices or set elements; classify the relationships by checking symmetry, transitivity, and directionality; choose the right structure — sets for membership and counting, undirected graphs for mutual pairwise connections, directed graphs and DAGs for one-way dependencies, relations for abstract pairings, or functions for deterministic assignments; and finally build and verify the model against the original problem.

Key formulas include the inclusion-exclusion principle for set-based counting (|A ∪ B| = |A| + |B| − |A ∩ B|), the graph definition G = (V, E) for connectivity and path problems, topological sorting of DAGs for scheduling with prerequisites, and graph coloring for conflict-avoidance and partitioning problems. Mastering this translation step is the gateway to every algorithmic and optimization technique in discrete mathematics — the formal structure is what makes the problem computable.

Varsity Tutors • Discrete Math • Translate Word Problems into Discrete Structures (Graphs, Sets)