# We can define the derivative of a function whose domain is a subset of rational numbers?

Usually the derivative is defined for a function $f:A\to \mathbb{R}$ where $A \subset \mathbb{R}$, and the usual definition of the derivative at a point $a$ require the existence of an open neighborhood of $a$ where the function is defined.

So, if $A\subset \mathbb{Q}$ it seems that we cannot define a derivative, since $A$ is totally disconnected.

But the definition

$$f'(a)=\lim_{h \to 0}\dfrac{f(a+h)-f(a)}{h}$$

require only the existence of the limit that, with the $\epsilon -\delta$ definition, can be found using only rational values of $h$.

So it seams that a ''derivative'' can be defined. Or there is something that does not works?

This question is suggested by Clarification if a disconnected function has a derivative at defined points. , where the OP asks for the derivability of the function $$f:\{x=\dfrac{n}{2k+1} | n,k \in \mathbb{Z}\} \to \mathbb{R} \quad;\quad f(x)=(-2)^x$$

• The derivative can be defined, using the normal definition you exhibit but with $h$ constrained to $\mathbb{Q}$; however, the limit may exist as a real but but might be irrational. So it's maybe a not very fruitful notion. – BrianO Oct 30 '15 at 17:35
• Well, so the function that I've added is a differentiable function? This sound strange to me.... – Emilio Novati Oct 30 '15 at 17:45
• Frankly, it sounds strange to me too. The function exhibited is real-valued ($f(\frac 1 3) = (-2)^{\frac 1 3}$) not rational-valued, never mind its odd domain. As I said, the definition makes sense, but it's... not much fun to work with. – BrianO Oct 30 '15 at 17:53
• @Arbuja Of course. The log function can be defined in the whole complex plane minus a ray. Find the details in any complex analysis textbook. Pick your favorite value for log(-2) and get an analytic continuation. – AlgRev Nov 17 '15 at 0:15
• Of course you can define it. Whether you call such a function "differentiable" is entirely a matter of taste; you should call it whatever you find it useful to call it, as long as you explain your definitions to others. – Eric Wofsey Nov 17 '15 at 5:05

## 2 Answers

There's no reason that a derivative couldn't be defined on such a set like $\mathbb Q$. As you note, the limit $$\lim_{h\rightarrow 0}\frac{f(a+h)-f(h)}{h}$$ may still be calculated even if $a+h$ is restricted to only rational values.

I think it's worth noting that the fact that $\mathbb Q$ is totally disconnected might give the wrong impression. The above definition only fails when fed isolated points - that is points with no other points in the domain in an open neighborhood. In the language of topology, we could say points such that $\{x\}$ is open in the domain of the function. Whether or not the domain is connected it somewhat irrelevant. So, you can't use this definition of for a function defined only on $\mathbb Z$ where every point is isolated. But it works fine on any dense subset of $\mathbb R$, like $\mathbb Q$. Another similar thing to think about is that not all function $f:\mathbb Q\rightarrow\mathbb R$ are continuous, despite $\mathbb Q$ being totally disconnected.

We might avoid using such a derivative as one might notice that a lot of theorems (e.g. the fundamental theorem of calculus) really do need conditions like "$f:\mathbb R\rightarrow\mathbb R$ is everywhere differentiable" which can't be replaced by $f:A\rightarrow\mathbb R$ being differentiable everywhere in its domain.

• @EricWofsey Whoops; I should know better than that. I have removed the incorrect material. – Milo Brandt Nov 18 '15 at 4:02
• I still think its a good idea to look into these area regardless of the issues it brings to other theorems. Besides it further shows that mathematical theorems, in general, can't apply to all equations. – Arbuja Nov 18 '15 at 13:40
• @MiloBrandt: Thank you for the answer (+1). What sound strange to me is the fact that a differentiable function is also continuous. So, as an example, the Dirichlet function, usually cited as example of nowhere continuous function, becomes a continuous and differentiable function if its domain is restricted to the rational numbers. I have never seen such a thing in any book o any place! – Emilio Novati Nov 18 '15 at 14:10
• @EmilioNovati Well, over $\mathbb Q$, the Dirichlet function is a constant function $1$ - so we've forgotten everything bad about it. More concerning are functions like $$f(x)=\begin{cases}0&\text{if }x<\sqrt{2}\\1&\text{if }x>\sqrt{2}\end{cases}$$ becomes differentiable and continuous, but can't be extended even continuously to $\mathbb R$. I'd imagine you can come up with worse behaved examples than that. There's also functions like this where a dense domain can be chosen where the derivative is always $0$, yet the function isn't constant. – Milo Brandt Nov 18 '15 at 14:41
• @Arbuja No, you can't. Being real is an intrinsic property of a number, and the derivative $(-1)^x2^x(\pi i + \log(2))$ that you list is, in general, not real. No amount of simplification will change this. Moreover, the number $(-2)^x$ is complex as you define it (it sweeps a spiral in the complex plane) so we would expect its change over time to be real. – Milo Brandt Nov 19 '15 at 21:15

