# Continuity of function-example

I'd like to examine the continuity of the following function:

f[x_] := Limit[(n^x - n^(-x) ) / (n^x + n^(-x) ), n -> Infinity]


I know that this function isn't continuous because $f(x)=-1$ for $x<0$, for $x=0$ $f(x)=0$, and finally $f(x)=1$ for $x>0$ .

$$x<0\quad \quad f(x)=-1 \\ x=0\quad \quad f(x)=\ \ \ 0 \\ x>0\quad \quad f(x)=\ \ \ 1 \\$$

I would rather have a more formal proof than my guess. Could someone give me a tip on how I can prove this using Mathematica?

• In general, Mathematica does not generate formal proofs. Probably closest built-in Mma functionality gets to proving something in general sense is capability of generating counterexamples - but not finding counterexamples is not a formal proof, of course. – kirma May 13 '15 at 10:26
• Oh, maybe I formed my question in wrong way. I don't need exactly formal proof, but I just would like to make some calculations, how to show this discontinuity. For now I haven't idea how can I show that – adolzi May 13 '15 at 10:32
• My first suggestion would be finding a solution for x with Solve, looking for differing values of Limits of x from different Directions (1 and -1). This should be trivial, but I don't have Mathematica handy just now... – kirma May 13 '15 at 11:26
• Generaly I'm able to compute Limits from different Directions, but how can I prove that I should find around x=0? – adolzi May 13 '15 at 11:31
• $n^x = e^{(\ln n) x}$, and $(e^y - e^{-y})/(e^y + e^{-y}) = \tanh y$. So your function is just $\tanh( (\ln n) x)$. This, along with the fact that $\tanh(\pm \infty) = \pm 1$ and $\tanh(0) = 0$, should be enough to prove your assertions. – Michael Seifert May 13 '15 at 13:29

As requested, I'm expanding on my comment above, in which I noted that $$\frac{n^{x} - n^{-x}}{n^x + n^{-x}} = \tanh [ (\ln n) x]$$ If you want to coax Mathematica to show this for you, you have to be a little tricky. In particular, Mathematica will automatically evaluate Exp[Log[n] x] into n^x unless you tell it not to. However, if you Hold the expression, and apply the ExpToTrig function to it before you release the hold, you get the result above:

f[x] /. Power[n, x_] -> Exp[Hold[Log[n] x]]
ReleaseHold[ExpToTrig[%]]


Once you've done this, then Mathematica can handle the limits correctly:

Map[Limit[%, n -> Infinity, Assumptions -> #] &, {x > 0, x == 0, x < 0}]

(* {1, 0, -1} *)


I'm not sure this is a generally useful result—I had to kind of know where I was going in order to guide Mathematica there—but it's good to see that it can be done, at least.

• Thank you for writing this up! I have found that I sometimes struggle mightily to manipulate expressions in Mathematica, even in those cases where I knew where to go, so I always appreciate seeing how others do it! (+1) – MarcoB May 14 '15 at 14:37

Limit takes Assumptions

Clear[f]

f[x_] := Limit[(n^x - n^(-x))/(n^x + n^(-x)), n -> Infinity]

Assuming[{#}, f[x]] & /@ {x < 0, x == 0, x > 0}


{-1, 0, 1}

Plot[f[x], {x, -5, 5}, Exclusions -> 0,
Epilog -> {Red, AbsolutePointSize[6], Point[{0, f[0]}]}]