Proof and Real Analysis — Practice Problems (Solutions)

Worked solutions for the Proof and Real Analysis practice problems
Author

William Duan

These practice questions accompany the Proof and Real Analysis lecture. Each asks you to prove a result stated in the lecture. A few of the harder proofs are marked (Challenging) — attempt the others first.

Question 1

Prove De Morgan’s laws for sets: for \(A, B \subseteq X\), \[(A \cup B)^c = A^c \cap B^c \qquad\text{and}\qquad (A \cap B)^c = A^c \cup B^c.\]

TipSOLUTIONS

We prove each equality by a chain of “if and only if” statements on membership.

First law. For any \(x \in X\), \[ x \in (A\cup B)^c \iff x \notin A \cup B \iff \big(x\notin A \text{ and } x \notin B\big) \iff x \in A^c \cap B^c. \] The middle step is the negation of “\(x\in A\) or \(x\in B\)”, which is “\(x\notin A\) and \(x\notin B\)”. Since \(x\) was arbitrary, \((A\cup B)^c = A^c \cap B^c\).

Second law. Similarly, \[ x \in (A\cap B)^c \iff \neg\big(x\in A \text{ and } x\in B\big) \iff \big(x\notin A \text{ or } x\notin B\big) \iff x \in A^c \cup B^c. \] Hence \((A\cap B)^c = A^c \cup B^c\). (Alternatively, this follows from the first law applied to \(A^c, B^c\) together with \((E^c)^c = E\).)

Question 2

Prove the following stability properties of open and closed sets in \({\mathbb{R}}^n\).

  1. The union of an arbitrary family of open sets is open.
  2. The intersection of finitely many open sets is open.
  3. Using De Morgan’s laws, deduce that an arbitrary intersection of closed sets is closed, and a finite union of closed sets is closed.
TipSOLUTIONS
  1. Let \(\{U_i\}_{i\in I}\) be open and \(U = \bigcup_{i\in I} U_i\). Take \(x \in U\); then \(x \in U_{i_0}\) for some \(i_0 \in I\). Since \(U_{i_0}\) is open, there is \(\varepsilon>0\) with \(B(x,\varepsilon)\subseteq U_{i_0} \subseteq U\). As \(x\in U\) was arbitrary, \(U\) is open. (No finiteness is needed here.)

  2. Let \(U_1,\dots,U_n\) be open and \(U=\bigcap_{k=1}^n U_k\). Take \(x\in U\), so \(x\in U_k\) for every \(k\). For each \(k\) choose \(\varepsilon_k>0\) with \(B(x,\varepsilon_k)\subseteq U_k\), and set \(\varepsilon=\min\{\varepsilon_1,\dots,\varepsilon_n\}\). The minimum of finitely many positive numbers is positive, so \(\varepsilon>0\), and \(B(x,\varepsilon)\subseteq B(x,\varepsilon_k)\subseteq U_k\) for every \(k\); hence \(B(x,\varepsilon)\subseteq U\). So \(U\) is open. (Finiteness is essential: it is what guarantees \(\varepsilon>0\).)

  3. Let \(\{F_i\}_{i\in I}\) be closed, so each \(F_i^c\) is open. By De Morgan, \(\big(\bigcap_{i} F_i\big)^c = \bigcup_{i} F_i^c\), an arbitrary union of open sets, which is open by (a); hence \(\bigcap_i F_i\) is closed. Likewise, for finitely many closed sets \(F_1,\dots,F_n\), \(\big(\bigcup_{k=1}^n F_k\big)^c = \bigcap_{k=1}^n F_k^c\) is a finite intersection of open sets, open by (b); hence \(\bigcup_{k=1}^n F_k\) is closed.

Question 3

Let \(A\subseteq{\mathbb{R}}\) be non-empty and let \(s\in{\mathbb{R}}\) be an upper bound of \(A\). Prove that \(s = \sup A\) if and only if \[\forall\, \varepsilon>0,\ \exists\, a\in A \text{ such that } a > s-\varepsilon.\]

TipSOLUTIONS

Recall that \(\sup A\) is the least upper bound of \(A\): an upper bound that is \(\le\) every other upper bound. Throughout, only this definition is used — no completeness axiom.

(\(\Rightarrow\)) Suppose \(s=\sup A\) and let \(\varepsilon>0\). Since \(s-\varepsilon < s\) and \(s\) is the least upper bound, \(s-\varepsilon\) cannot be an upper bound of \(A\). So some \(a\in A\) satisfies \(a > s-\varepsilon\).

