# Operations on Functions

The operations on functions are presented with examples including detailed solutions and explanations. Solve and understand the examples before attempting the questions which also have detailed solutions.

## Operations on Functions Definition and Domain

Functions with real output may be combined using addition, subtraction, mulitplication and division as we do with real numbers.
Let $$f$$ and $$g$$ be two functions with real outputs. The functions $$f + g$$, $$f - g$$, $$f \cdot g$$ and $$\dfrac{f}{g}$$ are defined as follows:
1) $$(f + g)(x) = f(x) + g(x)$$ ; addition of two functions , sum of two functions
2) $$(f - g)(x) = f(x) - g(x)$$ ; subtraction of two functions , difference of two functions
3) $$(f \cdot g)(x) = f(x) \cdot g(x)$$ ; multiplication of two functions , product of two functions
4) $$\left(\dfrac{f}{g} \right)(x) = \dfrac{f(x)}{g(x)}$$ ; division of two functions , quotient of two functions

The domain of $$f + g$$, $$f - g$$ and $$f \cdot g$$ is the set $$D$$ of all values of $$x$$ that are common to the domain of $$f$$ and the domain of $$g$$. If $$D_f$$ is the domain of $$f$$ and $$D_g$$ is the domain of $$g$$ then $$D$$ is the intersection of $$D_f$$ and $$D_g$$.
$D = D_f \cap D_g$
The domain of $$\dfrac{f}{g}$$ is the set $$D$$ such that $$g(x) \ne 0$$.
Note: Two functions may also be combined by composition of functions which is studied somewhere else in this wenbsite.

## Examples with Solutions and Explanations on Operations on Functions

### Example 1

Function $$f$$ is given by a table of values and function $$g$$ is graphed below.
 $$x$$ $$f(x)$$ -2 -4 -1 10 0 7 1 8 2 11

Evaluate, if possible, the following:
a) $$(f + g)(2)$$ ,     b) $$(g - f)(0)$$ ,     c) $$(f \cdot g)(-2)$$ ,     d) $$(g \cdot f)(1)$$ ,     e) $$(\dfrac{f}{g})(1)$$ ,     f) $$(\dfrac{f}{g})(-1)$$

### Solution to Example 1

a) $$(f + g)(2) = f(2) +g(2)$$
Use the table of $$f$$ to read the values of $$f(2)$$ and the graph of g to read $$g(2)$$ to the nearest integer.
$$f(2) = 11$$, $$g(2) = -3$$
Substitute and evaluate
$$(f + g)(2) = f(2) + g(2) = 11 - 3 = 8$$
b) $$(g - f)(0) = g(0) - f(0) = - 3 - 7 = - 10$$
c) $$(f \cdot g)(-2) = f(-2) \cdot g(-2) = (-4)(5) = -20$$
d) $$(g \cdot f)(1) = g(1) \cdot f(1) = (-4)(8) = -32$$

e) $$\left(\dfrac{f}{g} \right)(1) = \dfrac{f(1)}{g(1)} = \dfrac{8}{-4} = - 2$$

f) $$\left(\dfrac{f}{g} \right)(-1) = \dfrac{f(-1)}{g(-1)} = \dfrac{10}{0} = \text{undefined}$$ , division by zero not allowed.

### Example 2

Let $$f(x) = 2x^2 + 3x + 1$$ and $$g(x) = 3x + 2$$.
a) Evaluate $$(f + g)(0)$$ , $$(f - g)(-1)$$, $$(f \cdot g) (1)$$ , $$\left(\dfrac{f}{g} \right)(2)$$ and $$\left(\dfrac{g}{f} \right)(-1)$$
b) Find the functions $$(f + g)(x)$$, $$(f - g)(x)$$, $$(f \cdot g)(x)$$ and $$\left( \dfrac{f}{g} \right)(x)$$.

### Solution to Example 2

a)
$$(f + g)(0) = f(0) + g(0) = (2(0)^2 + 3(0) + 1) + (3(0) + 2) = 3$$
$$(f - g)(-1) = f(-1) - g(-1) = (2(-1)^2 + 3(-1) + 1) - (3(-1) + 2) = 1$$
$$(f \cdot g) (1) = f(1) \cdot g(1) = (2(1)^2 + 3(1) + 1) \cdot (3(1)+2) = 30$$

$$\left(\dfrac{f}{g} \right)(2) = \dfrac{f(2)}{g(2)} = \dfrac{2(2)^2 + 3(2) + 1}{3(2)+2} = \dfrac{15}{8}$$

