> Source URL: /demos/discrete-demo/index.demo
---
title: Discrete Math LaTeX Demo
---

[@map]: ./discrete.map.md

<style>body { font-family: sans-serif; }</style>

# Discrete Math: LaTeX Fitness Test

**A focused demo showing that PathMX renders the kinds of mathematical expressions used in a typical Discrete Mathematics course.**

Every expression below is authored as plain markdown with inline (`$...$`) or display (`$$...$$`) LaTeX and rendered by the built-in math plugin. View source on any of these files to see the raw authoring.

Companion files:

- [Logic Problems](./logic.problems.md) -- example problem set (`*.problems.md`)
- [Induction Proof](./induction-sum.proof.md) -- worked proof (`*.proof.md`)

---

## Propositional Logic

The standard connectives render as you would expect: $p \land q$, $p \lor q$, $\neg p$, $p \Rightarrow q$, $p \Leftrightarrow q$.

De Morgan's laws:

$$
\neg (p \land q) \equiv \neg p \lor \neg q
\qquad
\neg (p \lor q) \equiv \neg p \land \neg q
$$

Contrapositive equivalence:

$$
(p \Rightarrow q) \equiv (\neg q \Rightarrow \neg p)
$$

---

## Predicate Logic & Quantifiers

Universal and existential quantifiers over common domains:

$$
\forall x \in \mathbb{N},\; \exists y \in \mathbb{Z} \;\text{ such that }\; x + y = 0
$$

Negation of quantified statements:

$$
\neg \left( \forall x \in S,\; P(x) \right) \;\equiv\; \exists x \in S,\; \neg P(x)
$$

A statement about primes:

$$
\forall n \in \mathbb{N},\; n > 1 \Rightarrow \exists p \in \mathbb{P},\; p \mid n
$$

---

## Sets

Basic set operations with typical notation:

- Union: $A \cup B = \{\, x : x \in A \lor x \in B \,\}$
- Intersection: $A \cap B = \{\, x : x \in A \land x \in B \,\}$
- Difference: $A \setminus B = \{\, x : x \in A \land x \notin B \,\}$
- Complement: $\overline{A} = U \setminus A$
- Empty set: $\emptyset$
- Cardinality: $|A|$
- Power set: $\mathcal{P}(A) = \{\, S : S \subseteq A \,\}$
- Cartesian product: $A \times B = \{\, (a, b) : a \in A,\, b \in B \,\}$

The distinguished number sets: $\mathbb{N}, \mathbb{Z}, \mathbb{Q}, \mathbb{R}, \mathbb{C}$.

Inclusion-exclusion for two sets:

$$
|A \cup B| = |A| + |B| - |A \cap B|
$$

---

## Relations & Functions

Function signatures: $f : A \to B$, $f^{-1} : B \to A$.

A relation $R$ on $A$ is an equivalence relation iff it is reflexive, symmetric, and transitive:

$$
\begin{aligned}
&\text{(reflexive)} && \forall a \in A,\; a\,R\,a \\
&\text{(symmetric)} && \forall a, b \in A,\; a\,R\,b \Rightarrow b\,R\,a \\
&\text{(transitive)} && \forall a, b, c \in A,\; (a\,R\,b \land b\,R\,c) \Rightarrow a\,R\,c
\end{aligned}
$$

Modular arithmetic notation: $a \equiv b \pmod{n}$ iff $n \mid (a - b)$.

---

## Summations, Products & Sequences

Common closed forms:

$$
\sum_{i=1}^{n} i = \frac{n(n+1)}{2}
\qquad
\sum_{i=1}^{n} i^2 = \frac{n(n+1)(2n+1)}{6}
$$

Geometric series for $r \neq 1$:

$$
\sum_{k=0}^{n-1} r^k = \frac{1 - r^n}{1 - r}
$$

Factorial and product notation:

$$
n! = \prod_{k=1}^{n} k
$$

---

## Combinatorics

Binomial coefficient and its closed form:

$$
\binom{n}{k} = \frac{n!}{k!\,(n-k)!}
$$

Pascal's identity:

$$
\binom{n}{k} = \binom{n-1}{k-1} + \binom{n-1}{k}
$$

Binomial theorem:

$$
(x + y)^n = \sum_{k=0}^{n} \binom{n}{k} x^{n-k} y^k
$$

Permutations of $k$ from $n$:

$$
P(n, k) = \frac{n!}{(n-k)!}
$$

---

## Aligned Derivations

Proof-style aligned equations, useful for showing step-by-step algebraic manipulation:

$$
\begin{aligned}
\sum_{i=1}^{k+1} i
  &= \left( \sum_{i=1}^{k} i \right) + (k+1) \\
  &= \frac{k(k+1)}{2} + (k+1) \\
  &= \frac{k(k+1) + 2(k+1)}{2} \\
  &= \frac{(k+1)(k+2)}{2}
\end{aligned}
$$

---

## Inline Math in Prose

Authors can weave math into running text naturally. For example: given a finite set $S$ with $|S| = n$, the power set $\mathcal{P}(S)$ has cardinality $|\mathcal{P}(S)| = 2^n$, and the number of $k$-element subsets of $S$ is $\binom{n}{k}$. The handshake lemma states that in any graph $G = (V, E)$, the sum of vertex degrees satisfies $\sum_{v \in V} \deg(v) = 2|E|$.

---

## What This Confirms

This page demonstrates that PathMX's markdown authoring pipeline supports, out of the box, the LaTeX patterns an instructor would reach for when authoring Discrete Math content: propositional and predicate logic, set theory, relations, combinatorics, summations, aligned multi-step derivations, and inline math in prose.

Because every file in PathMX is plain markdown, these same expressions remain readable in a text editor, on GitHub, and to any LLM-based authoring assistant -- no separate LaTeX toolchain required.


---

## Backlinks

The following sources link to this document:

- [Discrete Math LaTeX Demo](/index.path.llm.md)
