Loading [MathJax]/jax/output/HTML-CSS/jax.js
Skip to main content
Library homepage
 

Text Color

Text Size

 

Margin Size

 

Font Type

Enable Dyslexic Font
Mathematics LibreTexts

6.1: Operations on functions given by formulas

( \newcommand{\kernel}{\mathrm{null}\,}\)

We can combine functions in many different ways. First, note that we can add, subtract, multiply, and divide functions.

Example 6.1.1

Let f(x)=x2+5x and g(x)=7x3. Find the following functions, and state their domain. (f+g)(x),(fg)(x),(fg)(x), and (fg)(x)

Solution

The functions are calculated by adding the functions (or subtracting, multiplying, dividing).

(f+g)(x)=(x2+5x)+(7x3)=x2+12x3(fg)(x)=(x2+5x)(7x3)=x2+5x7x+3=x22x+3(fg)(x)=(x2+5x)(7x3)=7x33x2+35x215x=7x3+32x215x(fg)(x)=x2+5x7x3

The calculation of these functions was straightforward. To state their domain is also straightforward, except for the domain of the quotient fg. Note, that f+g, fg, and fg are all polynomials. By the standard convention (See Convention definition) all these functions have the domain R, that is their domain is all real numbers.

Now, for the domain of fg, we have to be a bit more careful, since the denominator of a fraction cannot be zero. The denominator of fg(x)=x2+5x7x3 is zero, exactly when

7x3=07x=3x=37

We have to exclude 37 from the domain. The domain of the quotient fg is therefore R{37}.

We can formally state the observation we made in the previous example.

Observation

Let f be a function with domain Df, and g be a function with domain Dg. A value x can be used as an input of f+g, fg, and fg exactly when x is an input of both f and g. Therefore, the domains of the combined functions are the intersection of the domains Df and Dg:

Df+g=DfDg={x|xDf and xDg}Dfg=DfDgDfg=DfDg

For the quotient fg, we also have to make sure that the denominator g(x) is not zero.

Dfg={x|xDf,xDg, and g(x)0}

Example 6.1.2

Let f(x)=x+2, and let g(x)=x25x+4. Find the functions fg and gf and state their domains.

Solution

First, the domain of f consists of those numbers x for which the square root is defined. In other words, we need x+20, that is x2, so that the domain of f is Df=[2,). On the other hand, the domain of g is all real numbers, Dg=R. Now, we have the quotients

(fg)(x)=x+2x25x+4, and (gf)(x)=x25x+4x+2

For the domain of fg, we need to exclude those numbers x for which x25x+4=0. Thus,

x25x+4=0(x1)(x4)=0x=1, or x=4

We obtain the domain for fg as the combined domain for f and g, and exclude 1 and 4. Therefore, Dfg=[2,){1,4}.

Now, for gf(x)=x25x+4x+2, the denominator becomes zero exactly when

x+2=0,x=2

Therefore, we need to exclude 2 from the domain, that is

Dgf=[2,){2}=(2,)

Example 6.1.3

To form the quotient fg(x) where f(x)=x21 and g(x)=x+1 we write fg(x)=x21x+1=(x+1)(x1)x+1=x1. One might be tempted to say that the domain is all real numbers. But it is not! The domain is all real numbers except 1, and the last step of the simplification performed above is only valid for x1.

Another operation we can perform is the composition of two functions.

Definition: Composition of a Function

Let f and g be functions, and assume that g(x) is in the domain of f. Then define the composition of f and g at x to be

(fg)(x):=f(g(x))

We can take any x as an input of fg which is an input of g and for which g(x) is an input of f. Therefore, if Df is the domain of f and Dg is the domain of g, the domain of Dfg is

Dfg={x|xDg,g(x)Df}

Example 6.1.4

Let f(x)=2x2+5x and g(x)=2x. Find the following compositions:

  1. f(g(3))
  2. g(f(3))
  3. f(f(1))
  4. f(2g(5))
  5. g(g(4)+5)

Solution

