If $f,g$ are continuous at $a$, show that $h(x)=\max\{f(x),g(x)\}$ and $k(x)=\min\{f(x),g(x)\}$ are also continuous at $a$. Here is my attempt at a proof. It feels very elaborate and I am not sure if it is correct. Can someone please point out any mistakes or places where I may improve. Thanks!

By the definition of continuity at $a$ of $f,g$ we have that $\lim\limits_{x\to a}f(x)=f(a)$ and $\lim\limits_{x\to a}g(x)=g(a)$. Suppose that $f(a)>g(a)$. Then there exists a $\delta>0$ such that $f>g$ for all $x$ satisfying $|x-a|<\delta$. Then for $x$ satisfying $|x-a|<\delta$ we have $h(x)=f(x)$ and $k(x)=g(x)$ and thus $h$ and $k$ are continuous at $a$ because $f$ and $g$ are continuous at $a$. Now if $f(a)<g(a)$ we simply relabel $f=\tilde{g}$ and $g=\tilde{f}$, so that $\tilde{f}(a)>\tilde{g}(a)$ and we apply the previous result to show that again $h$ and $k$ are continuous at $a$.\

Now if $f(a)=g(a)$ then we can distinguish three cases. $f\geq g$ in a small neighborhood about $a$, $f\leq g$ in a small neighborhood about $a$ or $f\geq g$ on one side of $a$ and $f\leq g$ on the other side. In the first case we assume that $f\geq g$ in some small neighborhood about $a$. Then, since $f(a)=g(a)$ we have $h(x) = f(x)$ in this neighborhood and $k(x) = g(x)$ and again we see that $h$ and $k$ are continuous at $a$ due to the continuity of $f$ and $g$ at $a$. Similarly if $f\leq g$ in a neighborhood around $a$ then $h(x)=g(x)$ and $k(x)=f(x)$ in this neighborhood and $h$ and $k$ are continuous at $a$.

Suppose that just to the left of $a$ we have $f\geq g$ and just to the right of $a$ we have $f\leq g$. Then $\lim\limits_{x\to a^-}h(x)=\lim\limits_{x\to a^-}f(x)=f(a)=h(a)=g(a)=\lim\limits_{x\to a^+}g(x)=\lim\limits_{x\to a^+}h(x)$. Similarly $\lim\limits_{x\to a^-}k(x)=\lim\limits_{x\to a^-}g(x)=g(a)=k(a)=f(a)=\lim\limits_{x\to a^+}f(x)=\lim\limits_{x\to a^+}k(x)$. So $\lim\limits_{x\to a}h(x)=h(a)$ and $\lim\limits_{x\to a}k(x)=k(a)$ which means that $h$ and $k$ are continuous at $a$. Lastly if $f\leq g$ just to the left of $a$ and $f\geq g$ just to the right of $a$ we can relabel $f=\tilde{g}$ and $g=\tilde{f}$ and apply the last result to show $h$ and $k$ are continuous at $a$.

Again, please point out any mistakes I may have made. Thanks!!


4 Answers 4


$$\max [f,g] (x)=\dfrac {f(x)+g(x)}{2}+ \dfrac{|f(x)-g(x)|}{2},$$ $$\min [f,g] (x)=\dfrac {f(x)+g(x)}{2}- \dfrac{|f(x)-g(x)|}{2}.$$ All the involved functions are continuous.

  • 1
    $\begingroup$ Ah this is great, actually the first part of this question asked us to show this for real numbers, can't believe I didn't manage to see the connection. Thanks a lot! $\endgroup$
    – Slugger
    Commented Feb 13, 2014 at 20:26
  • $\begingroup$ You are welcome my friend :-) $\endgroup$
    – pppqqq
    Commented Feb 13, 2014 at 21:41
  • $\begingroup$ but how to prove that this equations are actually true for all R? $\endgroup$ Commented Dec 7, 2019 at 2:13

Another way to show this is:

$$h(x)=\begin{cases}f(x), \text{ if }f(x)\ge g(x)\\ g(x), \text{ if } f(x)\le g(x)\end{cases}$$ Now, $d(x):=f(x)-g(x)$ is continuous, being a sum of continuous functions. This way the $\max$-function $h$ becomes $$h(x)=\begin{cases}f(x), \text{ if }d(x)\ge 0\\ g(x), \text{ if } d(x)\le 0\end{cases}$$ That means $h$ is continuous on $d^{-1}((-\infty,0])$, and it is continuous on $d^{-1}([0,∞))$. Both sets are closed, so it is continuous in total.

  • $\begingroup$ Thanks, that's a nice approach. I wonder if anyone actually read the mess I wrote haha. Thanks for the answer! $\endgroup$
    – Slugger
    Commented Feb 13, 2014 at 20:27

If $f(a) = g(a)$, the rest is obvious. Assume $f(a) > g(a) (\iff f(a) - g(a) > 0)$. Having them both continuous at $a$ means that for every $\epsilon > 0$ there's a $\delta >0$ such that for every $x \in (a-\delta,a+\delta)$: $f(x) - g(x) > 0$ or $f(x) > g(x)$ OR: $$\max(f(x),g(x))=f(x),\min(f(x),g(x))=g(x)$$ Therefore $\max(f(x),g(x))$ and $\min(f(x),g(x))$ are continuous at $a$.

  • $\begingroup$ sorry, but this is not clear for me. You've started from assumption and then claimed that assumption is true, without involving epsilon(which is included in lim definition) Can you explain it in more details? $\endgroup$ Commented Dec 8, 2019 at 11:07

In general: if a function $h$ can be written as a composition $h=u\circ v$ of continuous functions $u$ and $v$ then it is continuous.

In general: if $Y\times Z$ is equipped with the producttopology then a function $v=\left(v_{1},v_{2}\right):X\rightarrow Y\times Z$ is continuous if $v_{1}$ and $v_{2}$ are continuous.

Here you can take $u=\max:\mathbb{R}^{2}\rightarrow\mathbb{R}$ and $v:\mathbb{R}\rightarrow\mathbb{\mathbb{R}}^{2}$ defined by $x\mapsto\left(f\left(x\right),g\left(x\right)\right)$.

It appears to be enough to prove $u=\max:\mathbb{R}^{2}\rightarrow\mathbb{R}$ is continuous, and the same procedure works for $\min:\mathbb{R}^{2}\rightarrow\mathbb{R}$.

This makes things less complicated.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .