Continuity & Domain: What Is Their Relationship? It's hard for me to formulate this into a specific question, so I'll split this into two sub-questions that will hopefully explain my confusion.
Say I have the function $\frac{x}{x}$. As far as my understanding goes, this guy is discontinuous at $x=0$, but is continuous at any other point on the real line (with both limits & function values being $1$); the limit is $1$ at $x=0$ as well, but the function's value is not (nor is it anything, seeing as it is not defined there), which is why it's not continuous at that point.
Assuming the above is true, I can look at $\frac{x}{x}$ as the product of, for instance, $f(x)=x$ and $g(x)=x^{-1}$, and say that it is discontinuous at $x=0$ simply because the domain of $g$ (and therefore, the domain of the product) does not include $0$.
A discussion I was reading seemed to conclude that, for a function $g(x)$ discontinuous at point $a$ and a continuous function $f(x)$, the product $f(x) \cdot g(x)$ is discontinuous at $a$ if neither $f(x)$ nor $g(x)$ are $0$, but is continuous $\forall x \in \mathbb{R}$ (incl. a) if, e.g, $f(x)=0$ for all $x \in R$. Though, to my understanding, this is only true if the discontinuity isn't caused by a point in which either function is undefined. For example, if $f(x)=0$ and $g(x)=\frac{1}{x}$, then it would still be wrong of me to say that $f(x) \cdot g(x)$ is continuous at $0$, because $0$ should be out of its domain. Is this right?
And for the second part of the question: I initially began this question with "Say I have the function $\frac{x}{x}$ over $\mathbb{R}$", but then felt extremely unsure about whether I could even say that, seeing as it is not defined at $x=0$ and a function needs to be defined over the entirety of its own domain. In the case of the function mentioned above, the domain must therefore not include $0$, so it could, for example, be $\mathbb{R} \setminus \{0\}$. But then this raises another question: I saw a mention of the Dirichlet function being continuous over the rationals; but if this is the case then continuity is domain-dependent, and so if I define $\frac{x}{x}$ over $\mathbb{R} \setminus \{0\}$, then it is continuous.
I can tell there's a difference here: the function is continuous over the entirety of its own domain; but it then gets a bit more confusing when I have a product of two different functions with different domains.
Please help me understand the relationship between domain & continuity, and/or point out any inconsistencies in my understanding described above.
 A: You are right that $\frac xx$, or rather the function conventionally meant by that term, is continuous. But I think there is a conceptual issue at play here, and a common one. Namely, that the functional equation
$$f(x)=\textrm{some expression in }x$$
already determines the function. This is not true. When building a function, we specify things in this order: domain and codomain first, functional equation second. That is, we choose the domain and codomain of the function, and then we are bound to give a functional equation which is actually defined for all elements of the domain, and returns only elements of the codomain. In mathematical notation you'll see it like $f:X\to Y,~f(x)=\dots$, where $X,Y$ are domain and codomain, and they are specified first. Now this said, $f:\mathbb R\to\mathbb R,~f(x)=\frac xx$ is not a well-defined function, since the functional equation isn't meaningful for all elements of the domain. However, $f:\mathbb R\backslash\{0\}\to\mathbb R,~f(x)=\frac xx$ is well-defined, since the functional equation is meaningful for all elements of the previously specified domain, and it returns only elements of the previously specified codomain. So to be sensible, when we write "the function $\frac xx$", we usually mean that as shorthand for the latter definition of a function. But technically speaking, just the term $\frac xx$ does not define a function, since we haven't specified domain or codomain, which we must, unless we want our readers to guess (which isn't always unfeasible, to be fair).
Now with all this about the definition of functions out of the way, continuity can be treated more clearly: a function $f:X\to Y$ is continuous at $x\in X$ if [insert your favorite definition of continuity at a point]. A function $f:X\to Y$ is continuous if it is continuous at all $x\in X$.
Notice that this definition only talks about points inside the domain $X$, at which the function must be defined in order to be a function. Whatever lies outside of the domain is of no concern for the definition of continuity.
As a closing remark, the often cited example of the discontinuous function $\frac 1x$ is just bad, because $f:\mathbb R\to\mathbb R,~f(x)=\frac 1x$ is not a function, while $f:\mathbb R\backslash\{0\}\to\mathbb R,~f(x)=\frac 1x$ is a perfectly continuous function. There just isn't any sensible (meaning non-contrieved) way to interpret $\frac1x$ as something that is both a function and discontinuous.