(\(\Leftarrow\)) Suppose \(s\) is an upper bound and for every \(\varepsilon>0\) there is \(a\in A\) with \(a>s-\varepsilon\). Let \(t\) be any upper bound of \(A\); we show \(t\ge s\). If instead \(t<s\), put \(\varepsilon = s-t>0\). By hypothesis there is \(a\in A\) with \(a> s-\varepsilon = t\), contradicting that \(t\) is an upper bound. Hence every upper bound \(t\) satisfies \(t\ge s\), so \(s\) is the least upper bound: \(s=\sup A\).

Question 4

Using the definition compact \(=\) closed and bounded (in \({\mathbb{R}}^n\)), justify each claim.

  1. \([0,1]^n\) is compact.
  2. \((0,1)\) is not compact.
  3. \({\mathbb{R}}\) is not compact.
  4. The budget set \(\{x\in{\mathbb{R}}^n : x\ge 0,\ p\cdot x \le w\}\) is compact, where \(p\gg 0\) (all prices strictly positive) and \(w>0\).
TipSOLUTIONS
  1. Bounded: for \(x\in[0,1]^n\) each coordinate lies in \([0,1]\), so \(\|x\|\le \sqrt{n}\). Closed: if \((x_k)\subseteq[0,1]^n\) and \(x_k\to x\), each coordinate satisfies \(0\le x_{k,i}\le 1\), so the order limit theorem gives \(0\le x_i\le 1\); thus \(x\in[0,1]^n\). By the sequential characterisation, \([0,1]^n\) is closed. Closed and bounded, hence compact.

  2. \((0,1)\) is bounded but not closed: \(x_k = 1/k \in (0,1)\) and \(x_k\to 0\notin(0,1)\), so it does not contain the limit point \(0\). Not closed \(\Rightarrow\) not compact.

  3. \({\mathbb{R}}\) is closed but not bounded: for any \(M>0\), the point \(M+1\) satisfies \(|M+1|>M\), so no single \(M\) bounds every element. Not bounded \(\Rightarrow\) not compact.

  4. Write \(K=\{x : x\ge 0,\ p\cdot x\le w\}\). Bounded: let \(\underline p=\min_i p_i>0\). For \(x\in K\) each \(x_i\ge 0\), so \(\underline p\sum_i x_i \le \sum_i p_i x_i = p\cdot x\le w\), giving \(0\le x_i \le w/\underline p\) for every \(i\); hence \(\|x\|\le \sqrt n\, w/\underline p\). Closed: each set \(\{x : x_i\ge 0\}\) and \(\{x : p\cdot x\le w\}\) is closed (if \(x_k\to x\) with \(x_{k,i}\ge 0\) then \(x_i\ge0\), and if \(p\cdot x_k\le w\) then \(p\cdot x\le w\), both by the order limit theorem). \(K\) is a finite intersection of these closed sets, hence closed by Question 2(c). Closed and bounded, hence compact.

Question 5

Prove that if a sequence \((x_k)\) in \({\mathbb{R}}^n\) converges, then its limit is unique.

TipSOLUTIONS

Suppose \(x_k\to L\) and \(x_k\to L'\); we show \(L=L'\). Let \(\varepsilon>0\). By convergence there are \(K_1,K_2\) with \(\|x_k-L\|<\varepsilon/2\) for \(k\ge K_1\) and \(\|x_k-L'\|<\varepsilon/2\) for \(k\ge K_2\). For any \(k\ge\max\{K_1,K_2\}\), the triangle inequality gives \[ \|L-L'\| \le \|L-x_k\| + \|x_k-L'\| < \tfrac{\varepsilon}{2}+\tfrac{\varepsilon}{2} = \varepsilon. \] Thus \(\|L-L'\|<\varepsilon\) for every \(\varepsilon>0\), which forces \(\|L-L'\|=0\), i.e. \(L=L'\).

Question 6

Let \(x_k\to x\) and \(y_k\to y\) in \({\mathbb{R}}\). Prove:

  1. (Algebraic Limit Theorem) \(x_k+y_k\to x+y\); \(\ c\,x_k\to cx\); \(\ x_k y_k\to xy\); and, if \(y\ne0\) and \(y_k\ne0\), \(\ x_k/y_k\to x/y\).
  2. (Order Limit Theorem) if \(x_k\le y_k\) for all \(k\), then \(x\le y\).
  3. (Squeeze Theorem) if \(x_k\le z_k\le y_k\) for all \(k\) and \(x_k,y_k\to L\), then \(z_k\to L\).

