Unit 1, lesson 14

Algebra of Functions

How to add, subtract, multiply and divide functions one input at a time, how to find the domain of the result, and why a restriction stays even after the formula simplifies.

  • Theory part 27
  • Practice part 28
  • Combining and Inverting Functions

A shop’s profit is its revenue minus its costs, and both depend on how many items it sells. Each of these is a function of the same input, and the profit at one sales level comes from subtracting two numbers. Functions can be added, subtracted, multiplied and divided in exactly this way, one input at a time, as long as both functions accept that input.

Key terms

Sum and difference

Definition Let ff and gg be functions with domains DfD_f and DgD_g. Their sum f+gf + g and their difference f−gf - g are the functions given by

(f+g)(x)=f(x)+g(x),(f−g)(x)=f(x)−g(x),\begin{gathered} (f + g)(x) = f(x) + g(x), \\[0.4em] (f - g)(x) = f(x) - g(x), \end{gathered}

for every xx in Df∩DgD_f \cap D_g, which is the domain of both. The order matters for the difference, since (g−f)(x)=−(f−g)(x)(g - f)(x) = -(f - g)(x).

In plain words To add two functions, add their outputs at the same input. The new function makes sense only at inputs where both original functions do.

Example Let f(x)=x2+1f(x) = x^2 + 1 and g(x)=3x−5g(x) = 3x - 5, both defined for all real numbers. Then

(f+g)(x)=x2+3x−4,(f−g)(x)=x2+1−(3x−5)=x2−3x+6.\begin{aligned} (f + g)(x) &= x^2 + 3x - 4, \\[0.4em] (f - g)(x) &= x^2 + 1 - (3x - 5) \\[0.4em] &= x^2 - 3x + 6. \end{aligned}

At x=2x = 2 the outputs are f(2)=5f(2) = 5 and g(2)=1g(2) = 1, so (f+g)(2)=6(f + g)(2) = 6 and (f−g)(2)=4(f - g)(2) = 4, as the formulas give. The parentheses around 3x−53x - 5 matter, because the minus sign applies to the whole output of gg.

Product

Definition The product fgfg of functions ff and gg is the function given by

(fg)(x)=f(x)⋅g(x)(fg)(x) = f(x) \cdot g(x)

for every xx in Df∩DgD_f \cap D_g. A constant multiple cfcf, with (cf)(x)=c⋅f(x)(cf)(x) = c \cdot f(x), is the product of ff with a constant function and has domain DfD_f. The notation fgfg means multiplying outputs. It is not the composition f∘gf \circ g, which feeds the output of gg into ff.

In plain words Multiply the two outputs at each input. Where either factor is zero, the product is zero.

Example Let f(x)=2x−1f(x) = 2x - 1 and g(x)=x+3g(x) = x + 3. Then

(fg)(x)=(2x−1)(x+3)=2x2+5x−3.\begin{aligned} (fg)(x) &= (2x - 1)(x + 3) \\[0.4em] &= 2x^2 + 5x - 3. \end{aligned}

At x=1x = 1 the outputs are f(1)=1f(1) = 1 and g(1)=4g(1) = 4, so (fg)(1)=4(fg)(1) = 4, and the formula gives 2+5−3=42 + 5 - 3 = 4. The zeros of fgfg are the zeros of the two factors, 12\frac{1}{2} and −3-3.

Domain intersection

Definition The domain of f+gf + g, f−gf - g and fgfg is the intersection

Df∩Dg={ x∣x∈Df and x∈Dg },\begin{aligned} &D_f \cap D_g \\[0.4em] &\quad = \{\, x \mid x \in D_f \text{ and } x \in D_g \,\}, \end{aligned}

the set of inputs that belong to both domains. It is read from the original formulas of ff and gg, before any simplification of the combined formula.

In plain words An input is allowed only when both functions accept it. On a number line, the domain is the part where the two domain sets overlap.

Example Let f(x)=x+2f(x) = \sqrt{x + 2} and g(x)=5−xg(x) = \sqrt{5 - x}, with domains [−2,∞)[-2, \infty) and (−∞,5](-\infty, 5]. Then

