Proving that $g(x)$ defined as $x^2$ on the rationals and $x^4$ on irrationals, is discontinuous at $2$ Define $g: \mathbb{R} \to \mathbb{R}$ by $$g(x) =\begin{cases} x^2 & \text{if } x \text{ is rational}, \\\\ x^4 & \text{if } x \text{ is irrational}. \end{cases}$$ Prove that $g$ is discontinuous at $x = 2$.
Solution Attempt:
Assume instead that $g$ is continuous at 2.  Then since $g(2)= 4$, $\;\;\displaystyle \lim_{x\to2}g(x)=4$;
so taking $\epsilon=1$, there is a $\delta>0$ such that if $0<|x-2|<\delta$, then $\big|g(x)-4\big|<1$.
Therefore if $x$ is irrational and $2-\delta<x<2$, then 
 $\big|x^4-4\big|<1$
$-1 <x^4-4<1\implies 3<x^4<5\implies x^4>3 \implies x = 3^\frac{1}{4} \implies x < 2$ Contradiction
 A: Rather than $x^4 > 3$, instead conclude that $x^4 < 5$, or equivalently,
$$-\sqrt[4]{5} < x < \sqrt[4]{5}.$$
If you had chosen instead an irrational $x$ such that
$$2 - \min\{\delta, 2 - \sqrt[4]{5}\} < x < 2,$$
then you'd have $x > 2 - (2 - \sqrt[4]{5}) = \sqrt[4]{5}$, a contradiction.
A: I think a simpe way is to construct two sequences $a_n$ and $b_n$, where $a_n$ are rational and $b_n$ are irrational, such that $\lim_{n\to\infty}g(a_n)=2^2$ and $\lim_{n\to\infty}g(b_n)=2^4$. 
Then we can say $\lim_{x\to2^+}g(x)$ does not exist. Hence $g$ is discontinuous at $x=2$.

Put $a_n = 2 + \frac{1}{n}$ and $b_n=2+\frac{\pi}{n}$.

A: An option?
Sequential definition of continuity .
$x_n=2(4n)^{(1/(4n))}.$
$\lim_{n  \rightarrow \infty}x_n=2.$
$\lim_{n \rightarrow \infty}g(x_n)=$
$\lim_{n \rightarrow \infty} 2^4(4n)^{(1/n)}=$
$\lim_{n \rightarrow \infty}2^4 \cdot 4^{(1/n)} \cdot n^{(1/n)}=$
$=2^4 \not =g(2)$.
A: You haven't reached a contradiction, as commented...but the general idea is correct. Try this, instead: take
$$\left\{a_n:=2\pi\frac n{\pi n+1}\right\}_{n\in\Bbb N}$$
Observe the above sequence is irrational:
$$a_n\notin\Bbb Q\implies g(a_n)=a_n^4\,,\,\,\text{so}\;\;\lim_{n\to\infty}g(a_n)=\lim_{n\to\infty}16\pi^4\frac{n^4}{(n\pi+1)^4}=16\pi^4\frac1{\pi^4}=16$$
yet $\;g(2)=2^2=4\;$ , so the function is not continuous at $\;2\;$ ...
