If $f$ and $g$ are two functions, we can define new functions $f+g$,$f-g$, $f.g$, and $f/g$ by the formulas:

\begin{align*}
(f+g)(x) & =f(x)+g(x)\\
(f-g)(x) & =f(x)-g(x)\\
(f.g)(x)= & f(x).g(x)\\
(f/g)(x) & =\frac{f(x)}{g(x)}
\end{align*}
The domains of $f+g$, $f-g$, $f.g$ consist of all $x$ for which both $f(x)$ and $g(x)$ are defined:
$\{x|\ x\in Dom(f)\text{ and }x\in Dom(g)\}$

That is, the domains of these functions are the intersection of the domain of $f$ and the domain of $g$:
$Dom(f)\cap Dom(g)$

The domain of $f/g$ is trickier. Its domain consists of all $x$ for which $f(x)$ and $g(x)$ are defined but $g(x)\neq0$, because division by zero is not defined. Therefore:

$\bbox[#F2F2F2,5px,border:2px solid black]{\large Dom(f/g)=\{x|\ x\in Dom(f)\text{ and }x\in Dom(g)\text{ and }g(x)\neq0\},}$ which also can be written as:
$Dom(f/g)=Dom(f)\cap Dom(g)\cap\{x|\ g(x)\neq0\}.$

Example 1
Let $f(x)=\dfrac{1}{x-3}$ and $g(x)=\sqrt{x-2}$.
(a) Find the functions $f+g,f-g,f\cdot g$, $f/g$ and $g/f$ and their domains.

(b) Find $(f+g)(5),(f-g)(5),(fg)(5)$, $(f/g)(5)$, and $(g/f)(5)$.

Solution
(a) The domain of $f$ is $\{x|\ x\neq3\}$ or $\mathbb{R}-\{3\}$ because division by zero is not defined. The square root of negative numbers is not defined [square root of a negative number becomes imaginary], thus the domain of $g$ is $\{x|\ x\geq2\}$. The intersection of the domains of $f$ and $g$ is
$\{x|\ x\geq2\text{ and }x\neq3\}=[2,3)\cup(3,\infty).$ Thus we have
\begin{align*}
(f+g)(x) & =f(x)+g(x)=\frac{1}{x-3}+\sqrt{x-2}\\
(f-g)(x) & =f(x)-g(x)=\frac{1}{x-3}-\sqrt{x-2}\\
(fg)(x) & =f(x)\cdot g(x)=\frac{\sqrt{x-2}}{x-3},
\end{align*}
and the domains of all of these functions are
$\{x|\ x\geq2\text{ and }x\neq3\}=[2,3)\cup(3,\infty).\qquad\text{(try them!)}$ To determine the domain of $(f/g)(x)$, from this set of numbers we need to exclude 2 because $g(2)=0.$ That is, the domain of $(f/g)(x)$ is
$\{x|\ x>2\text{ and }x\neq3\}=(2,3)\cup(3,\infty),$ and
$\left(\frac{f}{g}\right)(x)=\frac{1}{(x-3)\sqrt{x-2}}.$ Because $f$ does not vanish ($f(x)\neq0$) in its domain,* the domain of $(g/f)(x)$ is the same as $Dom(f)\cap Dom(g)=[2,3)\cup(3,\infty)$,and
$\left(\frac{g}{f}\right)(x)=\frac{\sqrt{x-2}}{\frac{1}{x-3}}=(x-3)\sqrt{x-2}.$

(b) Because $x=5$ is in the domain of each function, each of these values exists:
\begin{align*}
(f+g)(5) & =f(5)+g(5)=\frac{1}{5-3}+\sqrt{5-2}=\frac{1}{2}+\sqrt{3}\\
(f-g)(5) & =f(5)-g(5)=\frac{1}{5-3}-\sqrt{5-2}=\frac{1}{2}-\sqrt{3}\\
(fg)(5) & =f(5)\cdot g(5)=\frac{1}{5-3}\cdot\sqrt{5-2}=\frac{\sqrt{3}}{2}\\
\left(\frac{f}{g}\right)(5) & =\frac{f(5)}{g(5)}=\frac{\frac{1}{5-3}}{\sqrt{5-2}}=\frac{1}{2\sqrt{3}}\\
\left(\frac{g}{f}\right)(5) & =\frac{g(5)}{f(5)}=\frac{\sqrt{5-2}}{\frac{1}{5-3}}=2\sqrt{3}
\end{align*}

*  You may sketch the graph of $y=1/(x-3)$ to see that. Note that the graph of $y=1/(x-3)$ is the graph of $y=1/x$ shifted horizontally 3 units to the right. See Section 2.11 for more details.

Example 2
What is the natural domain of $H(x)=\sqrt{x-1}+\sqrt{2-x}$?
Solution
We have already determined the domain of this function in Example 1 in the Section on Natural Domain and Range of a Function. But now, let’s use what we learned in this section. Let $f(x)=\sqrt{x-1}$, $g(x)=\sqrt{2-x}$, and $H=f+g$. The function $f$ is defined for all $x$ such that $x-1\geq0$. That is, $Dom(f)=\{x|\ x\geq1\}=[1,\infty)$. The domain of $g$ consists of all $x$ for which $2-x\geq0$, i.e. $Dom(g)=\{x|\ x\leq2\}=(-\infty,2]$. The intersection of the domains of $f$ and $g$ is
\begin{align*}
Dom(H) & =\{x|\ x\leq2\text{ and }x\geq1\}\\
& =\{x|\ 1\leq x\leq2\}\\
& =[1,2],
\end{align*}
or
$Dom(H)=Dom(f)\cap Dom(g)=[1,\infty)\cap(-\infty,2]=[1,2],$ which is exactly the same as we saw in Example 1 in Section 2.3.
Example 3
Are the following functions equal?

(a)$h_{1}(x)=\sqrt{x-1}\sqrt{2-x}$ and $h_{2}(x)=\sqrt{(x-1)(2-x)}$

(b)$u_{1}(x)=\sqrt{x-1}\sqrt{x-2}$ and $u_{2}(x)=\sqrt{(x-1)(x-2)}$

Solution
The functions $h_{1}(x)$ and $h_{2}(x)$, and $u_{1}(x)$ and $u_{2}(x)$ can be equal functions if they have the same (natural) domains. [Note that if $r$ and $s$ are both nonnegative, then $rs\geq0$. Therefore if $A=\sqrt{r}\sqrt{s}$, then we can also write $A$ as
$A=\sqrt{rs}.$ However, if $B=\sqrt{pq}$, without knowing that $p$ and $q$ are both nonnegative, we cannot write $B$ as $\sqrt{p}\sqrt{q}.$ For example, if $p=-2$, and $q=-3$, then we can calculate $\sqrt{(-2)\cdot(-3)}$
but $\sqrt{-2}$ or $\sqrt{-3}$ are not defined.] To determine the domains of these functions, we note that:
$\sqrt{\square}\text{ is defined if the sign of }\square\text{ is not negative}$ and
$\text{sign }(\square\times\lozenge)=\text{sign }(\square)\times\text{sign }(\lozenge)$ (a) First, we should determine the signs of all expressions under $\sqrt{.}$
From what we learned in this section:
\begin{align*}
Dom(h_{1}) & =Dom(\sqrt{x-1})\cap Dom(\sqrt{2-x})\\
& =[1,\infty)\cap(-\infty,2]=[1,2],
\end{align*}
and from the above table:
$Dom(h_{2})=Dom(\sqrt{(x-1)(2-x)}=[1,2].$ Therefore $h_{1}(x)=h_{2}(x)$ everywhere they are defined. In other words, they are equal functions.

(b) Similarly, using the following table:

\begin{align*}
Dom(u_{1}) & =Dom(\sqrt{x-1})\cap Dom(\sqrt{x-2})\\
& =[1,\infty)\cap[2,\infty)=[2,\infty)
\end{align*}
but
$Dom(u_{2})=(-\infty,1]\cup[2,\infty).$ Therefore $u_{1}(x)$ and $u_{2}(x)$ are equal only when $x\in[2,\infty)$. Because the domains of $u_{1}(x)$ and $u_{2}(x)$ are not equal, they are not equal functions.

Example 4
Determine the natural domain of the following functions:
(a) $f(x)=\dfrac{\sqrt{1-x}}{\log x}$

(b)$g(u)=\dfrac{e^{u}}{\sqrt{|1+u|}}$

Solution
Recall that $\log x$ is defined when $x>0$ and
$\log x=0\Rightarrow x=1$ (a)
\begin{align*}
Dom(f) & =Dom(\sqrt{1-x})\cap Dom(\log x)\cap\{x|\log x\neq0\}\\
& =(-\infty,1]\cap(0,\infty)\cap\{x|x\neq1\}\\
& =(0,1).
\end{align*}
(b)
\begin{align*}
Dom(g) & =Dom(e^{u})\cap Dom(\sqrt{|1+u|})\cap\{u|\ \sqrt{|1+u|}\neq0\}\\
& =\mathbb{R}\cap\mathbb{R}\cap\{u|\ |1+u|\neq0\}\\
& =\mathbb{R}\cap\mathbb{R}\cap\{u|\ u\neq\pm1\}\\
& =\{u|\ u\neq\pm1\}\\
& =\mathbb{R}-\{-1,1\},
\end{align*}
which can also be written as
$Dom(g)=(-\infty,-1)\cup(-1,1)\cup(1,\infty).$

## Graphs of Combined Functions

Suppose the graphs of $f$ and $g$ are known:

•  to obtain the graph of the function $f+g$, we just add the corresponding $y$-coordinates $f(x)$ and $g(x)$ at each $x$ that belongs both to the domain of $f$ and the domain of $g$
•  to obtain the graph of the function $f+g$, we just subtract the $y$-coordinate $g(x)$ from the corresponding $y$-coordinate $f(x)$ at each $x$ that belongs both to the domain of $f$ and the domain of $g$
•  to obtain the graph of the function $fg$, we multiply the corresponding$y$-coordinates $f(x)$ and $g(x)$ at each $x$ that belongs both to the domain of $f$ and the domain of $g$.