---
title: Writing proofs
heading: How the arguments of this course are built, and how they go wrong
eyebrow: A14 · Lesson 49 · Writing proofs
xp: 40
---

::: hook
Graduate courses in signals, control and communications are written as definitions, theorems and proofs, and their exams ask you to produce them. The proofs in this course followed a handful of patterns: direct arguments, contradiction, induction, and the ε–N and ε–δ games. Recognizing the pattern is half of writing one; knowing the classic mistakes is the other half. The most important lesson is the oldest: checking many cases proves nothing about the rest, and the first case your checks didn't cover can be the one that fails.
:::

::: play
- Euler's polynomial $n^2 + n + 41$ gives a prime for every n from 0 to 39: forty straight successes.
- At n = 40 it gives 1681, which is $41^2$ (readout). Any evidence short of a proof can fail at the next case.
- Move n: from 40 on, primes and composites mix. The pattern was never a theorem.
:::
:::

```sim plot
view: graph
x: n = 0..60
y: v = 0..4000
slider: m = 0..60 step 1 = 40
plot: n^2 + n + 41 | stems | label: n² + n + 41
marker: n = m | label: n
readout: value at n = m^2 + m + 41
readout: 41² = 41^2
```

::: predict
## A statement P(n) holds for n = 1, and P(n) implies P(n + 1) for every n ≥ 1. What follows?

- [ ] P holds for the cases you've checked
- [x] P holds for every n ≥ 1
- [ ] P holds for all n ≥ 2, but not necessarily n = 1
- [ ] Nothing, without more cases

::: reveal
P(n) for every n ≥ 1: that's induction. The base case starts the chain and the step carries it forward forever, which no amount of checking can do. Both parts matter: the step alone proves nothing (P could be false everywhere), and a step that fails for even one n breaks the chain.
:::
:::

::: nameit
## Patterns

| Pattern | Shape | Example in this course |
|---|---|---|
| direct | assume the hypotheses, derive the conclusion | the mean value theorem from Rolle |
| contradiction | assume the conclusion is false, reach an impossibility | √2 is irrational |
| contrapositive | prove "not B implies not A" for "A implies B" | a function without a limit at a isn't continuous there |
| induction | base case, and P(n) ⇒ P(n + 1) | $\sum_{k\le n}k = \frac{n(n + 1)}{2}$ |
| ε–N, ε–δ | let ε > 0; find N or δ; verify the inequality | every limit proof |
| existence by completeness | build a Cauchy or monotone sequence; take its limit | the contraction mapping theorem |

## Quantifiers

- "For every ε there's a δ" is not "there's a δ for every ε": the order decides whether δ may depend on ε (continuity) or must work for all ε at once (rarely true).
- Pointwise and uniform continuity differ only in where "for every x" sits.
- **Negation** swaps the quantifiers and negates the inside: the negation of "for every ε > 0 there is an N such that for all n > N, $\lvert a_n - L\rvert < \varepsilon$" is "there is an ε > 0 such that for every N, some n > N has $\lvert a_n - L\rvert \ge \varepsilon$".

## Classic mistakes

- Assuming what you're proving (working backward and calling it a proof).
- An induction step that fails for one small n (the "all horses are the same color" argument breaks going from 1 to 2).
- Dividing by something that might be zero.
- Using a theorem whose hypotheses don't hold (the mean value theorem on a function with a corner; dominated convergence without a dominating function).
- Proving the converse instead of the statement.
:::

::: example
## Prove $\sum_{k=1}^nk^2 = \frac{n(n + 1)(2n + 1)}{6}$ by induction.

::: solution
1. **Base case.** n = 1 gives
   $$1 = \frac{1 \cdot 2 \cdot 3}{6}$$
2. **Inductive step.** Assuming it for n,
   $$\begin{aligned} \sum_{k=1}^{n+1}k^2 &= \frac{n(n + 1)(2n + 1)}{6} \\ &\quad + (n + 1)^2 \\ &= \frac{(n + 1)(2n^2 + 7n + 6)}{6} \\ &= \frac{(n + 1)(n + 2)(2n + 3)}{6} \end{aligned}$$
   the formula for n + 1.

