# Calculate the limit of the given function at $x=0$

Let $f(x)=x{\times}(-1)^{\left \lfloor \frac1x \right \rfloor}$. Calculate its limit at $x=0$. According to me the limit doesn't exist because if I take log on both sides of the equation, I get:- $$\ln f(x) = \ln x+\left \lfloor \frac1x \right \rfloor {\times} \ln(-1)$$

Here $\ln(-1)$ doesn't exist and hence no limit should exist.

-
You are using "laws of logarithms" where they do not apply. What is the exponent? –  André Nicolas Jun 24 '12 at 16:34
@AndréNicolas:- Please elaborate on your comment. Here $[\frac1x]$ is the exponent. So, I guess,I can use logarithm here. –  kusur Jun 24 '12 at 16:43
Don't use logarithms, the logarithm is often undefined, unless you go to complex numbers, and even there $\log$ behaves weirdly. Look directly at your function. The reason I think your exponent $[1/x]$ must be the greatest integer $\le 1/x$ is that for general real $y$, $(-1)^y$ is undefined. –  André Nicolas Jun 24 '12 at 16:47
so what you suggested was just to avoid confusion due to the presence of a negatuve number, right? This means that if there was some other postive number in place of -1, then I could have used logarithm? –  kusur Jun 24 '12 at 16:54
With positive numbers you can use logarithms freely. However, for limit questions, it is almost always a good idea if you look before starting to do algebraic manipulations. –  André Nicolas Jun 24 '12 at 16:58

Note that $\left\lfloor \dfrac1x \right\rfloor$ denotes the greatest integer less than or equals $\dfrac1x$. Hence, $(-1)^{\left\lfloor \dfrac1x \right\rfloor}$ makes sense since the power is always an integer. All you need for this proof is that $(-1)^{\left\lfloor \dfrac1x \right\rfloor}$ is either $1$ or $-1$. Hence, we have that $$-x \leq x \times (-1)^{\left\lfloor \dfrac1x \right\rfloor} \leq x$$ Hence, as $x \to 0$, we have that $$\lim_{x \to 0}-x \leq \lim_{x \to 0} x \times (-1)^{\left\lfloor \dfrac1x \right\rfloor} \leq \lim_{x \to 0} x$$ Hence, $$\lim_{x \to 0} x \times (-1)^{\left\lfloor \dfrac1x \right\rfloor} = 0$$

EDIT

Note that $\log(a^b) = b \log(a)$ is valid only when $a>0$ and $x \in \mathbb{R}$. Hence, it is incorrect to write $\log((-1)^b) = b \log(-1)$.

-
When $x$ approaches 0, $\frac1x$ approaches infinity. Then what can we say about $[\frac1x]$ ? You are claiming this to be 1 or -1. Why? –  kusur Jun 24 '12 at 16:46
@KunalSuri $\left\lfloor \dfrac1x \right\rfloor$ also $\to \infty$. But what we need here is that it is always an integer as it tends to $\infty$. I am claiming that $(-1)^{\left\lfloor \dfrac1x \right\rfloor}$ is $1$ or $-1$. I am not claiming $\left \lfloor \dfrac1x \right \rfloor$ to be 1 or -1. I am only claiming that $\left \lfloor \dfrac1x \right \rfloor$ is an integer. –  user17762 Jun 24 '12 at 16:48
Thanks. Its just like $cosx$ when $x\to \infty$. It oscillates between 1 and -1. Here the Greatest integer function doesn't oscillate but still it can hold either of the two values - 1 or -1. right? –  kusur Jun 24 '12 at 16:52
@KunalSuri Note that $\left\lfloor \dfrac1x \right\rfloor$ doesn't oscillate. what oscillates is $(-1)^{\left\lfloor \dfrac1x \right\rfloor}$. It takes only values $-1$ and $1$. –  user17762 Jun 24 '12 at 16:55
Couldn't we just say that $|f(x)|=|x{\times}(-1)^{\left \lfloor \frac1x \right \rfloor}|=|x|\to 0$ then $f(x)=x{\times}(-1)^{\left \lfloor \frac1x \right \rfloor}$ also $\to 0$?. This is of course only valid when the limit is $0$. –  palio Jun 24 '12 at 17:55