This is not an answer but this could lead to an answer

Taking the definition of a limit.... $\lim_{h\to0}\frac{f(x+h)-f(x)}{h}$

I found that there can be a derivative of $(-2)^x$ but only if $h\to0$ in a way that the numerator is even and the denominator is odd (even/odd). Such as $h\to\frac{2}{5}\to\frac{2}{101}\to\frac{2}{1000001}\to0$.

This is because using odd numerators and denominators (odd/odd) will result in the derivative diverging to $\infty$.

This is because for $(-2)^x$ the output is negative when x is (odd/odd) or positive when x is (even/odd).

For example $(-2)^{-1/15}=-.954841$ and $(-2)^{12/71}=1.124289$, which means. $$(-2)^x=\begin{cases} 2^x & s=\left\{ {2n\over 2m+1}\ |\ n, m \in \Bbb Z\right\}\frac{\text{even integer}}{\text{odd integer}}\\ -\left(2^x\right) & s=\left\{ {2n+1\over 2m+1}\ |\ n, m \in \Bbb Z\right\}\frac{\text{odd integer}}{\text{odd integer}}\ \\ \text{undefined} & s=\left\{ {2n+1\over 2m}\ |\ n, m \in \Bbb Z\right\}\frac{\text{odd integer}}{\text{even integer}} \end{cases}$$

So then when we apply the formal definition of $\lim_{h\to0}\frac{f(x+h)-f(x)}{h}$ where $f(x)=\left({-2}\right)^{x}$ $$\lim_{h\to0}\frac{(-2)^{x+h}-(-2)^x}{h}$$

First if $h=\text{odd}/\text{even}$ such as $1/2$ and we take $x$ as $odd/odd$ or $x=1/3$ then $f(x)$ is already undefined. This means the entire limit is undefined. Now to get $f(x+h)$ we must get $x+h$ which is $5/6$ which means $f(x+h)$ is also undefined whenver $h$=odd/even. Thus...

$$\lim_{h\to0}\frac{(-2)^{x+h}-(-2)^x}{h}=\lim_{h\to0}\frac{-2^{x+h}-2^x}{h}$$ $$\lim_{h\to0}\frac{(-2)^{x+h}-(-2)^x}{h}=\lim_{h\to0}\frac{\text{undefined}-\text{undefined}}{h}$$ $$\text{Limit does not exist}$$

Now if $h=\text{odd}/\text{odd}$ for example $h=1/3$ and let $x$ be (even/odd) fraction like $x=2/3$. So $f(x)=\left({2^x}\right)$; however $x+h=1$. This shows under these conditions $x+h$ will always be (odd/odd) and thus $f(x+h)=-\left(2^{x+h}\right)$

So then when x is odd/odd the limit will be $$\lim_{h\to0}\frac{(-2)^{x+h}-(-2)^x}{h}=\lim_{h\to0}\frac{-2^{x+h}-2^x}{h}$$
$$\lim_{h\to0}\frac{\left(\left({-{2}^{h}-1}\right)*{{2}^{x}}\right)}{h}\approx$$ $$\lim_{h\to0}\frac{-2\left(2\right)^{x}}{h}=$$ $$\lim_{h\to{0}}\frac{1}{h}*{-2\left(2\right)^{x}}$$ Now since$-2({2})^x$ is always postive we have to analyze $\lim_{h\to0}\frac{1}{h}$. Since that part of the limit does not exist there is no derivative.

$$\text{Limit Does Not Exist}$$

If $h=\text{odd}/\text{odd}$ for example $h=1/3$ but $x$ is (odd/odd) fraction like $x=1/5$. So $f(x)=-\left(2^x\right)$; however, $x+h=\frac{8}{15}$. This shows that under these conditions $x+h$ is always (even/odd) so $f(x+h)=2^{x+h}$. $$\lim_{h\to0}\frac{(-2)^{x+h}-(-2)^x}{h}=\lim_{h\to0}\frac{2^{x+h}+2^x}{h}$$ $$\lim_{h\to0}\frac{\left(2^{h}+1\right)\left({2^x}\right)}{h}\approx$$ $$\lim_{h\to0}\frac{2\left({2}^{x}\right)}{h}=$$ $$\lim_{h\to0}\frac{1}{h}*2\left({2}^{x}\right)$$