**Answer:** the formula holds for n = 1 and carries from n to n + 1, so it holds for every n ≥ 1.
:::
:::

::: example
## Prove Bernoulli's inequality, $(1 + x)^n \ge 1 + nx$ for x ≥ −1 and whole n ≥ 1.

::: solution
1. **Base case.** n = 1 gives equality.
2. **Inductive step.** If it holds for n, then since $1 + x \ge 0$,
   $$\begin{aligned} (1 + x)^{n+1} &\ge (1 + nx)(1 + x) \\ &= 1 + (n + 1)x + nx^2 \\ &\ge 1 + (n + 1)x \end{aligned}$$
3. **Where x ≥ −1 is used.** The hypothesis x ≥ −1 is used exactly once: to multiply an inequality by $1 + x$ without flipping it.

**Answer:** by induction, $(1 + x)^n \ge 1 + nx$ for every whole n ≥ 1 when x ≥ −1.
:::
:::

::: example
## Prove that $\sqrt2$ is irrational.

::: solution
1. **Suppose not.** Then $\sqrt2 = \frac pq$ with p, q whole numbers sharing no common factor.
2. **p is even.** Then $p^2 = 2q^2$, so $p^2$ is even, so p is even (an odd number squared is odd): p = 2m.
3. **q is even.** Then $4m^2 = 2q^2$, so $q^2 = 2m^2$ and q is even too.
4. **Contradiction.** So p and q share the factor 2, contradicting their choice. Hence no such fraction exists.
5. **The structure.** This is the standard proof by contradiction: assume the negation, derive something that contradicts an assumption, and conclude. The completeness of the reals is what then guarantees $\sqrt2$ exists at all.

**Answer:** assuming $\sqrt2 = \frac pq$ in lowest terms forces both p and q to be even, a contradiction, so $\sqrt2$ is irrational.
:::
:::

::: check
given: n = 5 | 10 | 24
answer: n*(n + 1)*(2*n + 1)/6
tolerance: 0

## What's $\sum_{k=1}^{\given{n}}k^2$?

::: right
Right. $\frac{n(n + 1)(2n + 1)}{6}$ = {answer}.
:::

::: misses
- [n*(n + 1)/2] That's $\sum k$.
- [any] Not yet. Use the formula proved by induction.
:::
:::

::: check
given: x = 0.1 | -0.5 | 2; n = 3 | 6
answer: (1 + x)^n - (1 + n*x)
tolerance: 0.1%

## How much does $(1 + x)^n$ exceed $1 + nx$ for x = {x}, n = {n}?

::: right
Right. {answer}, never negative for x ≥ −1, as Bernoulli's inequality says.
:::

::: misses
- [any] Not yet. Compute both and subtract.
:::
:::

::: check
answer: 40
tolerance: 0

## What's the first n ≥ 0 for which $n^2 + n + 41$ isn't prime?

::: right
Right. n = 40, where the value is $40 \cdot 41 + 41 = 41^2$.
:::

::: misses
- [41] That gives $41 \cdot 43$, also composite, but it isn't the first.
- [any] Not yet. Try to factor $n^2 + n + 41$ when n is a multiple of 41 or one less.
:::
:::

::: check
kind: choice

## What's the negation of "f is continuous at a": for every ε > 0 there's a δ > 0 such that $\lvert x - a\rvert < \delta$ implies $\lvert f(x) - f(a)\rvert < \varepsilon$?

- [ ] For every ε > 0 and every δ > 0, $\lvert f(x) - f(a)\rvert \ge \varepsilon$
- [x] There's an ε > 0 such that for every δ > 0 some x with $\lvert x - a\rvert < \delta$ has $\lvert f(x) - f(a)\rvert \ge \varepsilon$
- [ ] There's a δ > 0 with $\lvert f(x) - f(a)\rvert \ge \varepsilon$ for all x
- [ ] For every ε there's a δ with $\lvert f(x) - f(a)\rvert \ge \varepsilon$