$$\left(\dfrac{g}{f} \right)(-1) = \dfrac{g(-1)}{f(-1)} = \dfrac{3(-1) + 2}{2(-1)^2 + 3(-1) + 1} = \dfrac{-1}{0} = \text{undefined}$$
b)
$$(f + g)(x) = f(x) + g(x) = (2x^2 + 3x + 1 ) + (3x + 2) = 2x^2 + 6x + 3$$
$$(f - g)(x) = f(x)- g(x) = (2x^2 + 3x + 1 ) - (3x + 2) = 2x^2 - 1$$
$$(f \cdot g)(x) = f(x) \cdot g(x) = (2x^2 + 3x + 1 )\cdot(3x + 2) = 6x^3+13x^2+9x+2$$
$$\left( \dfrac{f}{g} \right)(x) = \dfrac{f(x)}{g(x)} = \dfrac{2x^2 + 3x + 1}{3x+2}$$

### Example 3

Let $$f(x) = \sqrt{x-1}$$ and $$g(x) = x - 5$$.
Find the domains of $$f + g$$, $$f - g$$, $$f \cdot g$$ and $$\dfrac{f}{g}$$.

### Solution to Example 3

We first need to find the domains of functions $$f$$ and $$g$$.
The domain $$D_f$$ of $$f$$ is the set of values of x satisfying the inequality: $$x-1 \ge 0$$ (radicand must be positive for $$f(x)$$ to be real).
Solve the above inequality to obtain $$x \ge 1$$ or in interval form $$D_f = [1 , +\infty)$$
The domain $$D_g$$ of g is the set of all real numbers or in interval form : $$D_g = ( -\infty , +\infty )$$
The intersection of $$D_f$$ and $$D_g$$ is interpreted graphically below.

and is given by
$$D_f \cap D_g = [1 , +\infty)$$
The domains of $$f + g$$, $$f - g$$, $$f \cdot g$$ is given by $$D_f \cap D_g = [1 , +\infty)$$.
To find the domain of $$\dfrac{f}{g}$$ is given by $$D_f \cap D_g = [1 , +\infty)$$ and we also need satisfy the condition $$g(x) \ne 0$$ (division by zero not allowed) which gives $$x \ne 5$$
The domain of $$\dfrac{f}{g}$$ is given in interval notation by
$$[1 , 5 ) \cup ( 5 , +\infty$$

### Example 4

Let $$f(x) = \sqrt{x+1}$$ and $$g(x) = \sqrt{9-x^2}$$.
Find the domains of $$f + g$$, $$f - g$$, $$f \cdot g$$ and $$\dfrac{f}{g}$$.

### Solution to Example 4

The domain $$D_f$$ of $$f$$ is the solution set to the inequality: $$x+1 \ge 0$$ (radicand must be positive)
The solution set of the above inequality given by the interval form $$D_f = [ - 1 , +\infty)$$
The domain $$D_g$$ of $$g$$ is the solution set to the inequality: $$9-x^2 \ge 0$$ (radicand must be positive)
The solution set of the above inequality given by the interval form $$D_g = [ - 3 , + 3]$$.
The intersection of $$D_f$$ and $$D_g$$ is shown below graphically.

and is given by
$$D_f \cap D_g = [- 1 , + 3]$$
The domains of $$f + g$$, $$f - g$$, $$f \cdot g$$ is given by $$D_f \cap D_g = [- 1 , + 3]$$.
To find the domain of $$\dfrac{f}{g}$$, we need to satisfy the condition $$g(x) \ne 0$$ (division by zero not allowed) which gives $$x \ne - 3$$ and $$x \ne + 3$$
The domain of $$\dfrac{f}{g}$$ is given by the intervals
$$[ - 1 , 3 )$$

### Example 5

Let $$f(x) = \dfrac{1-x}{x+2}$$ and $$g(x) = \dfrac{x-1}{x+4}$$.
Find $$\dfrac{f}{g}$$ and $$\dfrac{g}{f}$$ and their domains.

### Solution to Example 5

$$\left(\dfrac{f}{g} \right)(x) = \dfrac{f(x)}{g(x)} = \dfrac{\dfrac{1-x}{x+2}}{\dfrac{x-1}{x+4}} = \left (\dfrac{1-x}{x+2} \right) \left( \dfrac{x+4}{x-1} \right ) = - \left (\dfrac {x-1}{x+2} \right) \left( \dfrac{x+4}{x-1} \right ) = - \dfrac{x+4}{x+2}$$

$$\left(\dfrac{g}{f} \right)(x) = \dfrac{g(x)}{f(x)} = \dfrac{1}{\dfrac{f(x)}{g(x)}} = - \dfrac{x+2}{x+4}$$
The domain $$D_f$$ of function $$f$$ is given by the interval : $$( - \infty , -2) \cup (-2 , +\infty)$$
The domain $$D_g$$ of function $$g$$ is given by the interval : $$( - \infty , -4) \cup (-4 , +\infty)$$
The intersection of $$D_f$$ and $$D_g$$ is given by
$$D_f \cap D_g = D_g \cap D_f = ( - \infty , -4) \cup (-4 , -2 ) \cup (-2 , +\infty)$$
and shown graphically below

The domain of $$\dfrac{f}{g}$$ is given by the interval $$( - \infty , -4) \cup (-4 , -2 ) \cup (-2 , +\infty)$$ such that $$g(x) \ne 0$$ or $$x \ne 1$$
which is give by the interval $$( - \infty , -4) \cup (-4 , -2 ) \cup (-2 , 1) \cup (1 , +\infty)$$

The domain of $$\dfrac{g}{f}$$ is given by the interval $$( - \infty , -4) \cup (-4 , -2 ) \cup (-2 , +\infty)$$ such that $$f(x) \ne 0$$ or $$x \ne 1$$
which is give by the interval $$( - \infty , -4) \cup (-4 , -2 ) \cup (-2 , 1) \cup (1 , +\infty)$$

## Questions with Solutions and Explanations on Operations on Functions

### Question 1

Functions $$f$$ and $$g$$ are given by table of values.

 $$x$$ $$f(x)$$ $$x$$ $$g(x)$$ -2 -4 -2 3 -1 10 -1 -4 0 7 1 9 1 0 2 -2 2 11 3 0
a) Evaluate, if possible, the following:
$$(f - g)(-1)$$ ,     $$(g + f)(0)$$ ,     $$(f \cdot g)(2)$$ ,     $$(g \cdot f)(1)$$ ,     $$(\dfrac{g}{f})(1)$$ ,     $$(\dfrac{f}{g})(1)$$
b) Find the domains of of $$f + g$$, $$f - g$$, $$f \cdot g$$ , $$\dfrac{f}{g}$$ and $$\dfrac{g}{f}$$