The quotient limit in (a) is the most delicate part.

TipSOLUTIONS
  1. Sum. Given \(\varepsilon>0\), choose \(K\) with \(|x_k-x|<\varepsilon/2\) and \(|y_k-y|<\varepsilon/2\) for \(k\ge K\). Then \(|(x_k+y_k)-(x+y)|\le|x_k-x|+|y_k-y|<\varepsilon\).

    Scalar. If \(c=0\) this is trivial. For \(c\ne0\), given \(\varepsilon>0\) choose \(K\) with \(|x_k-x|<\varepsilon/|c|\); then \(|cx_k-cx|=|c|\,|x_k-x|<\varepsilon\).

    Product. A convergent sequence is bounded, so there is \(M>0\) with \(|x_k|\le M\) for all \(k\). Then \[ |x_ky_k-xy| = |x_k y_k - x_k y + x_k y - xy| \le |x_k|\,|y_k-y| + |y|\,|x_k-x| \le M|y_k-y| + |y|\,|x_k-x|. \] Given \(\varepsilon>0\), choose \(K\) so that \(|y_k-y|<\dfrac{\varepsilon}{2M}\) and \(|x_k-x|<\dfrac{\varepsilon}{2(|y|+1)}\) for \(k\ge K\); then \(|x_ky_k-xy|<\varepsilon\).

    Quotient. It suffices to show \(1/y_k\to 1/y\) and then apply the product rule. Since \(y\ne0\), taking \(\varepsilon_0=|y|/2\) gives \(K_0\) with \(|y_k-y|<|y|/2\) for \(k\ge K_0\), so \(|y_k|\ge|y|-|y_k-y|>|y|/2\) for such \(k\). Then for \(k\ge K_0\), \[ \left|\frac1{y_k}-\frac1y\right| = \frac{|y-y_k|}{|y_k|\,|y|} \le \frac{|y-y_k|}{(|y|/2)|y|} = \frac{2}{|y|^2}\,|y_k-y|. \] Given \(\varepsilon>0\), also require \(|y_k-y|<\tfrac{|y|^2}{2}\varepsilon\); then \(|1/y_k-1/y|<\varepsilon\). Hence \(1/y_k\to1/y\), and \(x_k/y_k = x_k\cdot(1/y_k)\to x\cdot(1/y)=x/y\) by the product rule.

  2. Suppose for contradiction \(x>y\), and set \(\varepsilon=(x-y)/2>0\). For large \(k\), \(|x_k-x|<\varepsilon\) and \(|y_k-y|<\varepsilon\), so \(x_k> x-\varepsilon = \tfrac{x+y}{2}\) and \(y_k< y+\varepsilon=\tfrac{x+y}{2}\), giving \(y_k< x_k\) — contradicting \(x_k\le y_k\). Hence \(x\le y\).

  3. Given \(\varepsilon>0\), choose \(K\) with \(|x_k-L|<\varepsilon\) and \(|y_k-L|<\varepsilon\) for \(k\ge K\), i.e. \(L-\varepsilon<x_k\) and \(y_k<L+\varepsilon\). Then \(L-\varepsilon<x_k\le z_k\le y_k<L+\varepsilon\), so \(|z_k-L|<\varepsilon\). Hence \(z_k\to L\).

Question 7

  1. Prove the Monotone Convergence Theorem: every bounded, monotone sequence in \({\mathbb{R}}\) converges. (Prove the non-decreasing case; the non-increasing case is symmetric.)
  2. Show directly from the \(\varepsilon\)-\(K\) definition — without invoking the MCT — that \(x_k = 1-\tfrac1k\) converges to \(1\).
