Domains and Rules

When are two functions equal? A function is a kind of relation, which means it's a kind of set. So two functions being equal means, fundamentally, that each is a subset of the other. That's inconvenient, and it doesn't really jibe with our understanding of functions as encoding rules.

Theorem About When Functions Are Equal (TAWFAE). Let f and g be functions. Then f=g if and only if:

  1. \operatorname{Domain}(f)=\operatorname{Domain}(g), and
  2. \forall x\in \operatorname{Domain}(f), f(x)=g(x).

Proof. This theorem sort of looks like it will be complicated to prove, but let's keep our wits about us and rely on logic to help us out.

Globally, this is a biconditional proof so it has two directions:

(\Rightarrow) Assume f=g. We need to prove two things:

(clause 1) This is the claim that two sets are equal, so we have to prove each is a subset of the other:

(\subseteq) Let t\in \operatorname{Domain}(f). Then \exists y: (t,y)\in f. Since f=g, this means (t,y)\in g. So t\in\operatorname{Domain}(g).

(\supseteq) Let t\in \operatorname{Domain}(g). Then \exists y: (t,y)\in g. Since f=g, this means (t,y)\in f. So t\in\operatorname{Domain}(f).

(clause 2) This is a universal claim, so we start the same way as always: Let x\in \operatorname{Domain}(f). Then \exists y: (x,y)\in f. We can rewrite this as y=f(x). On the other hand, we know from clause 1 that \operatorname{Domain}(g)=\operatorname{Domain}(f), so \exists z: (x,z)\in g. We can rewrite this as z=g(x). But since g=f, we actually have (x,z)\in f.

Since (x,y)\in f and (x,z)\in f, and f is a function, y=z.

So f(x)=y=z=g(x).

(\Leftarrow) Assume both clauses 1 and 2 hold. In this direction, we need to prove two sets are equal.

(\subseteq) Let Q\in f. Then Q=(x,y) for some x and some y. x\in\operatorname{Domain}(f), so by clause 1, x\in\operatorname{Domain}(g). Then there's some z with (x,z)\in g. We can rewrite in function notation as y=f(x) and z=g(x). By clause 2, we know f(x)=g(x), so y=z. That is, Q=(x,y)\in g.

(\supseteq) This is so similar to \subseteq, I'll let you work it out.

Since we proved both directions, we're done. \Box.

This theorem gives us a new way to prove two functions are equal, should we ever need it: we establish clause 1 ("they have the same domain") and clause 2 ("they have the same rule").

Restrictions and Extensions

In middle and high school algebra courses, we often ask questions like "What's the domain of f(x)=\frac{sin(x)}{x^2-25}?". According to the TAWFAE, this is actually a dumb question: TAWFAE says in order to know what a function is, we need to know what the domain is. So a question like doesn't actually contain enough information to be answerable.

What the question is really asking, though is: what's the most natural, or maybe what's the largest possible domain on which this rule makes sense?

As a middle-school student, I was very confused by questions like this one:

Find the domain of f(x)=\frac{x^2-9}{x+3}.

My answer would usually go like this: that function is really the same as x-3, the domain of which is all of \mathbb{R}. And I would always get that question wrong. Why?

The functions \psi:t\mapsto \frac{t^2-9}{t+3} and \varphi:x\mapsto x-3 do indeed have the same rule, in the sense that, whenever \psi(t) makes sense, we have

    \[\psi(t)=\frac{t^2-9}{t+3}=\frac{(t-3)(t+3)}{t+3}=t-3=\varphi(t)\]

But the natural domain of \psi is \mathbb{R}\setminus\{-3\} and the natural domain for \varphi is \mathbb{R}; so that means the domains are different -- hence by the TAWFAE, we know \psi\neq\varphi. Nevertheless, the two functions are related.

Definition. If f:X\rightarrow Y and A\subseteq X, we define the restriction of f to A as

    \begin{align*}f|_{A}:A&\rightarrow Y\\ a&\mapsto f(a)\end{align*}

That is, f|_A has the same rule as f, just we only care about inputs that come from A.

Equipped with this notion, we can describe the relationship between \psi and \varphi:

    \[\psi=\varphi|_{\mathbb{R}\setminus\{-3\}}\]

Definition. If f:X\rightarrow Y, and X\subseteq Z, and there is g:Z\rightarrow Y with g|_X=f, we call g an extension of f.

Here's an illustration: if we let f denote the function displayed in green, g denote the function displayed in blue, and h the function displayed in red, then we have that:

  • f|_{[-2,\infty)}=g
  • f|_{[3,\infty)}=h
  • g|_{[3,\infty)}=h
  • f is an extension of g, from [-2,\infty) to all of \mathbb{R}
  • g is an extension of h, from [3,\infty) to [2,\infty)