### Question 2

Let $$f(x) = \sqrt{-x-5}$$ and $$g(x) = |x - 7|$$.
Evaluate $$(f + g)(0)$$ , $$(f - g)(-6)$$, $$(f \cdot g) (-9)$$ and $$\left(\dfrac{f}{g} \right)(-30)$$.

### Question 3

Let $$f(x) = 2x + 14$$ and $$g(x) = x + 7$$.
Find $$(f + g)(x)$$ , $$(f - g)(x)$$, $$(f \cdot g) (x)$$, $$\left(\dfrac{f}{g} \right)(x)$$ , $$\left(\dfrac{g}{f} \right)(x)$$ and their domains.

### Question 4

Let $$f(x) = \dfrac{x-2}{x+3}$$ and $$g(x) = \dfrac{x+5}{x - 1}$$.
Find the domains of $$\dfrac{f}{g}$$ and $$\dfrac{g}{f}$$.

## Solutions to the Above Questions

### Solution to Question 1

a)
$$(f - g)(-1) = f(-1) - g(-1) = 10 - (-4) = 14$$
$$(g + f)(0) = g(0) + f(0) =$$ undefined, because $$g(0)$$ is undefined
$$(f \cdot g)(2) = f(2) \cdot g(2) = (11)(-2) = -22$$
$$(g \cdot f)(1) = g(1) \cdot f(1) = (9)(0) = 0$$
$$(\dfrac{g}{f})(1) = \dfrac{g(1)}{f(1)} = \dfrac{9}{0} = undefined$$
$$(\dfrac{f}{g})(1) = \dfrac{f(1)}{g(1)} = \dfrac{0}{9} = 0$$
b)
The domain of f is given by the set $$D_f = \{ -2 , -1 , 0 , 1 , 2 \}$$ and the domain of g is given by the set $$D_g = \{ -2 , -1 , 1 , 2 , 3\}$$
The domain of $$f + g$$, $$f - g$$, $$f \cdot g$$ is given by the intersection of $$D_f$$ and $$D_g$$ given by
$$D_f \cap D_g = \{ -2 , -1 , 1 , 2 \}$$
The domain of $$\dfrac{f}{g}$$ is the set $$D_f \cap D_g$$ such that $$g(x) \ne 0$$ or $$x \ne 3$$ but $$3$$ is not in the set $$D_f \cap D_g$$.
Hence the domain of $$\dfrac{f}{g}$$ is given by $$\{ -2 , -1 , 1 , 2 \}$$
The domain of $$\dfrac{g}{f}$$ is the set $$D_g \cap D_f$$ such that $$f(x) \ne 0$$ or $$x \ne 1$$ but $$1$$ is in the set $$D_f \cap D_g$$ and has to be omitted.
Hence the domain of $$\dfrac{g}{f}$$ is given by $$\{ -2 , -1 , 2 \}$$