TipSOLUTIONS
  1. Let \((x_k)\) be non-decreasing and bounded above. The set \(A=\{x_k : k\in{\mathbb{N}}\}\) is non-empty and bounded above, so by the completeness axiom \(s=\sup A\) exists. We claim \(x_k\to s\). Let \(\varepsilon>0\). By the \(\varepsilon\)-characterisation of the supremum (Question 3), there is an index \(K\) with \(x_K > s-\varepsilon\). Since \((x_k)\) is non-decreasing, \(x_k\ge x_K> s-\varepsilon\) for all \(k\ge K\); and \(x_k\le s\) because \(s\) is an upper bound. Hence \(s-\varepsilon< x_k\le s< s+\varepsilon\), i.e. \(|x_k-s|<\varepsilon\) for \(k\ge K\). Therefore \(x_k\to s=\sup_k x_k\). (For a non-increasing sequence bounded below, apply this to \((-x_k)\), giving convergence to \(\inf_k x_k\).)

  2. Let \(\varepsilon>0\). We want \(|x_k-1| = \big|(1-\tfrac1k)-1\big| = \tfrac1k<\varepsilon\). By the Archimedean property, choose \(K\in{\mathbb{N}}\) with \(K>1/\varepsilon\). Then for all \(k\ge K\), \(\tfrac1k\le\tfrac1K<\varepsilon\), so \(|x_k-1|<\varepsilon\). Hence \(x_k\to1\).

Question 8

  1. Prove the sequential characterisation of closed sets: \(F\subseteq{\mathbb{R}}^n\) is closed if and only if every convergent sequence \((x_k)\subseteq F\) has its limit in \(F\).
  2. Use it to show \([0,1]\) is closed and \((0,1)\) is not.
TipSOLUTIONS
  1. Recall \(F\) is closed iff its complement \(F^c\) is open.

    (\(\Rightarrow\)) Suppose \(F\) is closed. Let \((x_k)\subseteq F\) with \(x_k\to x\); we show \(x\in F\). If instead \(x\in F^c\), then since \(F^c\) is open there is \(\varepsilon>0\) with \(B(x,\varepsilon)\subseteq F^c\). But \(x_k\to x\) yields some \(k\) with \(\|x_k-x\|<\varepsilon\), i.e. \(x_k\in B(x,\varepsilon)\subseteq F^c\), contradicting \(x_k\in F\). Hence \(x\in F\).

    (\(\Leftarrow\)) Suppose every convergent sequence in \(F\) has its limit in \(F\). We show \(F^c\) is open. If not, some \(x\in F^c\) has no ball contained in \(F^c\): for every \(\varepsilon>0\), \(B(x,\varepsilon)\) meets \(F\). Taking \(\varepsilon=1/k\), pick \(x_k\in F\cap B(x,1/k)\). Then \(\|x_k-x\|<1/k\to0\), so \(x_k\to x\) with \((x_k)\subseteq F\); by hypothesis \(x\in F\), contradicting \(x\in F^c\). Hence \(F^c\) is open and \(F\) is closed.

  2. \([0,1]\) closed: if \((x_k)\subseteq[0,1]\) and \(x_k\to x\), then \(0\le x_k\le1\) gives \(0\le x\le1\) by the order limit theorem, so \(x\in[0,1]\); by (a), \([0,1]\) is closed. \((0,1)\) not closed: \(x_k=1/k\in(0,1)\) and \(x_k\to0\notin(0,1)\), so (a) fails and \((0,1)\) is not closed.

Question 9

  1. Prove that if \(x_k\to L\), then every subsequence \((x_{k_j})\) converges to \(L\).
  2. (Challenging.) Prove the Bolzano–Weierstrass theorem: every bounded sequence in \({\mathbb{R}}\) has a convergent subsequence. Hint: first show every real sequence has a monotone subsequence, then apply the Monotone Convergence Theorem.
TipSOLUTIONS
  1. Let \(\varepsilon>0\). Since \(x_k\to L\), there is \(K\) with \(|x_k-L|<\varepsilon\) for all \(k\ge K\). The subsequence indices satisfy \(k_1<k_2<\cdots\), so \(k_j\ge j\); thus \(j\ge K \Rightarrow k_j\ge K \Rightarrow |x_{k_j}-L|<\varepsilon\). Hence \(x_{k_j}\to L\).

  2. Step 1 — every sequence has a monotone subsequence. Call an index \(m\) a peak if \(x_m\ge x_k\) for all \(k>m\).

    • If there are infinitely many peaks \(m_1<m_2<\cdots\), then by definition of peak \(x_{m_1}\ge x_{m_2}\ge\cdots\), a non-increasing subsequence.
    • If there are only finitely many peaks, choose \(k_1\) larger than every peak. Since \(k_1\) is not a peak, there is \(k_2>k_1\) with \(x_{k_2}>x_{k_1}\). Since \(k_2\) is also past every peak, it is not a peak, so there is \(k_3>k_2\) with \(x_{k_3}>x_{k_2}\). Continuing, we obtain a strictly increasing subsequence \(x_{k_1}<x_{k_2}<\cdots\).

    Either way we get a monotone subsequence.

    Step 2. Let \((x_k)\) be bounded. By Step 1 it has a monotone subsequence \((x_{k_j})\), which is bounded (being a subsequence of a bounded sequence). By the Monotone Convergence Theorem, \((x_{k_j})\) converges. Hence \((x_k)\) has a convergent subsequence.

    (In \({\mathbb{R}}^n\): extract a subsequence convergent in the first coordinate, then a further subsequence convergent in the second, and so on; after \(n\) steps the final subsequence converges in every coordinate, hence in \({\mathbb{R}}^n\).)

