Two questions regarding continuity I have two problems, I think I got one but I'm not sure and I'm stuck in the other one, could you help me? here they are:
1.- Let a function $f:\mathbb{R}^2\longrightarrow\mathbb{R}$ be defined by:
$
f(x,y)=\begin{cases}[x]y - 1 &\mbox{if }y \in \mathbb{Q} , \\ 0 &\mbox{if }y \in \mathbb{R} \backslash \mathbb{Q},\end{cases}
$
([x] denotes the nearest integer function)
Find the set where the function is continuous.
My solution for this one:
Let's find out the continuity of the function at an arbitrary rational point $y$ and then do the same for an irrational one. 
Consider $y \in \mathbb{Q}$ and one sequence of irrational numbers $\{y_n\}$ which converges to $y$ and another sequence $\{x_n\}$ which converges to $x$. Now $\{ f(x_n,y_n) \}$ converges to $0$ and $f(x,y) = [x]y-1$. Similarly for the case when $y$ is irrational we have that $\{ f(x_n,y_n) \}$ converges to $[x]y-1$ and $f(x,y) = 0$.
Thus $f$ is continuous if $[x]y-1 = 0$ therefore we have that $f$ is continuous at $\{ (1,1) , (-1,-1) \}$.
2.- Let $D=\{x \in \mathbb{R}^n : \|x\| < 1\}$ and $D_1=\{x \in \mathbb{R}^n : \|x\| \le 1\}$. Prove that a function $f:D \longrightarrow \mathbb{R}^m$ can be extended to a continuous function on $D_1$ if and only if $f$ is uniformly continuous.
My solution:
Assume that $f$ can be extended to a continuous function on $D_1$, since $D_1$ is compact and $f$ is continuous then $f$ is uniformly continuous on $D_1$, in particular it's continuous on $D$.
And I can find where to start to prove the converse, could you give me some hints?
 A: For the first question, let $(x,y)\in\mathbb{R}^2$, and suppose that $f$ is continuous at $(x,y)$. Let $\langle y_n:n\in\mathbb{N}\rangle$ be a sequence of irrational numbers converging to $y$. Then $f(x,y_n)=0$ for every $n\in\mathbb{N}$, and $\langle (x,y_n):n\in\mathbb{N}\rangle$ converges to $(x,y)$, so we must have $f(x,y)=0$. If we let $Z=\{(x,y)\in\mathbb{R}^2:f(x,y)=0\}$ and denote by $C$ the set of points at which $f$ is continuous, we’ve just shown that $C\subseteq Z$.
It would be nice if it were true that $C=Z$, but it isn’t. Suppose that $(x,y)\in Z$, i.e., that $f(x,y)=0$. Let $\langle (x_n,y_n):n\in\mathbb{N}\rangle$ be a sequence of points of $\mathbb{R}^2$ converging to $(x,y)$ such that $y_n\in\mathbb{Q}$ for each $n\in\mathbb{N}$, so that $f(x_n,y_n)=[x_n]y_n-1$ for each $n\in\mathbb{N}$. To keep things simple, assume for the moment that $x$ is not midway between two consecutive integers; then $[x_n]=[x]$ for all sufficiently large $n$, and hence $f(x_n,y_n)=[x]y_n-1$ for all sufficiently large $n$. Thus, $$\lim_{n\to\infty}f(x_n,y_n)=\lim_{n\to\infty}\big([x]y_n-1\big)=[x]\lim_{n\to\infty}y_n-1=[x]y-1\;,$$ and $f$ cannot be continuous at $(x,y)$ unless $[x]y=1$, i.e., $y=[x]^{-1}$.
Now suppose that $x=m+\frac12$ for some integer $m$, so that $[x]$ is either $m$ or $m+1$. Suppose that $[x]=m$. If we choose the $x_n$ so that they are all greater than $x$, then $f(x_n,y_n)=$  $(m+1)y_n-1$ for all sufficiently large $n$, and $\langle f(x_n,y_n):n\in\mathbb{N}\rangle\to (m+1)y-1$. If, on the other hand, we choose the $x_n$ so that they are all less than $x$, then $f(x_n,y_n)=my_n-1$ for all sufficiently large $n$, and $\langle f(x_n,y_n):n\in\mathbb{N}\rangle\to my-1$. Thus, $f$ cannot be continuous at $(x,y)$: $y$ would have to be simultaneously $m^{-1}$ and $(m+1)^{-1}$.
At this point we’ve shown that if $(x,y)\in C$, it must be the case that $x$ is not of the form $m+\frac12$ for any integer $m$, and it must also be the case that $y=[x]^{-1}$. This means that there must be a non-zero integer $m$ such that $$x\in\left(m-\frac12,m+\frac12\right)\text{ and }y=\frac1m\;.\tag{1}$$ In other words, $$C\subseteq \bigcup_{\substack{m\in\mathbb{Z}\\m\ne 0}}\left(\left(m-\frac12,m+\frac12\right)\times\left\{\frac1m\right\}\right)\;.\tag{2}$$
To show that $(2)$ is actually an equality, you have to show that whenever $x,y$, and $m$ satisfy $(1)$, $f$ really is continuous at $(x,y)$: no matter how a sequence $\langle (x_n,y_n):n\in\mathbb{N}\rangle$ approaches $(x,y)$, $\langle f(x_n,y_n):n\in\mathbb{N}\rangle$ converges to $f(x,y)=0$.
For the second question, suppose that $f$ is not uniformly continuous. Then there is a ‘bad’ $\epsilon>0$ such that for each $n\in\mathbb{N}$ there are points $x_n,y_n\in D$ such that $\|x_n-y_n\|<2^{-n}$ but $\|f(x_n)-f(y_n)\|\ge\epsilon$. The sequence $\langle x_n:n\in\mathbb{N}\rangle$ is bounded, so it has a convergent subsequence $\langle x_{n_k}:k\in\mathbb{N}\rangle$, with limit $x$, say. Now consider the sequence $\langle y_{n_k}:k\in\mathbb{N}\rangle$; can you see how to finish it from here?
