Tutorials › Real Analysis › Continuity of Differences

Continuity · Tutorial 342 of 1000

Continuity of Differences

See how subtracting functions preserves continuity and how their changes can be controlled with uniform and Lipschitz estimates.

Intermediate 10 min read

What You'll Learn

  • Define the difference of two real-valued functions on a common domain
  • Prove continuity of a difference at a point using epsilon-delta estimates
  • Extend the result to uniform continuity on an entire domain
  • Find a Lipschitz bound for the difference from bounds on its terms
  • Apply difference continuity to polynomial and rational examples
  • Recognize why a continuous difference does not imply continuous terms

Subtracting Continuous Functions

When two functions are defined on the same domain, their values can be subtracted at each input. The resulting function is their difference. As with addition, continuity of the terms ensures continuity of the result. The difference introduces a minus sign, but that sign does not obstruct the estimates used to control changes in function values.

Definition: Let \(E\subseteq\mathbb{R}\), and let \(f,g:E\to\mathbb{R}\). The difference \(f-g:E\to\mathbb{R}\) is defined by \((f-g)(x)=f(x)-g(x)\) for every \(x\in E\).

The functions must have a common domain for this definition to apply. If their original domains differ, the difference is defined on the intersection of those domains. The order also matters: \(f-g\) and \(g-f\) are generally different functions, though each can inherit continuity from the same two terms.

Continuity at a Point

The key estimate is the triangle inequality. If \(f\) and \(g\) are both close to their values at \(a\), then their difference is close to its value at \(a\). The change in the difference is \((f(x)-g(x))-(f(a)-g(a))\), which can be separated into the change in \(f\) minus the change in \(g\). Taking absolute values removes any concern about the sign of the latter change.

Theorem: Let \(E\subseteq\mathbb{R}\), let \(a\in E\), and let \(f,g:E\to\mathbb{R}\). If \(f\) and \(g\) are continuous at \(a\), then \(f-g\) is continuous at \(a\).

Proof. Fix \(\varepsilon>0\). Continuity of \(f\) at \(a\) gives a \(\delta_f>0\) such that \(x\in E\) and \(|x-a|<\delta_f\) imply \(|f(x)-f(a)|<\varepsilon/2\). Continuity of \(g\) at \(a\) gives a \(\delta_g>0\) such that \(x\in E\) and \(|x-a|<\delta_g\) imply \(|g(x)-g(a)|<\varepsilon/2\). Set \(\delta=\min\{\delta_f,\delta_g\}\), which is positive. If \(x\in E\) and \(|x-a|<\delta\), then both bounds apply, and

$$ \begin{aligned} |(f-g)(x)-(f-g)(a)| &=|(f(x)-f(a))-(g(x)-g(a))|\\ &\leq |f(x)-f(a)|+|g(x)-g(a)|\\ &<\frac{\varepsilon}{2}+\frac{\varepsilon}{2} =\varepsilon. \end{aligned} $$

This is the epsilon-delta condition for continuity of \(f-g\) at \(a\). \(\square\)

The proof uses a common radius small enough for both functions. This is the same finite-minimum strategy used for sums in “Continuity of Sums.” The minus sign changes the algebraic expression, but the triangle inequality gives the same kind of bound.

Worked Example: A Difference of Polynomials

Define \(P(x)=x^3-2x^2+4x\) and \(Q(x)=3x^2-x+1\) on \(\mathbb{R}\). Both are polynomials, so each is continuous at every real number by the polynomial continuity theorem. Therefore \(P-Q\) is continuous at every real number by the theorem on differences.

The difference can also be simplified:

$$ (P-Q)(x)=x^3-2x^2+4x-(3x^2-x+1) =x^3-5x^2+5x-1. $$

At \(x=2\), the original functions give \(P(2)=8-8+8=8\) and \(Q(2)=12-2+1=11\), so \((P-Q)(2)=8-11=-3\). The simplified expression gives the same value: \(2^3-5(2^2)+5(2)-1=8-20+10-1=-3\). Thus the difference is continuous at \(2\), with value \(-3\). In particular, for every \(\varepsilon>0\), some \(\delta>0\) ensures that \(x\in\mathbb{R}\) and \(|x-2|<\delta\) imply \(|(P-Q)(x)+3|<\varepsilon\).