Question 10

Let \(f:X\to Y\) and \(A,B\subseteq Y\). Prove the preimage identities: \[ f^{-1}(A\cup B)=f^{-1}(A)\cup f^{-1}(B),\quad f^{-1}(A\cap B)=f^{-1}(A)\cap f^{-1}(B),\quad f^{-1}(A^c)=\big(f^{-1}(A)\big)^c. \]

TipSOLUTIONS

All three follow by unwinding the definition \(f^{-1}(S)=\{x: f(x)\in S\}\) and the matching logical connective.

Union. \(x\in f^{-1}(A\cup B) \iff f(x)\in A\cup B \iff \big(f(x)\in A \text{ or } f(x)\in B\big) \iff x\in f^{-1}(A)\cup f^{-1}(B)\).

Intersection. The same with “or” replaced by “and”: \(x\in f^{-1}(A\cap B)\iff \big(f(x)\in A\text{ and }f(x)\in B\big)\iff x\in f^{-1}(A)\cap f^{-1}(B)\).

Complement. \(x\in f^{-1}(A^c)\iff f(x)\in A^c\iff f(x)\notin A\iff x\notin f^{-1}(A)\iff x\in\big(f^{-1}(A)\big)^c\). (Here \(A^c\) is taken in \(Y\) and \(\big(f^{-1}(A)\big)^c\) in \(X\).)

Question 11

Prove that the \(\varepsilon\)-\(\delta\) and sequential definitions of continuity at a point are equivalent: for \(f:X\to{\mathbb{R}}^m\) and \(x_0\in X\), \[ \big(\forall\varepsilon>0\ \exists\delta>0:\ \|x-x_0\|<\delta\Rightarrow\|f(x)-f(x_0)\|<\varepsilon\big) \iff \big(x_k\to x_0\Rightarrow f(x_k)\to f(x_0)\big). \]

TipSOLUTIONS

(\(\Rightarrow\)) Assume the \(\varepsilon\)-\(\delta\) condition and let \(x_k\to x_0\). Fix \(\varepsilon>0\) and take the corresponding \(\delta>0\). Since \(x_k\to x_0\), there is \(K\) with \(\|x_k-x_0\|<\delta\) for \(k\ge K\); then \(\|f(x_k)-f(x_0)\|<\varepsilon\) for \(k\ge K\). Hence \(f(x_k)\to f(x_0)\).

(\(\Leftarrow\)) We prove the contrapositive: if \(\varepsilon\)-\(\delta\) fails, so does the sequential condition. If \(\varepsilon\)-\(\delta\) fails, there is some \(\varepsilon_0>0\) such that for every \(\delta>0\) some point within \(\delta\) of \(x_0\) has image at distance \(\ge\varepsilon_0\) from \(f(x_0)\). Taking \(\delta=1/k\), choose \(x_k\in X\) with \(\|x_k-x_0\|<1/k\) but \(\|f(x_k)-f(x_0)\|\ge\varepsilon_0\). Then \(x_k\to x_0\) while \(f(x_k)\not\to f(x_0)\), so the sequential condition fails. By contraposition, the sequential condition implies \(\varepsilon\)-\(\delta\).

Question 12

Let \(f,g:X\to{\mathbb{R}}\) be continuous at \(x_0\), and let \(c\in{\mathbb{R}}\).

  1. Using the sequential characterisation of continuity, prove that \(f+g\), \(cf\), and \(fg\) are continuous at \(x_0\), and that \(f/g\) is continuous at \(x_0\) provided \(g(x_0)\ne0\).
  2. Prove that a composition of continuous functions is continuous: if \(f:X\to Y\) is continuous at \(x_0\) and \(g:Y\to Z\) is continuous at \(f(x_0)\), then \(g\circ f\) is continuous at \(x_0\).