Since $2\left({2}\right)^{x}$ is always positive but also has $\lim_{h\to0}\frac{1}{h}$ with a limit that does not exist there no derivative.

$$\text{Limit Does Not Exist}$$

But if $h=\text{even}/\text{odd}=2/3$ and $x=\text{odd}/{\text{odd}}=1/3$ then $f(x)=-\left(2^x\right)$. Since $x+h=3/3$, under these conditions, $x+h$ is always (odd/odd) and so $f(x+h)=-\left(2^{x+h}\right)$. $$\lim_{h\to0}\frac{(-2)^{x+h}-(-2)^x}{h}=\lim_{h\to0}\frac{-2^{x+h}+2^{x}}{h}=-\ln{(2)}{2^{x}}\to\text{For x=odd/odd}$$

And if $h=\text{even}/\text{odd}=2/3$ and $x=\text{even}/{\text{odd}}=2/3$ then $f(x)=2^x$. Since $x+h=4/3$, under these conditions, $x+h$ is always (even/odd) and thus $f(x+h)=2^{x+h}$. $$\lim_{h\to0}\frac{(-2)^{x+h}-(-2)^x}{h}=\lim_{h\to0}\frac{2^{x+h}-2^x}{h}=\ln{(2)}{2^x}\to\text{For x=even/odd}$$

$$\frac{d}{dx}(-2)^x=\begin{cases} \ln(2)2^x & s=\left\{ {2n\over 2m+1}\ |\ n, m \in \Bbb Z\right\}\frac{\text{even integer}}{\text{odd integer}}\\ -\ln(2)2^x & s=\left\{ {2n+1\over 2m+1}\ |\ n, m \in \Bbb Z\right\}\frac{\text{odd integer}}{\text{odd integer}}\end{cases}=\text{Limit does not exist}$$

According to what I have heard from mathematicians it is possible to define a derivative at cluster points. However for the defined cluster points of each group must have the same limit.

Take $\lim_{x\to\infty}\left({-1}^{x}\right)$ for example. It ossilates between $-1,1,-1,1$ and cannot exist. If I choose (even/odd) for $x\to\infty$ ($2/3\to2000/3\to200000/3$) then the only get $1$ but if I choose (odd/odd) for $x\to\infty$ ($1/3\to10/3\to10000/3$) then I only get $-1$. Thus all sequences for defined intervals of values that approaches some value must have the same limit.

Thus for $\left({-2}\right)^{x}$ the derivative must not exist. However if we instead took $|\left({-2}\right)^{x}|$ then the derivative would be $\ln{\left(2\right)}|\left(-2\right)^{x}|$. Infact when you put the absolute value the derivative satisfies the mean value theorem and rolles theorem.

• this answer makes no sense to me. First thing, in the definition of derivative, you need $\lim_{h\to0}$, not $\lim_{x\to0}$. Next I do not see how you get that $\infty$ or $-\infty$ as the values of the limit. Don't know if this could make an "official" answer, being posted it is official, I would say, but it does not seem clear or correct. Also, you copied the same answer you made to another question, don't even see how it is relevant here. The function $f(x)=x\sin\dfrac1x$ for $x\not=0$, $f(0)=0$ is not differentiable at $0$ even if the limit exists picking a suitable sequence of $x$'s – Mirko Nov 18 '15 at 1:52
• @Mikro $x\sin{\left(\frac{1}{x}\right)}$ is undefined at x=0 but $\left({-2}\right)^{x}$ is undefined for $x=\frac{m}{2k}$ where $m$ and $2k$ are integers. For example, $x=\frac{1}{2}$, $\frac{1}{20}$, \frac{3}{42}. – Arbuja Nov 18 '15 at 2:40
• The mere fact that $x\sin\dfrac1x$ is undefined at $0$ does not make the function $f$ from my previous comment undefined, we have $f(0)=0$ as specified there. I would suggest you think things over more carefully. – Mirko Nov 18 '15 at 3:28
• I am still editing. Why did I get -1. I was only trying to help one find the answer. – Arbuja Nov 18 '15 at 12:51
• Arbuja, I do not see any such comment here made by @MiloBrandt Also, I do not see why you expect him/her to spend time to decide whether what you or I say makes sense. If you are in doubt that what you say makes sense, then go over it more carefully. I already have provided plenty of detailed comments. Math truth is not about voting, and how many people say what is right, you ought to be able to convince yourself, once given enough hints, without bugging others over and over. – Mirko Nov 24 '15 at 15:22