# Prove that $f(x)= \begin{cases} \frac{x+1}{e^{2x}+1}, & x≠0 \\ 1/2, & x=0 \end{cases}$ is continuous and differentiable.

Let's say that you want to prove that $f(x)=\begin{cases} \displaystyle \frac{x+1}{e^{2x}+1} &\text{if}\, x \ne 0\\ 1/2 &\text{if}\, x = 0\end{cases}$ is differentiable and continuous for $f:\mathbb R \to \mathbb R$. Is it enough to state that, since we know that linear and exponential functions are continuous then if you divide one by the other the result would still be a continuous function?

Then to show that $f(x)$ is differentiable, you'd have to use the formula $$\lim\limits_{h \to 0} \frac{f(x+h)-f(x)}{h}$$ $$=\lim\limits_{h \to 0} \frac{(\frac{x+1}{e^{2x}+1}+h)-(\frac{x+1}{e^{2x}+1})}{h}$$ $$=\lim\limits_{h \to 0} \frac{\frac{x+1}{e^{2x}+1}+h-\frac{x+1}{e^{2x}+1}}{h}$$ $$=\lim\limits_{h \to 0} \frac{h}{h}=1$$

Is that enough to show that $f(x)$ is differentiable and continuous? Also how would the fact that $f(x)$ is a piece-wise function affect the result?

• Your $f(x+h)$ is incorrect, should be $$f(x+h)=\dfrac{(x+h)+1}{e^{2(x+h)}+1}.$$ Jan 15, 2018 at 19:37
• If $x = 0$ then $\frac {x +1}{e^{2x} +1} = \frac 12$ so $f(x) = \frac {x +1}{e^{2x} +1}$ for all $x$ and that piecewise definition is just an unnescessary red herring. Jan 15, 2018 at 19:56

Inasmuch as the derivative exists for $x\ne 0$, we need only show that $f$ is differentiable at $x=0$.

Using the definition of the derivative, we find

\begin{align} f'(0)&=\lim_{h\to 0}\frac{\frac{h+1}{e^{2h}+1}-\frac12}{h}\\\\ &=\lim_{h\to 0}\frac{1+2h-e^{2h}}{2h(e^{2h}+1)}\\\\ &=\lim_{h\to 0}\frac{1+2h-(1+2h+O(h^2))}{2h(e^{2h}+1)}\\\\ &=0 \end{align}

Hence, $f$ is differentiable for all $x$.

As a side note, $f$ is also continuously differentiable at $0$ since for $x\ne 0$, we have

$$\lim_{x\to 0}f'(x)=\lim_{x\to 0}\frac{(e^{2x}+1)-2e^{2x}(x+1)}{(e^{2x}+1)^2}=0$$

• Instead of getting $f'(x)=\lim_{x\to 0}\frac{(e^{2x}+1)-2e^{2x}(x+1)}{(e^{2x}+1)^2}$ I get $\frac{f\left(x+h\right)-f\left(x\right)}{h}=\frac{1}{h}\left(\frac{x+h+1}{e^{2x+2h}+1}-\frac{x+1}{e^{2x}+1}\right)$. How would you go on from there? Jan 15, 2018 at 20:08
• @SkiMask Why do you want to use the limit formula instead of applying the quotient rule? Jan 15, 2018 at 20:33
• To show that it's differentiable and also because I'm weak with the limit formula so it's better practice :) Jan 15, 2018 at 20:37
• Get a common denominator, and use Taylor's Theorem to expand the numerator up to $O(h^2)$. Jan 15, 2018 at 20:59
• It would've been absolutely phenomenal if you could've had a more step by step approach because I only started learning this and have to sort of try to fill in the blanks.Fore example I have no idea what $O(h^2)$ means, but that's on me and not you. Other thank that it's a pretty spot on answer! Jan 17, 2018 at 16:02

$$\frac{x+1}{e^{2x}+1} \underset{x \rightarrow 0}{\rightarrow}\frac{1}{2} \ne 1$$ Hence it is not continuous ?

Edit : Great. Now you wrote $$f\left(x+h\right)=\frac{x+1}{e^{2x}+1}+h$$ Do you understand why it is false ? In fact

$$\frac{f\left(x+h\right)-f\left(x\right)}{h}=\frac{1}{h}\left(\frac{x+h+1}{e^{2x+2h}+1}-\frac{x+1}{e^{2x}+1}\right)$$

• Sorry it was supposed to be $1/2$ and not 1. Fixed it now. Jan 15, 2018 at 19:35
• @SkiMask I edited too in consequence. Jan 15, 2018 at 19:37
• How would you go on from there? @Atmos Jan 15, 2018 at 19:57
• Pretty much as Mark viola did ! Jan 15, 2018 at 20:17

"Also how would the fact that f(x) is a piece-wise function affect the result?"

It's a red herring. $f$ is not piecewise.

$\frac 12 = \frac {0 + 1}{e^{2*0} + 1}$ so $f(x) = \frac {x + 1}{e^{2x} +1}$ if $x\ne 0$ and $f(x) = \frac {x + 1}{e^{2x} +1}$ if $x = 0$.

So $f(x) = \frac {x + 1}{e^{2x} +1}$. Period.

Is it enough to state that, since we know that linear and exponential functions are continuous then if you divide one by the other the result would still be a continuous function?

It would be if $f$ weren't piecewise. Other wise you have to state that and also prove $\lim_{x\to 0} f(x) = f(0)$. That's easy to prove.

However as it's even easier to show that $f(x)$ isn't actually piecewise we do not have to.

So yes, that statement is enough.

Then to show that f(x) is differentiable, you'd have to use the formula ...

Yes. (Or I assume so... I didn't scrutinize it because the lines and layout looked good so I assumed it's correct.)

But if the function were peicewise we'd have to make special cases for $x = 0$ and do a case for $x \ne 0$ that $x + h < 0$ and $0 < x < x+h$ and have a general pain in the ass. An easy pain in the ass but still...

But as the function is not piecewise we don't have to do that.

• So if the situation was that $f(x)=\frac {x}{e^{2x} +1}, x≠0$ and $f(x)=1, x=0$, you would have to show that both these pieces are differentiable and continuous separately? Jan 15, 2018 at 20:14