TipSOLUTIONS
  1. Let \(x_k\to x_0\) in \(X\). By continuity (sequential form), \(f(x_k)\to f(x_0)\) and \(g(x_k)\to g(x_0)\). By the Algebraic Limit Theorem (Question 6), \[ f(x_k)+g(x_k)\to f(x_0)+g(x_0),\quad c\,f(x_k)\to c\,f(x_0),\quad f(x_k)g(x_k)\to f(x_0)g(x_0), \] and, when \(g(x_0)\ne0\), \(f(x_k)/g(x_k)\to f(x_0)/g(x_0)\) (continuity gives \(g(x_k)\to g(x_0)\ne0\), so \(g(x_k)\ne0\) for large \(k\) and the quotient rule applies). Since \(x_k\to x_0\) was arbitrary, each of \(f+g,\,cf,\,fg,\,f/g\) satisfies the sequential criterion, hence is continuous at \(x_0\).

  2. Let \(x_k\to x_0\). Since \(f\) is continuous at \(x_0\), \(f(x_k)\to f(x_0)\). Applying the sequential criterion for \(g\) at \(f(x_0)\) to the sequence \(y_k:=f(x_k)\to f(x_0)\) gives \(g(y_k)\to g(f(x_0))\), i.e. \((g\circ f)(x_k)\to (g\circ f)(x_0)\). Hence \(g\circ f\) is continuous at \(x_0\).

Question 13

(Challenging.)

  1. Prove the Extreme Value Theorem: if \(K\subseteq{\mathbb{R}}^n\) is compact and \(f:K\to{\mathbb{R}}\) is continuous, then \(f\) attains a maximum and a minimum on \(K\).
  2. Prove the Intermediate Value Theorem: if \(f:[a,b]\to{\mathbb{R}}\) is continuous and \(y\) lies between \(f(a)\) and \(f(b)\), then \(f(c)=y\) for some \(c\in[a,b]\).
TipSOLUTIONS
  1. We show \(f\) attains a maximum (for the minimum, apply the result to \(-f\)).

    Bounded above. Suppose not: then for each \(k\) there is \(x_k\in K\) with \(f(x_k)>k\). Since \(K\) is bounded, \((x_k)\) is bounded, so by Bolzano–Weierstrass a subsequence \(x_{k_j}\to x^*\); and \(x^*\in K\) because \(K\) is closed. By continuity \(f(x_{k_j})\to f(x^*)\), a finite number — but \(f(x_{k_j})>k_j\to\infty\), a contradiction. So \(f\) is bounded above, and \(M:=\sup_{x\in K}f(x)\) exists by completeness.

    Attainment. By the \(\varepsilon\)-characterisation of the supremum (Question 3), for each \(k\) choose \(z_k\in K\) with \(f(z_k)>M-\tfrac1k\); with \(f(z_k)\le M\) this gives \(f(z_k)\to M\). By Bolzano–Weierstrass and closedness, some subsequence \(z_{k_j}\to x^*\in K\), and continuity gives \(f(z_{k_j})\to f(x^*)\). Since also \(f(z_{k_j})\to M\), uniqueness of limits gives \(f(x^*)=M\). Thus \(f\) attains its maximum at \(x^*\).

  2. Assume without loss of generality \(f(a)<y<f(b)\) (if \(f(a)>f(b)\), apply the argument to \(-f\) and \(-y\); if \(y\) equals an endpoint value there is nothing to prove). Let \[S=\{x\in[a,b] : f(x)<y\}.\] \(S\) is non-empty (\(a\in S\)) and bounded above by \(b\), so \(c=\sup S\) exists by completeness, with \(c\in[a,b]\). We rule out both strict inequalities using continuity at \(c\).

    • If \(f(c)<y\): by continuity there is \(\delta>0\) with \(f(x)<y\) for all \(x\in[a,b]\) within \(\delta\) of \(c\). Since \(f(b)>y\) we have \(c<b\), so points just to the right of \(c\) belong to \(S\), contradicting \(c=\sup S\).
    • If \(f(c)>y\): then \(c\ne a\) (as \(f(a)<y\)), so \(c>a\); by continuity there is \(\delta>0\) with \(f(x)>y\) for \(x\) within \(\delta\) of \(c\). No point of \((c-\delta,c]\) lies in \(S\), so \(c-\delta\) is an upper bound of \(S\) smaller than \(c\), contradicting \(c=\sup S\).

    Both cases are impossible, so \(f(c)=y\) (and \(c\in(a,b)\) since \(f(c)=y\) differs from \(f(a)\) and \(f(b)\)).