Let there be a function $f: \mathbb{Q} \to \mathbb{Q}$, such that $f(x) = 1$ for all rational numbers $x$.
What's the limit of this function if $x$ tends to $0$? Does it exist and is $1$? Does it not exist? Is asking about the limit invalid here?
Let there be a function $f: \mathbb{Q} \to \mathbb{Q}$, such that $f(x) = 1$ for all rational numbers $x$.
What's the limit of this function if $x$ tends to $0$? Does it exist and is $1$? Does it not exist? Is asking about the limit invalid here?
What's the limit of this function if $x$ tends to $0$? Does it exist and is $1$? Does it not exist? Is asking about the limit invalid here?
The limit exists and equals $1$.
Values not in the domain of a function are not considered when taking the limit. For example, consider the following easier limit: $$ \lim_{x \to 0} \sqrt{x} $$
Now the function $\sqrt{x}$ implicitly has domain $[0, \infty)$. So, when we take this limit, we do not consider the values $x < 0$; we only consider $x > 0$. And so the answer is that the limit equals $0$. $$ \lim_{x \to 0} \sqrt{x} = 0. $$
Going back to your example, you asked us to consider $$ \lim_{x \to 0} f(x) $$ where $f: \mathbb{Q} \to \mathbb{Q}$ and $f(x) = 1$ for all $x \in \mathbb{Q}$.
Because the domain of $f$ is $\mathbb{Q}$, we do not consider irrational values of $x$ when taking the limit. So we only look at the values $x$ which are closer and closer to $0$, which are rational numbers. For such values of $x$, $f(x) = 1$. Therefore, the answer is $$ \lim_{x \to 0} f(x) = 1. $$
The limit is $\lim_{x \to 0} f(x) = 1$ because whatever $\varepsilon$ you take, for any $\delta >0$ we have that $f[\mathbb{Q} \cap (-\delta, \delta)] =\{1\} \subseteq (1-\varepsilon, 1+\varepsilon)$, so we always get $1$ (so $\varepsilon$-close to $1$ ) for all $x$ nearby $0$ where $f$ is defined. It's irrelevant where $f$ is not defined, as long as we have domain points $\neq 0$ that are arbitarily close to $0$. Otherwise a limit to $0$ wouldn't make sense anyway.
So also $\lim_{x \to \pi} f(x)=1$ for similar reasons.