# Am I way off on this proof of continuity of $f(x)=\frac{x+|x|}{2}$?

We're asked to determine where $f(x)=\frac{x+|x|}{2}$ is continuous and prove. Clearly, it is continuous on $\mathbb{R}$.

The answer that I was able to find involved splitting it into three separate intervals $(x<0, x = 0, x>0)$. Intuitively, that is how I decided it was continuous on $\mathbb{R}$, but it seems to me a simpler $\epsilon-\delta$ proof is as follows:

1. A function $f$ is continuous if $|x-a| < \delta$ then $|f(x)-f(a)| < \epsilon$.

2. Alternatively express the above as $|f(x)-f(a)| < \epsilon$ if $|x-a| < \delta$

3. Suppose $|x-a| < \delta$. Then: $$|f(x)- f(a)| = \left|\frac{x+|x|}{2} - \frac{a+|a|}{2}\right| < \epsilon$$ rearrange, and use triangle inequality: $$|x+|x|-(a-|a|)| = \left|x-a-(|x|-|a|)\right|\leqslant |x-a| + ||x|-|a|| <2\epsilon$$

Using the above definition of $\delta$ and the second triangle inequality $$|x-a| + ||x|-|a|| < |\delta| + \left||x|-|a|\right| \leqslant |\delta| + |x-a| \leqslant |\delta| +|\delta| =2\delta <2\epsilon$$

Therefore, if $|x-a|<\delta, |f(x)-f(a)| < \epsilon$, and $\epsilon>\delta$, so we can pick $x$ "close enough" (i.e., within $\delta$ of the a) so the function is continuous

I want to know if that is just totally wrong, so that I don't go about trying to prove things in a similar manner to find out I'm missing the point.

• I won't tell you it's wrong, but I will tell you it's overly complicated. Notice that for nonpositive x, f(x) = 0. For positive x, f(x) = x. Both are polynomial functions and polynomial functions are known to be continuous (and can be easily proved so, in this case) Dec 7 '17 at 6:33
• You could start by proving $|f(x)-f(y)|\le|x-y|$. Dec 7 '17 at 6:34

Yes, $f$ is continuous because $$|f(x)- f(a)| = \left|\frac{x+|x|}{2} - \frac{a+|a|}{2}\right| \leq \frac{|x-a|}{2} + \frac{||x|-|a||}{2}\leq |x-a|.$$ So, given $\epsilon>0$, take $0<\delta\leq \epsilon$ and for $|x-a|<\delta$, you have that $|f(x)-f(a)|<\epsilon$.

The same conclusion can be found by noting that $$\frac{x+|x|}{2}=\begin{cases} x&\text{if x\geq 0,}\\ 0&\text{if x\leq 0.} \end{cases}$$

Why not with sequences ? Let $a \in \mathbb R$ and let $(a_n)$ be a sequence with $a_n \to a$. Then $|a_n| \to |a|$, hence

$f(a_n)=\frac{a_n+|a_n|}{2} \to \frac{a+|a|}{2}=f(a)$.

• If you don't know that absolute value is sequentially continuous, or that sequential continuity implies regular continuity, then this approach is a lot of work. And if you know absolute value is continuous, I don't see what introducing sequences buys you; unless you have that sequential continuity is equivalent (under choice) without sums and quotients of continuous functions, but that's a rare order of facts for a Real Analysis class/book. Dec 7 '17 at 10:59
• It is very(!) easy to see that in $\mathbb R$ (equipped with the metric $d(x,y)=|x-y|$) sequential continuity and regular continuity are equivalent. This is a "folclore" - result in any Real Analysis book.
– Fred
Dec 7 '17 at 11:03
• Proving that equivalence properly requires countable choice for the subsets of the reals. So it's not as easy as proving this by any other means. For reference, I've taught real analysis, I'm just saying pedagogically I'd be shocked if your solution were the intended one for any textbook. Dec 7 '17 at 11:08
• @MarkS. is right that countable choice is necessary for the proof that normal continuity and sequential continuity at the same point are equivalent. See this. Dec 7 '17 at 15:24

You are working to hard. If Your function is just $f(x) =x$ if $x$ is non-negative, and $f(x)= 0$ if $x$ is non-positive. both formulas give $f(0) =0$ Surely you can show that $f$ is continuous on the non-positives and non-negatives hence on $\mathbb R$.

• This answer gives the impression that proving that $f$ is continuous at $0$ is immediate from "$0$ and $x$ are continuous functions", but certainly it wouldn't be so if there were a jump discontinuity. Dec 7 '17 at 10:54
• I take your point but continuity at x=0 from the left and the right with common value f(0) =0 does immediately imply continuity at x=0 of the whole function f. Dec 7 '17 at 20:50
• certainly. I was basically objecting to your use of "hence" without further comment, rather than the approach. Dec 8 '17 at 0:30

Technically, the by far easiest way (the way I used in my head when reading your question) is to use the fact that (finite) sums and compositions of continuous functions remains continuous. Now the identity function is clearly continuous, and the absolute function is too, and dividing by two is too, so done! Thus the only 'non-trivial' part is proving that the absolute function is continuous.