Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Given continuous functions $f,g: \mathbb{R} \to \mathbb{R}$, in order to prove that $ \max(f(x),g(x))$ is continuous, a standard trick is to rewrite it as a linear combination of continuous functions: $$ \max(f(x),g(x)) = \frac{1}{2} (f(x) + g(x) + |f(x) - g(x)| ) $$ Is there any sort of motivation for why one might come up with this particular combination of continuous functions? I can see that it works, but without knowing this fact beforehand , what might lead you to consider writing $ \max(f(x),g(x) ) $ in the above manner?

share|improve this question

4 Answers 4

up vote 3 down vote accepted

What I would do is this: $$ \max(f(x),g(x))=g(x)+\max(f(x)-g(x),0), $$ so this reduces us to write an expression for $\max(f(x),0)$. If we write $f=f^+-f^-$ (positive and negative parts), we have $\max(f(x),0)=f^+(x)$. We also have $|f|=f^++f^-$, so $f^+=(f+|f|)/2$. In the end, $$ \max(f(x),0)=\frac{f(x)+|f(x)|}2. $$ If we now go back to the initial case, $$ \max(f(x),g(x))=g(x)+\max(f(x)-g(x),0)=g(x)+\frac{f(x)-g(x)+|f(x)-g(x)|}2=\frac{f(x)+g(x)+|f(x)-g(x)|}2 $$

share|improve this answer

I think I'd start by considering the easier case where one of $f$, $g$ was constant and zero. If I've proved that $\max(h(x),0)$ is continuous for all continuous $h$ and want to generalise, I'll see that I can write $$\max(f(x),g(x)) = \max (f(x)-g(x), 0) + g(x).$$ This formula breaks the symmetry between $f$ and $g$ that we started with, so it's natural also to write down $$max(f(x), g(x) = \max( g(x)-f(x), 0) + f(x) $$ and we recover the symmetry by adding the two expressions up: $$2 max (f(x),g(x)) = f(x) + g(x) +\left(\max (f(x)-g(x), 0) + \max( g(x)-f(x), 0)\right).$$ And now the expression inside the bracket looks familiar, being exactly $|f(x)-g(x)|$.

Indeed you really have to break up $|f(x)|$ into these two parts to prove that the absolute value of a continuous function is continuous. So the magic formula doesn't really make for a shortcut in the proof, even if you're told about it without motivation.

share|improve this answer

The following is an "abstract nonsense" answer to your question.

Given two real numbers $a$ and $b$ there is a quadratic equation having these two numbers as solutions, namely $$(x-a)(x-b)=x^2-p x + q =0\ ,$$ where $p=a+b$ and $q=ab$. The two coefficients $p$ and $q$ encode the multiset $\{a,b\}$ in a reversible way, insofar as we can write $$\{a,b\}=\left\{{p-\sqrt{p^2-4q}\over2},{p+\sqrt{p^2-4q}\over2}\right\}\ .$$ Now on the right side the two numbers appear in increasing order. Therefore $$\max\{a,b\}={1\over2}\left(p+\sqrt{p^2-4q}\right)={1\over2}\bigl(a+b+|a-b|\bigr)\ .$$

share|improve this answer

We're given two numbers, $x$ and $y$, and want to figure out the bigger one. Now we probably have to define a function piecewise. However, there already is one simple piecewise defined function, which is also closely related to comparing numbers, namely the absolute value function. I think this is the biggest leap you have to take.

When you notice that $x\ge y$ iff $x-y\ge 0$ iff $|x-y|=x-y$, and similarly $x\le y$ iff $|x-y|=y-x$, you're basically done. In the first case adding $y$, the smaller number, will give $|x-y|+y=x$ and in the second case adding $x$, again the smaller number, gives $|x-y|+x=y$. If you add both numbers you just get the bigger number times two, and you've managed to hide the selection process inside the absolute value function!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.