We evaluate the expressions, one at a time, as follows:

  1. f(g(3))=f(23)=f(1)=2(1)2+5(1)=25=3
  2. g(f(3))=g(232+53)=g(18+15)=g(33)=233=31
  3. f(f(1))=f(212+51)=f(2+5)=f(7)=272+57=98+35=133
  4. f(2g(5))=f(2(25))=f(2(3))=f(6)=2(6)2+5(6)=7230=42
  5. g(g(4)+5)=g((24)+5)=g((2)+5)=g(3)=23=1

We can also calculate composite functions for arbitrary x in the domain.

Example 6.1.5

Let f(x)=x2+1 and g(x)=x+3. Find the following compositions:

  1. (fg)(x)
  2. (gf)(x)
  3. (ff)(x)
  4. (gg)(x)

Solution

  1. There are essentially two ways to evaluate (fg)(x)=f(g(x)). We can either first use the explicit formula for f(x) and then the one for g(x), or vice versa. We will evaluate f(g(x)) by substituting g(x) into the formula for f(x): (fg)(x)=f(g(x))=(g(x))2+1=(x+3)2+1=x2+6x+9+1=x2+6x+10

Similarly, we evaluate the other expressions (b)-(d):

  1. (gf)(x)=g(f(x))=f(x)+3=x2+1+3=x2+4
  2. (ff)(x)=f(f(x))=(f(x))2+1=(x2+1)2+1=x4+2x2+1+1=x4+2x2+2
  3. (gg)(x)=(g(x))=g(x)+3=x+3+3=x+6

Example 6.1.6

Find (fg)(x) and (gf)(x) for the following functions, and state their domains.

  1. f(x)=3x+2, and g(x)=x23x
  2. f(x)=|3x2|6x+4, and g(x)=5x+1
  3. f(x)=12(x4), and g(x)=2x2+4

Solution

  1. Composing fg, we obtain

    (fg)(x)=f(g(x))=3g(x)+2=3x23x+2

    The domain is the set of numbers x for which the denominator is non-zero.

    x23x+2=0(x2)(x1)=0x=2 or x=1Dfg=R{1,2}.

    Similarly,

    (gf)(x)=g(f(x))=f(x)23f(x)=(3x+2)233x+2=9(x+2)29x+2=99(x+2)(x+2)2=99x18(x+2)2=9x9(x+2)2=9(x+1)(x+2)2

    The domain is all real numbers except x=2, that is Dgf=R{2}.

  2. We calculate the compositions as follows.

    (fg)(x)=f(g(x))=|3g(x)2|6g(x)+4=|3(5x+1)2|6(5x+1)+4=|15x+1|30x2,(gf)(x)=g(f(x))=5f(x)+1=5(|3x2|6x+4)+1=5|3x2|30x+20+1=5|3x2|30x+21

    Since the domains of f and g are all real numbers, so are also the domains for both fg and gf.

  3. Again we calculate the compositions.

    (fg)(x)=f(g(x))=12(g(x)4)=12(2x2+44)=122x2=x2=|x|

    The domain of g is all real numbers, and the outputs g(x)=2x2+4 are all 4, (since 2x20). Therefore, g(x) is in the domain of f, and we have a combined domain of fg of Dfg=R. On the other hand,

    (gf)(x)=g(f(x))=2(f(x))2+4=2(12(x4))2+4=2(12(x4))+4=(x4)+4=x

    The domain of gf consists of all numbers x which are in the domain of f and for which f(x) is in the domain of g. Now, the domain of f consists of all real numbers x that give a non-negative argument in the square-root, that is: 12(x4)0. Therefore we must have x40, so that x4, and we obtain the domain Df=[4,). Since the domain Dg=R, the composition gf has the same domain as f:

    Dgf=Df=[4,)

We remark that at a first glance, we might have expected that (gf)=x has a domain of all real numbers. However, the composition g(f(x)) can only have those inputs that are also allowed inputs of f. We see that the domain of a composition is sometimes smaller than the domain that we use via the standard convention (See Convention definition).


This page titled 6.1: Operations on functions given by formulas is shared under a CC BY-NC-SA 4.0 license and was authored, remixed, and/or curated by Thomas Tradler and Holly Carley (New York City College of Technology at CUNY Academic Works) via source content that was edited to the style and standards of the LibreTexts platform.

Support Center

How can we help?