$ f(x)=\begin{cases}\sin x& \text{if $x$ is rational}\\{\cos x} &\text{if $x$ is irrational}\end{cases} $, finding continuous point Problem: Where the following function continuous?$$f(x)=\begin{cases}\sin {x}& \text{$x\in\mathbb Q$}\\ \cos{x} &\text{$x\notin\mathbb Q$}\end{cases} $$
We can predict that $f$ might be continuous at $x={\pi\over4}+k\pi$ where $k\in\mathbb Z$, and otherwise discontinuous. I want to prove this using $\epsilon-\delta$ argument. For example, at $x={\pi\over4}$, for example, it was difficult to express suitable $\delta$ to derive that $|f(x)-{1\over\sqrt2}|\lt\epsilon$.
I learned that it can be proven by using dirichlet $d(x)$, which is $$d(x)=\begin{cases}0&x\in\mathbb Q \\1&x\notin\mathbb Q\end{cases}$$
By setting $f(x):=\sin{x}+d(x)(\cos{x}-\sin{x})$ and $h(x):=\cos{x}-\sin{x}$. We are firstly going to focus on $d(x)h(x)$. 
If $h(a)=0$, then $d(x)h(x)$ is continuous at $a$ since $$\forall\epsilon\gt0, \exists\delta>0 s.t 0\lt|x-a|\lt\delta\implies |d(x)h(x)-d(a)h(a)|=|d(x)h(x)|\le|h(x)|\lt\epsilon$$
Note that $h$ is continuous.
If $h(a)\ne0$, we claim that $d(x)h(x)$ is discontinuous.
Suppose $d(x)h(x)$ is continuous, since $h(x)$ is also continuous, so is $d(x)=\frac{d(x)h(x)}{2}$. However, we can easily prove that $d(x)$ is discontinuous at every point, so it's contradiction" $d(x)h(x)$ is discontinuous.
When $h(x)=0$, $x={\pi\over4}+n\pi$; at such $x$, $f$ is continuous as we proved.
But, I do want to know the solution that does not use without dirichlet function. I tried it, but it was difficult to set up $delta$. Is there an exact way to solve this? 
Thanks very much.
NOTE I have to prove not only continuity at $x={\pi\over4}+k\pi$ but also discontinuity at other points!
NOTE I cannot use limits of sequence in the test, so I really want the solution with epsilon-delta arguements.
 A: $f$ is continuous at a point $p$ if and only if for every convergent sequence $p_n$ such that $\lim p_n = p$, $\lim f(p_n) = f(p)$. Now we can approach a point $p$ by both rational sequences and irrational sequences. So given $p$, there is a rational sequence $p'_n$ and an irrational sequence $p_n''$ both of which converge to $p$. So if $f$ is continuous $p$, then $f(p) = \lim f(p_n') = \lim f(p_n'')$. But by definition this is the same as $f(p) = \lim \sin(p'_n) = \lim \cos(p_n'')$. But since $\cos$ and $\sin$ are continuous functions, this boils down to $f(p) = \cos(p) = \sin(p)$. So $f$ is continuous at those points $p$ where $\cos(p) = \sin(p)$.
A: Attempt
MVT:
$|\sin x-\sin π/4| \lt |x-π/4|$;
$|\cos x - \cos π/4| \lt |x-π/4|$.
Thus
$|f(x)-1/√2| \lt |x-π/4|$;
Let $\epsilon >0$ be given.
Choose $\delta=\epsilon$.
Then
$|x-π/4| \lt \delta$ implies
$|f(x)-1/√2| \lt |x-π/4| \lt \delta =\epsilon$.
Used:
$\dfrac{f(x)-f(a)}{x-a}=f'(t)$, where $t \in (a,x)$ for $x >a$, and $t \in (x,a)$ for $x <a$.
A: Sin x and cos x are continuous everywhere. 
If you use any rule where f(x) is either sin x or cos x, then f is continuous in every point where sin x = cos x. Which is at (n + 1/4)pi. 
A: To find the $\delta$ you better use the fact that
$$|\sin(x+\pi/4) - \cos(x+\pi/4)| = 2 \sqrt{2}|\sin(x)|$$
And note that for $|x|<\pi/4$
$$\|f(x+\pi/4)-\sqrt{2}\| \le \max \{ |\sin(x+\pi/4)-\sqrt{2}|, |\cos(x+\pi/4)- \sqrt{2}|\} \le$$
$$\le |\sin(x+\pi/4) - \cos(x+\pi/4)| = 2 \sqrt{2}|\sin(x)| < 2\sqrt{2}|x|$$
So if you take $\delta = \varepsilon 2^{-3/2}$ it should be fine. 
A: $f(x) = f((x-\frac {\pi}{4}) + \frac \pi4) = \begin{cases} \frac {\sqrt 2}2 \sin (x-\frac \pi4)+\frac {\sqrt 2}2 \cos (x-\frac \pi4) & x\in \mathbb Q\\\frac {\sqrt 2}2 \cos (x-\frac \pi4)-\frac {\sqrt 2}2 \sin (x-\frac \pi4) & x\notin \mathbb Q\end{cases}$
Note that $|\sin x| \le x$
$|x-\frac {\pi}4|<\delta \implies \frac {\sqrt 2}{2}\cos x - \frac {\sqrt 2}{2}\delta \le f(x) \le \frac {\sqrt 2}{2}\cos x + \frac {\sqrt 2}{2}\delta$