Uniform Continuity of a Difference

Uniform continuity requires one choice of \(\delta\) to work for every pair of inputs in the domain. If both terms are uniformly continuous, choose their respective thresholds so that each change is less than half the desired output tolerance. The smaller threshold then controls both terms simultaneously.

Theorem: Let \(E\subseteq\mathbb{R}\), and let \(f,g:E\to\mathbb{R}\). If both \(f\) and \(g\) are uniformly continuous on \(E\), then \(f-g\) is uniformly continuous on \(E\).

Proof. Fix \(\varepsilon>0\). Uniform continuity of \(f\) gives \(\delta_f>0\) such that, for all \(x,y\in E\), \(|x-y|<\delta_f\) implies \(|f(x)-f(y)|<\varepsilon/2\). Uniform continuity of \(g\) gives \(\delta_g>0\) such that, for all \(x,y\in E\), \(|x-y|<\delta_g\) implies \(|g(x)-g(y)|<\varepsilon/2\). Choose \(\delta=\min\{\delta_f,\delta_g\}>0\). For any \(x,y\in E\) with \(|x-y|<\delta\), the triangle inequality yields

$$ \begin{aligned} |(f-g)(x)-(f-g)(y)| &=|(f(x)-f(y))-(g(x)-g(y))|\\ &\leq |f(x)-f(y)|+|g(x)-g(y)|\\ &<\frac{\varepsilon}{2}+\frac{\varepsilon}{2} =\varepsilon. \end{aligned} $$

This choice of \(\delta\) works for every such pair \(x,y\), so \(f-g\) is uniformly continuous on \(E\). \(\square\)

Worked Example: A Uniformly Continuous Difference

Let \(H(x)=|x+1|-|x-5|\) on \(\mathbb{R}\). The reverse triangle inequality gives, for every \(x,y\in\mathbb{R}\),

$$ \bigl||x+1|-|y+1|\bigr| \leq |(x+1)-(y+1)|=|x-y|. $$

Applying the same inequality to \(x-5\) and \(y-5\) gives \(\bigl||x-5|-|y-5|\bigr|\leq|x-y|\). Both terms are therefore uniformly continuous, and the uniform-continuity theorem for differences shows that \(H\) is uniformly continuous.

The estimates give a more explicit bound:

$$ \begin{aligned} |H(x)-H(y)| &\leq \bigl||x+1|-|y+1|\bigr| +\bigl||x-5|-|y-5|\bigr|\\ &\leq 2|x-y|. \end{aligned} $$

For example, \(H(0)=1-5=-4\) and \(H(6)=7-1=6\), so \(|H(6)-H(0)|=10\). The bound gives \(2|6-0|=12\), which is indeed an upper bound. More generally, given \(\varepsilon>0\), choosing \(\delta=\varepsilon/2\) ensures that \(|x-y|<\delta\) implies \(|H(x)-H(y)|\leq2|x-y|<\varepsilon\).

Lipschitz Bounds for Differences

A Lipschitz estimate gives a direct numerical bound on how much a function can change. If \(f\) has Lipschitz constant \(L_f\) and \(g\) has Lipschitz constant \(L_g\), the triangle inequality combines their bounds. The resulting constant is valid whether or not the changes in the two terms reinforce or partially cancel one another.

Theorem: Suppose \(f,g:E\to\mathbb{R}\) are Lipschitz on \(E\), with respective constants \(L_f,L_g\geq0\). Then \(f-g\) is Lipschitz on \(E\) with constant \(L_f+L_g\).

Proof. For any \(x,y\in E\), the hypotheses and the triangle inequality give

$$ \begin{aligned} |(f-g)(x)-(f-g)(y)| &=|(f(x)-f(y))-(g(x)-g(y))|\\ &\leq |f(x)-f(y)|+|g(x)-g(y)|\\ &\leq L_f|x-y|+L_g|x-y|\\ &=(L_f+L_g)|x-y|. \end{aligned} $$

This is the defining Lipschitz inequality for \(f-g\), with constant \(L_f+L_g\). \(\square\)

As with sums, the bound need not be the best possible one. For instance, if \(f=g\), their difference is the constant zero function, even if the constants used to bound the separate functions are large. The theorem guarantees a valid bound; it does not claim that the bound is minimal.

