# If $f(x)=\sin(x)$, when $x$ is rational and $f(x)=\cos(x)$, when $x$ is irrational, will it be continuous at $x=n \pi+\frac{\pi}{4}$

Here $$n$$ is any integer. This is my attempt at solving the question:

Since $$n \pi+\frac{\pi}{4}$$ is irational, $$f(x)=\cos(x)$$. Let $$h$$ be a infinitesimally small positive quantity and $$n=1$$ $$RHL=\lim\limits_{h\rightarrow0}f\left(\frac{\pi}{4}+h\right)$$ $$LHL=\lim\limits_{h\rightarrow0}f\left(\frac{\pi}{4}-h\right)$$

This is where my confusion begins, if we assume $$h$$ to be an infinitesimally small irrational number in the first case and infinitesimally small rational number in the second case then the function will be discontinuous.

If we assume $$h$$ to be an infinitesimally small rational number in the first case and infinitesimally small rational number in the second case then the function will be continuous.

However If we assume $$h$$ to be an infinitesimally small irrational number in the first case and infinitesimally small irrational number in the second case then the function will be discontinuous. So how can a function like this exist, and where am I going wrong?

• $n\pi +\frac \pi 4$ is rational? How's that?
– Alan
Aug 3, 2021 at 13:07
• Hint: angle-addition. Aug 3, 2021 at 13:13
• There are no infinitesimally small real numbers. Aug 3, 2021 at 14:25
• No there is no limitation to the lhl/rhl method. My objection is related to the notion of infinitesimals as used in your question. There is a way to learn / develop calculus using infinitesimals, but a majority of courses and textbooks don't use it. So the more popular version is the one without any infinitesimals. Aug 4, 2021 at 15:51
• I don't use infinitesimals. There is no difference between lhl and rhl here. Depending on whether $(\pi/4)+h$ is rational or irrational the limit should equal $\lim_{h\to 0}\sin(\pi/4+h)$ or $\lim_{h\to 0}\cos(\pi/4+h)$ and both these are equal as $\cos\pi/4=\sin\pi/4$. Same happens with left hand limit (replace $h$ with $-h$). The function will be continuous at only those points $c$ where $\cos c=\sin c$. Aug 5, 2021 at 6:16

Since the point $$n\pi+(\pi/4)$$ under consideration, say $$a$$, is irrational we have $$f(a) =\cos a$$ and thus $$|f(x) - f(a) |=|\sin x - \cos a|=|\sin x - \sin a|$$ as $$\cos a =\sin a$$ when $$x$$ is rational and $$|f(x) - f(a) |=|\cos x-\cos a|$$ if $$x$$ is irrational.

Now observe that both the differences $$|\sin x-\sin a|$$ and $$|\cos x - \cos a|$$ never exceed $$|x-a|$$. Why??

Well, $$|\sin x - \sin a|=|2\cos((x+a)/2)\sin((x-a)/2)|\leq 2|(x-a)/2|=|x-a|$$ and similarly one can handle the other difference.

Hence $$0\leq |f(x) - f(a) |\leq |x-a|$$ If you are aware of definition of limit then the above inequality allows you to take $$\delta =\epsilon$$ and show that $$\lim_{x\to a} f(x) =f(a)$$.

On the other hand if you are not aware of definition of limit you can use Squeeze theorem to conclude $$\lim_{x\to a} f(x) =f(a)$$. And therefore the function is continuous at all points $$a$$ of the form $$a=n\pi+(\pi/4)$$.

• How did you get the inequality $|2cos((x+a)/2)sin((x-a)/2)|<(x-a)$ Aug 4, 2021 at 8:32
• @Sunaina: remember that both $\sin, \cos$ don't exceed $1$ in absolute value and hence we can get rid of $\cos ((x+a) /2)$. The expression is thus $\leq 2|\sin((x-a)/2)|$. Next use the fundamental inequality of $\sin x$ namely $|\sin x|\leq |x|$ for all real $x$ (this does not hold for $\cos$). Hence we get the expression $\leq 2|(x-a)/2|=|x-a|$. Aug 4, 2021 at 8:37
• @Sunaina: you should remember the basic inequalities satisfied by common functions. They are quite useful in calculus. For example $\log x\leq x - 1$ for all positive $x$ and $e^x\geq 1+x$ for all $x$. Aug 4, 2021 at 8:38
• Is continuity a requirement for the squeeze theorem to be applied, or does the successful application of squeeze theorem show that the function is continuous. I.e is finding a limit using squeeze theorem enough to prove the function is continuous? Aug 4, 2021 at 8:46
• @Sunaina: squeeze theorem is a tool to find limits in certain situations. It has nothing to do with continuity. Applying squeeze theorem in my answer gives you $\lim_{x\to a} |f(x) - f(a) |=0$ and this implies $\lim_{x\to a} (f(x) - f(a)) =0$ and this implies $\lim_{x\to a} f(x) =f(a)$ which finally means (by definition) that $f$ is continuous at $a$. Aug 4, 2021 at 8:49

Let $$x_n = n \pi + \frac{\pi}4$$. Note that $$\sin x_n = \cos x_n=\frac{(-1)^n}{\sqrt 2} = f( x_n).\tag{1}\label{1}$$ So, intuitively, if you get close enough to $$x_n$$ the function will approach the value $$\frac{(-1)^n}{\sqrt 2}$$.

More formally, fix $$\varepsilon > 0$$. Since $$\sin x$$ is continuous in in $$x_n$$, there exists $$\delta_1$$ such that $$\left|\sin x - \frac{(-1)^n}{\sqrt 2}\right| < \varepsilon$$ for all $$x$$ such that $$|x - x_n| < \delta_1$$. Similarly, by continuity of $$\cos x$$ in $$x_n$$, there exists $$\delta_2$$ such that $$\left|\cos x - \frac{(-1)^n}{\sqrt 2}\right|< \varepsilon$$ for all $$x$$ such that $$|x - x_n| < \delta_2$$.

Now choose $$\delta = \min(\delta_1,\delta_2)$$ and you get $$\left| f(x) - \frac{(-1)^n}{\sqrt 2}\right| < \varepsilon$$ for every $$x$$ that satisfies $$|x-x_n| < \delta,$$ which implies, together with \eqref{1}, continuity of $$f$$ in $$x_n$$.

• Thank you but I have some questions. What does $\delta$ and $\varepsilon$ mean here? What do you mean by fixing the value? Aug 3, 2021 at 13:40
• Are you familiar with the definition of limit? E.g. brilliant.org/wiki/epsilon-delta-definition-of-a-limit
– dfnu
Aug 3, 2021 at 13:44
• so can we say directly for any function l(x) which is f(x) at some points at p(x) and other points that if both f(x) and p(x) are continuous and converge at a point x, l(x) will also be continuous at x? Aug 5, 2021 at 4:33
• @Sunaina yes you can say that
– dfnu
Aug 5, 2021 at 6:50