Functions: domain, codomain, range and graph

functions

I have a question in my course.

Let $A = \{0, 1\}$, $B = \{4, 5, 6, 7\}$ and $C = \mathbb{N}$ (natural numbers). Consider the following functions:

$f:A\to B$ s.t. $f(x) = x+5$

$g:B\to C$ s.t. $g(x) = 2x−2$

$h:C \to A$ s.t. $h(x) = \begin{cases}
0 & \text{if $x < 10$} \\
1 & \text{if $x \ge 10$} \\
\end{cases}$

Which of the following compositions are defined?
If they are defined, compute their domain, codomain, range and graph.

(a) $f \circ g$

(b) $g \circ f$

(c) $h \circ g$

(d) $g\circ h$

My answer:

• Domain of $f$ is $A = \{0, 1\}$; domain of $g$ is $B = \{4,5,6,7\}$; domain of $h$ is $C = \mathbb{N}$;

• Codomain of $f$ is $B = \{4,5,6,7\}$; codomain of $g$ is $C = \mathbb{N}$; codomain of $h$ is $A = \{0,1\}$.

• Range of $f$ is $\{5, 6\}$; range of $g$ is $\{4,8,10,12\}$; range of $h$ is $\{0,1\}$.

a) $f \circ g = f(g(x)) = 2x + 5 -2 = 2x + 3$

b) $g \circ f = g(f(x)) = 2(x + 5) – 2 = 2x + 8$

c) $h \circ g = -2 \text{ if } x < 10;\ h \circ g = 0 \text{ if } x \ge 10 $

d) $g \circ h = g(h(x)) = -2\text{ if } x < 10; g \circ h = 0 \text{ if } x \ge 10$

Could I please get a review and how to calculate the graph?

Best Answer

The composite function $f \circ g$ is only defined if the codomain of $g$ is contained in the domain of $f$. Depending on the definition you are using, you may need the stronger condition that the codomain of $g$ equals the domain of $f$.

In this case, the codomain of $g$ is $\mathbb{N}$ and the domain of $A = \{0, 1\}$. Moreover, as noted in the comments, since the range of $g$ is $\{6, 8, 10, 12\}$, the elements in the range of $g$ are not contained in the domain of $f$. Thus, the composite function $f \circ g$ is undefined.

Since $f: A \to B$ and $g: B \to C$, the composite function $g \circ f$ is defined since the codomain of $f$ equals the domain of $g$. As you correctly concluded, the function $g \circ f: A \to C$ is defined by $$(g \circ f)(x) = g(f(x)) = g(x + 5) = 2(x + 5) - 2 = 2x + 8$$ The graph of the composite function $g \circ f$ is the set of all ordered pairs $(a, c) \in A \times C$ such that $(g \circ f)(a) = c$ for some $a \in A$. Since $(g \circ f)(0) = 8$ and $(g \circ f)(1) = 10$, the graph of the function $g \circ f$ is the set $$G_{g \circ f} = \{(0, 8), (1, 10)\}$$

Since $g: B \to C$ and $h: C \to A$, the composite function $h \circ g$ is defined since the codomain of $g$ equals the domain of $h$. Since $h: C \to A$ is defined by $$h(x) = \begin{cases} 0 & \text{if $x < 10$}\\ 1 & \text{if $x \geq 10$} \end{cases} $$ and $g: B \to C$ is defined by $g(x) = 2x - 2$, observe that if $x \in B$, then $$(g \circ h)(x) = \begin{cases} 0 & \text{if $x < 6$}\\ 1 & \text{if $x \geq 6$} \end{cases} $$ To see this, observe that if $x < 6$, $g(x) = 2x - 2 < 2 \cdot 6 - 2 = 10$, and that if $x \geq 6$, $g(x) = 2x - 2 \geq 2 \cdot 6 - 2 = 10$. Since \begin{align*} (h \circ g)(4) & = h(g(4)) = h(6) = 0\\ (h \circ g)(5) & = h(g(5)) = h(8) = 0\\ (h \circ g)(6) & = h(g(6)) = h(10) = 1\\ (h \circ g)(7) & = h(g(7)) = h(12) = 1 \end{align*} the graph of $h \circ g$ is $$G_{h \circ g} = \{(4, 0), (5, 0), (6, 1), (7, 1)\}$$

Observe that $h: C \to A$ and $g: B \to C$, so the codomain of $h$ is not contained in the domain of $g$ since $A$ is not a subset of $B$. Thus, the composite function $g \circ h$ is not defined.

Related Question