Worked Example: A Rational Difference on a Restricted Domain

Let \(E=\mathbb{R}\setminus\{-2,3\}\), and define \(R(x)=1/(x+2)-1/(x-3)\) for \(x\in E\). Each term is a rational function and is continuous wherever its denominator is nonzero, by “Continuity of Rational Functions.” Since \(0\in E\), the difference theorem shows that \(R\) is continuous at \(0\).

Combining the fractions gives

$$ R(x)=\frac{(x-3)-(x+2)}{(x+2)(x-3)} =\frac{-5}{(x+2)(x-3)}. $$

At \(0\), the original expression gives \(R(0)=1/2-1/(-3)=1/2+1/3=5/6\). The simplified expression agrees: \(-5/((0+2)(0-3))=-5/(-6)=5/6\).

A direct estimate also verifies continuity. If \(|x|<1\), then \(|x+2|>1\) and \(|x-3|>2\), so \(x\in E\) and \(|(x+2)(x-3)|>2\). Using the simplified expression and \(R(0)=5/6\), we obtain

$$ \begin{aligned} |R(x)-R(0)| &=\left|\frac{-5}{(x+2)(x-3)}-\frac56\right|\\ &=\frac{5|x||1-x|}{6|(x+2)(x-3)|}\\ &<\frac{5}{6}|x|. \end{aligned} $$

Here \(|1-x|<2\) and the denominator in the middle expression is greater than \(12\), which gives the final strict bound. Given \(\varepsilon>0\), choose \(\delta=\min\{1,6\varepsilon/5\}\). If \(x\in E\) and \(|x|<\delta\), the estimate gives \(|R(x)-R(0)|<(5/6)\delta\leq\varepsilon\). Thus the direct calculation agrees with the continuity conclusion obtained from the theorem.

Cancellation and a Common Pitfall

The difference theorem has a useful converse when one term is already known to be continuous. If \(f-g\) and \(g\) are continuous at a point, then \(f=(f-g)+g\) is continuous there by the two-function sum theorem established earlier in this course. But continuity of \(f-g\) alone does not imply continuity of either \(f\) or \(g\): the two terms can cancel.

Worked Example: A Continuous Difference of Discontinuous Functions

Define \(u:\mathbb{R}\to\mathbb{R}\) by \(u(0)=1\) and \(u(x)=0\) for \(x\ne0\). This function is not continuous at \(0\). For example, for every \(\delta>0\), choose \(x=\delta/2\); then \(x\ne0\), \(|x-0|<\delta\), and \(|u(x)-u(0)|=|0-1|=1\). Thus the continuity condition fails for \(\varepsilon=1/2\).

Now define \(v=u\). Both \(u\) and \(v\) are discontinuous at \(0\), but \((u-v)(x)=u(x)-u(x)=0\) for every \(x\in\mathbb{R}\). Their difference is the constant zero function and is therefore continuous everywhere. This example shows why one cannot infer continuity of the separate terms from continuity of their difference.

Also distinguish the signed difference \(f-g\) from the difference of absolute values \(|f|-|g|\). For example, if \(f(x)=2\) and \(g(x)=-3\) at an input, then \(f(x)-g(x)=5\), whereas \(|f(x)|-|g(x)|=2-3=-1\). The two expressions are not interchangeable. When estimating changes in \(f-g\), the reliable starting point is to subtract the two function values and then apply the triangle inequality.

The practical pattern is consistent across the results: require both terms to be defined on the domain of interest, control each term’s change, and combine those controls with the triangle inequality. Pointwise continuity gives control near a chosen input, uniform continuity gives one threshold across the domain, and Lipschitz hypotheses give an explicit bound on the size of the change.

Check Your Understanding

Use the difference theorems and estimates to answer the following questions.

  1. Why must two functions have a common domain in order to define their difference pointwise?
  2. In the pointwise continuity proof, why is it useful to make each term’s change less than half of the target tolerance?
  3. If two functions are uniformly continuous, what feature of the delta choice makes their difference uniformly continuous?
  4. If \(f\) and \(g\) have Lipschitz constants \(4\) and \(7\), what Lipschitz constant does the theorem guarantee for \(f-g\)?
  5. Can a difference be continuous even when both of its terms are discontinuous? Explain using an example.