# Does the domain of the function depend on how you write it?

What is the domain of the function $f(x,y)= \sqrt{xy}$.

In this case, domain is $D=\{(x,y) \in R^2: \}$

Since $\sqrt{xy} = x^{0.5}y^{0.5}$ I can write the function equivalently as $f(x,y)= x^{0.5}y^{0.5}$ but in this case domain is only $D=\{(x,y) \in R^2: x \geq 0, y \geq0 \}$

So, which one is the domain finally? Is it possible that the function $f$ has different domain depending on how you write it? This is confusing.

• Usually, you choose what domain you're applying the function over. This should be part of the function's definition. Sep 10, 2018 at 16:27
• Why do you think $x^{0.5}y^{0.5}$ is defined more restrictively than $\sqrt{xy}$? The domain is what you choose it to be, not something that can always be unambiguously inferred from the rule. Sep 10, 2018 at 20:23
• It is not in general true that $\sqrt{xy} = x^{0.5}y^{0.5}$. This equality requires certain assumptions, which might or might not be true in context. Sep 10, 2018 at 23:29
• I answered this previously. My answer there applies exactly to this question, although the question I was then answering may not be a precise duplicate. Sep 11, 2018 at 1:18

Strictly speaking, $f(x,y)=\sqrt{xy}$ is not a function at all. It becomes a function when you specify a domain and a codomain. Depending on your domain, you may have alternative ways to write the function; for example, if you choose the domain $\{(x,y)\in\mathbb R^2: xy=1\}$ you can equivalently write the function as $f(x,y)=1$; this form clearly is not equivalent to your expression if you chose as domain e.g $\{(x,y)\in\mathbb R^2: x>0\land y>0\}$. And of course you have to make sure that your expression is defined on the complete domain, or alternatively, use it only for the corresponding part of the domain and give another expression for other parts of the domain. For example, on the domain $(x,y)\in\mathbb R^2: xy\ge 0$, you could write your function equivalently as $$f(x,y) = \begin{cases} x^{1/2}y^{1/2} & x\ge 0 \\ (-x)^{1/2}(-y)^{1/2} & \text{otherwise}\end{cases}$$

Usually when not specifying a domain, the domain is implicitly given as “whereever that expression is defined”. In that sense, the two functions you give are then not the same, as they have different domains, although they agree in the intersection of their domains.

Note also that without codomain, your function is not completely defined. For example, if you chose $\mathbb R_{\ge 0}$ as your codomain, your function (with implicitly given domain) is surjective (it reaches every point of the codomain), while with the codomain $\mathbb R$ it isn't.

If not explicitly specified, usually the codomain of a function is assumed either to be its image (the minimal possible codomain, which makes the function surjective), or the largest “reasonable” set containing the image (like $\mathbb R$ for real-valued functions).

Since the exact codomain is less often relevant than the domain, it is more often left unspecified.

In strictly (set theoretical) mathematical terms, the domain is part of the definition of a function. However, it is fairly common to write down a function by giving an expression how to calculate it, and then the natural domain of the function is the set where that expression is well-defined. As you have discovered, there are sometimes different expressions that evaluate to the same thing for some input values, but there are different sets on which the expressions are defined.

For example, $f(x)=(\sqrt{x+2})^2$ has the natural domain $[-2,\infty)$. However, everywhere in that domain it is equal to $(x+2)$. The function $g(x)=x+2$ has the natural domain $\mathbb R$.

This is actually poorly explained (in US schools at least) until you get to proof-based writing.

Formally, a function is two thing: a domain, and a "rule" which assigns to each element of the domain an output. If the domain is $$D$$, then for each $$x\in D$$, we assign a value $$f(x)$$. This "rule" is what we usually think of as some sort of equation like $$f(x)=x^2-\sqrt x$$. The domain can be any set, and the outputs can also be in any set.

In practice, though, the domain is often implied by the context and the rule. For example, in calculus, when you see the function $$f(x)=1/x$$, it is assumed that the domain is the largest set of real numbers for which it makes sense to plug into $$f$$. In this case, any number but $$0$$ makes sense, so we can write $$D=(-\infty,0)\cup (0,\infty)$$.

As you noticed, it is not always entirely obvious what the domain should be. For $$f(x,y)=\sqrt{xy}$$, it makes sense to plug in any positive numbers for $$x$$ and $$y$$, but also certain negative numbers. For example, it makes sense to plug in $$x=-1$$ and $$y=-4$$. However, it does not make sense to plug in $$x=-1$$, $$y=4$$. In this case the domain is assumed to be $$\{(x,y):xy\ge 0\}$$, or $$\{(x,y):x,y\ge 0 \text{ or }x,y\le 0\}$$.

• It also has a codomain. Sep 10, 2018 at 17:13
• I strongly object to defining functions in terms of rules, as you would need to specify what a rule is. The standard definition of function is a relation $R$ such that for every element $x$ in the domain there exists an unique element $y$ in the codomain with $x R y$. Sep 10, 2018 at 20:07
• @miniBill As far as I can see, the rule is your relation; you're just using more precise terminology. Sep 10, 2018 at 21:20
• A relation is any subset of the Cartesian product. Which can be defined in a few steps from ZFC. My point is not formal. I'll explain. A rule assumes something describable, but for uncountable sets there are far more functions than finitely describable functions (which are necessarily enumerable). Sep 11, 2018 at 5:13
• Formally, there's more than one definition for "function" that is used and taught, depending on the context. Sep 11, 2018 at 13:55