Df+g=[−2,∞)∩(−∞,5]=[−2,5].\begin{aligned} D_{f + g} &= [-2, \infty) \cap (-\infty, 5] \\[0.4em] &= [-2, 5]. \end{aligned}

At x=7x = 7 the value f(7)=3f(7) = 3 exists, but g(7)=−2g(7) = \sqrt{-2} is not a real number, so (f+g)(7)(f + g)(7) is undefined. Simplifying can hide this. With p(x)=x−1p(x) = \sqrt{x - 1} and q(x)=x+1q(x) = \sqrt{x + 1} the product is x2−1\sqrt{x^2 - 1} for x≥1x \ge 1, and that formula alone also works at x=−2x = -2. Yet p(−2)p(-2) is not real, so −2-2 is not in the domain [1,∞)[1, \infty) of pqpq.

Quotient

Definition The quotient fg\frac{f}{g} is the function given by

(fg)(x)=f(x)g(x)\left(\frac{f}{g}\right)(x) = \frac{f(x)}{g(x)}

for every xx in Df∩DgD_f \cap D_g with g(x)≠0g(x) \ne 0. Its domain is therefore

{ x∈Df∩Dg∣g(x)≠0 }.\{\, x \in D_f \cap D_g \mid g(x) \ne 0 \,\}.

In plain words Divide the outputs at each input. Both functions must be defined there, and the bottom one must not be zero.

Example Let f(x)=x+4f(x) = x + 4 and g(x)=x2−9g(x) = x^2 - 9, both defined for all real numbers. The divisor is zero at x=3x = 3 and x=−3x = -3, so

(fg)(x)=x+4x2−9,x≠−3, x≠3.\begin{gathered} \left(\frac{f}{g}\right)(x) = \frac{x + 4}{x^2 - 9}, \\[0.8em] x \ne -3, \ x \ne 3. \end{gathered}

At x=−4x = -4 the quotient is 07=0\frac{0}{7} = 0, which is perfectly fine. The reversed quotient gf\frac{g}{f} has a different domain, every real number except −4-4.

Nonzero divisor

Definition In fg\frac{f}{g} the function gg is the divisor, and an input xx is allowed only when g(x)g(x) is defined and g(x)≠0g(x) \ne 0. The zeros of the divisor are removed from Df∩DgD_f \cap D_g even when gg itself is defined there. A zero of the numerator ff causes no exclusion by itself. If it lies in DgD_g and is not a zero of gg, it stays in the domain and is a zero of the quotient. If it is also a zero of gg, as x=1x = 1 is for x2−1x−1\frac{x^2 - 1}{x - 1}, it is excluded like every other zero of the divisor.

In plain words Before you divide, find every input where the bottom function is zero and throw it out. A zero on top does no harm by itself.

Example Let f(x)=x−2f(x) = x - 2 and g(x)=xg(x) = \sqrt{x}. The square root is defined at 00, but it equals 00 there, so

(fg)(x)=x−2x,x∈(0,∞).\left(\frac{f}{g}\right)(x) = \frac{x - 2}{\sqrt{x}}, \qquad x \in (0, \infty).

The reversed quotient xx−2\frac{\sqrt{x}}{x - 2} has domain [0,2)∪(2,∞)[0, 2) \cup (2, \infty). It keeps 00, where its value is 0−2=0\frac{0}{-2} = 0. The same condition returns in calculus, where the quotient law for limits needs a denominator whose limit is not zero.

Graph of pointwise operations

Definition The operations above are pointwise, which means each one is carried out separately at each input. For xx in the common domain, the point of the graph of f+gf + g above xx is (x,f(x)+g(x))(x, f(x) + g(x)), so its height is the sum of the signed heights of the graphs of ff and gg above that same xx. The other operations work the same way. In particular (f−g)(x)=0(f - g)(x) = 0 exactly when f(x)=g(x)f(x) = g(x), so the zeros of f−gf - g are the first coordinates of the points where the graphs of ff and gg meet.

