If I have some $f : \mathbb A \to \mathbb A$ that needs to be solve. Can I define $g : \mathbb B \to \mathbb B$ when $\mathbb A$ is a subset of $\mathbb B$ and solve for $g(x)$ then I conclude that $f(x) = g(x)$?
For example , if I have $f : \mathbb N \to \mathbb N$ , can I define $g : \mathbb R \to \mathbb R$ so that when I get $g(x) = ???$ $\forall x \in \mathbb R$ , I’ll also get $f(x) = g(x)$ $\forall x \in \mathbb N$?
No, this is not allowed.
Defining the domain over a larger set gives you more information, whereas defining the range over a larger set can allow more freedom in the function. Take for example, the functional equation $$f(x+y) = f(x) + f(y)$$ for $f: \mathbb R^+ \to \mathbb R^+$. This only has linear solutions, but if you extend it to $f: \mathbb R \to \mathbb R$, there are nonlinear solutions.
Even if you use $\mathbb B \to \mathbb A$ instead of $\mathbb B \to \mathbb B$, there are other counterexamples; I'll leave this as an exercise for you to find.