### Solution to Question 2

$$(f + g)(0) = f(0) + g(0) = \sqrt{-(0) -5} + |0 - 7| = \sqrt{-5} + |- 7|$$not real, because of the term $$\sqrt{-5}$$
$$(f - g)(-6) = \sqrt{-(-6)-5} + |(-6) - 7| = \sqrt{1} + |-13| = 1 + 13 = 14$$
$$(f \cdot g) (-9) = \sqrt{-(-9)-5} \cdot |(-9) - 7| = \sqrt{4} \cdot |-16| = (2)(16) = 32$$

$$\left(\dfrac{f}{g} \right)(-30) = \dfrac{\sqrt{-(-30)-5}}{|(-30) - 7|} = \dfrac{\sqrt{25}}{|-37|} = \dfrac{5}{37}$$

### Solution to Question 3

$$(f + g)(x) = f(x) + g(x) = 2x + 14 + x + 7 = 3 x + 21$$
$$(f - g)(x) = f(x) - g(x) = (2x + 14) - (x + 7) = x + 7$$
$$(f \cdot g) (x) = f(x) \cdot g(x) = (2x + 14)(x + 7) = 2x^2+28x+98$$
$$\left(\dfrac{f}{g} \right)(x) = \dfrac{f(x)}{g(x)} = \dfrac{2x + 14}{x + 7} = \dfrac{2(x + 7)}{x + 7} = 2 , for \; x \ne -7$$
$$\left(\dfrac{g}{f} \right)(x) = \dfrac{g(x)}{f(x)} = \dfrac{x + 7}{2x + 14} = \dfrac{x + 7}{2(x + 7)} = 1/2 , for \; x \ne -7$$

The domain $$D_f$$ of function $$f$$ is given by: $$D_f = (-\infty,+\infty)$$
The domain $$D_g$$ of function $$g$$ is given by: $$D_g = (-\infty,+\infty)$$
The intesection of $$D_f$$ and $$D_g$$ is given by $$D = D_f \cap D_g = (-\infty,+\infty)$$
The domain of $$f + g$$ , $$f - g$$ and $$f \cdot g$$ is $$D = (-\infty,+\infty)$$
The domain of $$\left(\dfrac{f}{g} \right)$$ is $$D = (-\infty,+\infty)$$ such that $$g(x) \ne 0$$ and $$x \ne -7$$ which is given by $$(-\infty, - 7 ) \cup (-7 , +\infty)$$
The domain of $$\left(\dfrac{g}{f} \right)$$ is $$D = (-\infty,+\infty)$$ such that $$f(x) \ne 0$$ and $$x \ne -7$$ which is given by $$(-\infty, - 7 ) \cup (-7 , +\infty)$$

### Solution to Question 4

Let $$f(x) = \dfrac{x-2}{x+3}$$ and $$g(x) = \dfrac{x+5}{x - 1}$$.
Find the domains of $$\dfrac{f}{g}$$ and $$\dfrac{g}{f}$$.
The domain $$D_f$$ of $$f$$ is given by: $$D_f = (-\infty , - 3) \cup (-3 , +\infty)$$
The domain $$D_g$$ of $$g$$ is given by: $$D_g = (-\infty , 1) \cup (1 , +\infty)$$
The intersection $$D_f \cap D_g$$ is given by $$D_f \cap D_g = (-\infty , - 3) \cup (-3 , 1) \cup (1 , +\infty)$$
The domain of $$\dfrac{f}{g}$$ is the set $$D_f \cap D_g$$ such that $$g(x) \ne 0$$ or $$x \ne -5$$ which is given by: $$(-\infty , - 3) \cup (-3 , -5) \cup (-5 , 1) \cup (1 , +\infty)$$
The domain of $$\dfrac{g}{f}$$ is the set $$D_f \cap D_g$$ such that $$f(x) \ne 0$$ or $$x \ne 2$$ which is given by: $$(-\infty , - 3) \cup (-3 , 1) \cup (1 , 2) \cup (2 , +\infty)$$