In plain words Stand at one input, read both heights and combine them. A height below the xx-axis counts as negative.

Example Take f(x)=x2f(x) = x^2 and g(x)=x+2g(x) = x + 2.

xxf(x)f(x)g(x)g(x)(f+g)(x)(f + g)(x)(f−g)(x)(f - g)(x)
−2-244004444
−1-111112200
00002222−2-2
11113344−2-2
2244448800

The difference is x2−x−2=(x+1)(x−2)x^2 - x - 2 = (x + 1)(x - 2), with zeros −1-1 and 22, and the graphs of ff and gg meet at (−1,1)(-1, 1) and (2,4)(2, 4). At x=−2x = -2, where gg is zero, the graph of f+gf + g passes through the point (−2,4)(-2, 4) of the graph of ff.

Restrictions survive cancellation

Definition The domain of a combination is fixed by the original functions before any algebra is done. If the formula of f+gf + g, f−gf - g, fgfg or fg\frac{f}{g} simplifies, for example by cancelling a common factor or two opposite terms, the simplified formula agrees with the combination only on that domain. Inputs excluded at the start stay excluded, so the graph of the combination is the graph of the simplified formula with those inputs removed. A single excluded input where the simplified formula is defined shows up as a hole in the graph.

In plain words Simplifying changes how the formula looks, not which inputs are allowed. Write the restriction next to the simplified formula so it is not lost.

Example Let f(x)=x2−1f(x) = x^2 - 1 and g(x)=x−1g(x) = x - 1. For x≠1x \ne 1

(fg)(x)=(x−1)(x+1)x−1=x+1.\begin{aligned} \left(\frac{f}{g}\right)(x) &= \frac{(x - 1)(x + 1)}{x - 1} \\[0.8em] &= x + 1. \end{aligned}

The graph is the line y=x+1y = x + 1 with a hole at (1,2)(1, 2). Cancelling terms works the same way. With p(x)=x+1xp(x) = x + \frac{1}{x} and q(x)=1xq(x) = \frac{1}{x} the difference is (p−q)(x)=x(p - q)(x) = x, but only for x≠0x \ne 0, since neither pp nor qq is defined at 00.

Check yourself

  1. Let f(x)=x−1f(x) = \sqrt{x - 1} and g(x)=x−3g(x) = x - 3. Find the domains of f+gf + g, fgfg, fg\frac{f}{g} and gf\frac{g}{f}.
Show the answer

The domains are Df=[1,∞)D_f = [1, \infty) and Dg=RD_g = \mathbb{R}, so f+gf + g and fgfg both have domain [1,∞)[1, \infty). The quotient fg\frac{f}{g} also excludes the zero 33 of gg, giving [1,3)∪(3,∞)[1, 3) \cup (3, \infty). The quotient gf\frac{g}{f} excludes the zero 11 of ff, giving (1,∞)(1, \infty).

  1. Suppose f(3)=4f(3) = 4 and g(3)=−2g(3) = -2. Find (f−g)(3)(f - g)(3), (fg)(3)(fg)(3) and (fg)(3)\left(\frac{f}{g}\right)(3).
Show the answer

Combine the two outputs at the input 33. This gives (f−g)(3)=4−(−2)=6(f - g)(3) = 4 - (-2) = 6, then (fg)(3)=4⋅(−2)=−8(fg)(3) = 4 \cdot (-2) = -8, and (fg)(3)=4−2=−2\left(\frac{f}{g}\right)(3) = \frac{4}{-2} = -2.

  1. Let f(x)=x2+2xf(x) = x^2 + 2x and g(x)=x+2g(x) = x + 2. Simplify fg\frac{f}{g} and describe its graph.
Show the answer

For x≠−2x \ne -2

x2+2xx+2=x(x+2)x+2=x.\frac{x^2 + 2x}{x + 2} = \frac{x(x + 2)}{x + 2} = x.

The value −2-2 stays excluded because g(−2)=0g(-2) = 0. The graph is the line y=xy = x with a hole at (−2,−2)(-2, -2).

How this lesson connects

Where this leads in Calculus