Equality on functions in $ \mathbb{R}^n $ Let $ f,g : M \subset \mathbb{R}^p \to \mathbb{R}^q $ continuous. Given $ a \in M $, supose that all open ball centered in $a$ contains a point $x$ such as $f(x) = g(x) $. Show that $ f(a) = g(a) $. Use this to show that if $f,g$ are  continuous real functions and $ f(x) = g(x) $ for all $x \in \mathbb{Q}$  then $ f \equiv g $.
Demonstration:
Since $f,g$ are continuous  $ x \in B(a,\delta) \implies f(x) \in B (f(a),\epsilon) $ and $ x \in B(a,\delta) \implies g(x) \in B (g(a),\epsilon) $ (in this case I'm already considering minimum delta that satisfies this). By the global continuity we have $ A = M \cap f^{-1}(B(f(a), \epsilon) $ and $ B = M \cap g^{-1} (B ( g(a), \epsilon ) $.
Supose that for all $ x \in B(a,\delta) $ we find a $f(x)  \in B(f(a),\epsilon)$ and $ g(x) \in B(g(a),\epsilon ) $ such as $f(x) =  g(x)$. Since they are open balls and continuous we have a neigborhood in $f(a)$ (and also in $g(a)$ ) such as all points on image are equal in particular $ f(a) = g(a) $.
My question is:
That proves the first proposition? 
Why there is need to restrict the second statement to rationals only? Isn't it valid to all reals? (can we find a counter example?) How can we prove this? (i could not find any way besides saying that is valid for all real function therefore is valid to rationals.
 A: I will assume that you meant $f(x) = g(a)$ as a hypothesis in the second line, instead of $f(x) = f(a)$, otherwise I don't think it will work.
Comments:

Since $f,g$ are continuous $x∈B(a,δ)⟹f(x)∈B(f(a),ϵ)$ and $x∈B(a,δ)⟹g(x)∈B(g(a),ϵ)$ (in this case I'm already considering minimum delta that satisfies this).

This is correct. However, I do recomend having the patience to write "Let $\epsilon > 0$. Then exists $\delta > 0$ such that...", that is, quantifying everything. This way you don't risk losing yourself in so many letters and variables.

By the global continuity we have $A=M∩f^{−1}(B(f(a),ϵ)$ and $B=M∩g^{−1}(B(g(a),ϵ)$.

What are $A$ and $B$? Are you defining them now? Are you going to use them later?

Supose that for all $x∈B(a,δ)$ we find a $f(x)∈B(f(a),ϵ)$ and $g(x)∈B(g(a),ϵ)$ such as $f(x)=g(x)$. 

The only thing you could say is that we have $x \in B(a,\delta)$ such that $f(x) = g(a)$. We won't need to use $g(x)$ anywhere in this proof.

Since they are open balls and continuous we have a neigborhood in $f(a)$ (and also in $g(a)$ ) such as all points on image are equal in particular $f(a)=g(a)$.

I don't see how this follows from your previous work. I mean, these balls could be disjoint, for all I know.
An easier proof:
If I want to prove that $f(a)=g(a)$, I want to prove that ${\rm d}(f(a),g(a)) = 0$, right? Try to translate everything in terms of $\Bbb R$, usually it will make your life easier. And if ${\rm d}(f(a),g(a)) < \epsilon$ for all $\epsilon > 0$, then ${\rm d}(f(a),g(a)) = 0$, it is a basic result from analysis.
Then let $\epsilon > 0$. By continuity, there exists $\delta > 0$ such that ${\rm d}(f(x),f(a)) < \epsilon$ for all $x \in B(a,\delta)$. Now, by our hypothesis, there exists a special element there, $x_0$, such that $f(x_0) = g(a)$. Then: $${\rm d}(f(a),g(a)) \leq \color{red}{{\rm d}(f(a),f(x_0))}+{\rm d}(\color{blue}{f(x_0)},g(a)) < \color{red}{\epsilon}+{\rm d}(\color{blue}{g(a)},g(a)) = \epsilon.$$
This way we conclude that ${\rm d}(f(a),g(a) )=0$. 
After the edit: Let $\epsilon > 0$. Take $\delta > 0$ small enough so that ${\rm d}(f(x),g(x)) < \epsilon/2$ and ${\rm d}(g(x),g(a)) < \epsilon/2$, for all $x \in B(a,\delta)$. Now, take the special $x_0 \in B(a, \delta)$ which satisfies $f(x_0) = g(x_0)$. So: $${\rm d}(f(a),g(a)) \leq {\rm d}(f(a),f(x_0))+\require{cancel} \cancelto{0}{{\rm d}(f(x_0),g(x_0))}+{\rm d}(g(x_0),g(a))<\frac{\epsilon}{2}+\frac{\epsilon}{2}=\epsilon.$$
The second part is a strightforward application of this result. If you manage to understand my proof, you will manage to write this second part neatly (nevertheless, I can give one more hand if you need it).

Let's learn more!
In the same way we did in your other question later, let's state and prove a result for metric spaces (you did noticed that my work above goes for arbitrary metric spaces, right?). Let $M,N$ be metric spaces.

Lemma: Let $f,g:M \to N$ be continous functions. Then $F = \{x\in M \mid f(x) = g(x)  \}$ is closed in $M$.

Proof: I'll give two proofs:


*

*Define $\phi: M \to \Bbb R_{\geq 0}$ by $\phi(x) = {\rm d}(f(x),g(x))$. Then $\phi$ is continuous because ${\rm d},f$ and $g$ are. Notice that $F = \phi^{-1}(\{0\})$ is the inverse image of a closed set by a continuous function, hence closed.

*Take a sequence $(p_n)_{n \in \Bbb Z_{>0}}$ such that $p_n \to p\in M$. So $f(p_n) = g(p_n)$. Since this goes for all $n$, take the limit: $\lim f(p_n) = \lim g(p_n)$. Since $f$ and $g$ are continuous, the limit goes in $f(\lim p_n) = g(\lim p_n) \implies f(p) = g(p)$, and so $p \in F$. So $F$ is closed.

Proposition: Let $f,g: M \to N$ be continuous funtions. If $D \subset M$ is a dense subset (that is, $\overline{D} = M$) and $f(x) = g(x)$ for all $x \in D$, then $f \equiv g$.

Proof:: Recall that $\overline{D}$ is the "smallest" closed subset containing $D$ (meaning that any closed set which contains $D$, contains $\overline{D}$ too). In the notation of the last proof, let $F$ be the set of points in which $f$ and $g$ coincide. Clearly $F \subset M$. And since $F$ is closed, by the remark above we have: $$D \subset F \implies M = \overline{D} \subset F,$$ so these inclusions give us that $F= M$, that is, the functions are equal on all of $M$.
So the second part of your exercise follows from the fact that $\Bbb Q$ is dense in $\Bbb R$, that is, $\overline{\Bbb Q}= \Bbb R$.