::: misses
- [1] The quantifiers must swap: "every ε" becomes "some ε".
- [3] Too strong, and ε is left unquantified.
- [4] Negation turns "for every ε" into "there is an ε".
:::
:::

::: check
kind: choice

## "All horses are the same color": any one horse is one color; for n + 1 horses, the first n are one color and the last n are one color, and they overlap, so all n + 1 are. Where does it fail?

- [ ] The base case
- [x] The step from 1 to 2: the first horse and the last horse don't overlap
- [ ] The step from 2 to 3
- [ ] Induction doesn't apply to horses

::: misses
- [1] One horse really is one color.
- [3] From 2 on the overlap exists; the chain is already broken at 1 → 2.
- [4] It applies to any statement indexed by n.
:::
:::

::: check
kind: order

## Put the induction proof that $\sum_{k=1}^nk = \frac{n(n + 1)}{2}$ in order.

1. Base case: for n = 1 both sides equal 1.
2. Suppose the formula holds for some n ≥ 1.
3. Then $\sum_{k=1}^{n+1}k = \frac{n(n + 1)}{2} + (n + 1)$.
4. That equals $\frac{(n + 1)(n + 2)}{2}$, the formula for n + 1.
5. By induction, the formula holds for every n ≥ 1.

::: right
Right. Base case, hypothesis, one step of algebra, conclusion.
:::
:::

::: check
kind: parts
given: n = 10 | 20 | 100

## Sums for n = {n}.

::: part
answer: (n*(n + 1)/2)^2
tolerance: 0

### What is $\sum_{k=1}^nk^3$?

::: misses
- [n*(n + 1)/2] That's $\sum k$; the cubes sum to its square.
- [any] $\left(\frac{n(n + 1)}{2}\right)^2$.
:::
:::

::: part
answer: n*(n + 1)*(n + 2)/3
tolerance: 0

### What is $\sum_{k=1}^nk(k + 1)$?

::: misses
- [any] $\frac{n(n + 1)(n + 2)}{3}$, provable by induction.
:::
:::
:::

::: check
kind: derivation
vars: n = 1..100

## Closed forms to prove by induction.

::: step
answer: n^2

### What is $\sum_{k=1}^n(2k - 1)$?
:::

::: step
answer: n*(n + 1)*(2*n + 1)/6

### What is $\sum_{k=1}^nk^2$?
:::

::: right
Right. Each step of an induction proof checks that adding the next term keeps the formula true.
:::
:::

::: explain
## Why doesn't checking a statement for many values of n prove it, while induction does?

::: model
Checking covers only the cases you computed, and the statement is about infinitely many; the next case can always be the first failure, as $n^2 + n + 41$ shows by producing primes for forty cases and then $41^2$. Induction proves something different: that truth at any n forces truth at n + 1, for every n, by an argument that never depends on which n it is. Together with a true base case, that single argument covers every case in a chain, so there's no unchecked case left for a counterexample to hide in.
:::
:::

::: practice

::: check
given: n = 5..50 int
answer: n*(n + 1)*(2*n + 1)/6
tolerance: 0

## $\sum_{k=1}^{\given{n}}k^2$?

::: misses
- [any] $\frac{n(n + 1)(2n + 1)}{6}$.
:::
:::

::: check
given: n = 10..200 int
answer: n*(n + 1)/2
tolerance: 0

## $\sum_{k=1}^{\given{n}}k$?

::: misses
- [any] $\frac{n(n + 1)}{2}$.
:::
:::

::: check
given: x = 0.3 | -0.8; n = 4 | 10
answer: (1 + x)^n - (1 + n*x)
tolerance: 0.1%

## $(1 + x)^n - (1 + nx)$ for x = {x}, n = {n}?

::: misses
- [any] Compute both.
:::
:::
:::
