# Composition Of Functions

The composition of functions is a way to build functions from separate parts. If you are unsure how they work, here is my guide explaining the process.

**Composition Of Functions**

Functions can be combined through addition, subtraction, multiplication, and division. We have to do this because sometimes multiple quantities are needed to solve a problem.

**Operations On Functions**

Generally, functions can be represented through symbolic, graphical, and numerical means. This means there are formal definitions for each type. These definitions are:

- \( (f + g)(x) = f(x) + g(x) \)
- \( (f - g)(x) = f(x) - g(x) \)
- \( (fg)(x) = f(x) * g(x) \)
- \( (\frac{f}{g}(x)) = \frac{f(x)}{g(x)} \)

The domains of the sum, difference, and product of (f) and (g) are all (x) values. However, the quotient is all (x) values except the denominator of zero.

**Example 1**

Find the domain of \( f(x) = 2 + \sqrt{x-1} \) and \( g(x) = x^2 - 4 \)

For f(x) to be defined,(x) must be 1 or greater. So the domain of f(x) is any (x) 1 or greater. The domain of g(x) is all real numbers.

**Example 2**

Evaluate \( (f + g)(4) \)

If we are looking at a graph of these two functions, we just see what the graph tells us. We can see that \( f(4) = 9 \) and \(g(4) = 2 \). That being the case:

\[ (f + g)(4) = f(4) + g(4) = 9 + 2 = 11 \]

**Example 3**

If you have: \( g(x) = 3x^2 - 6x + 2 \)

Evaluate for \( g(2) \)

\[ g(2) = 3(2)^2 - 6(2) + 2 = 12 - 12 + 2 = 2 \]

**Example 4**

If you have: \( g(x) = 3x^2 - 6x + 2 \)

Evaluate for \( g(k) \)

\[ g(k) = 3k^2 - 6k + 2 \]

**Example 5**

If you have \( g(x) = 3x^2 - 6x + 2 \)

Evaluate for \( g(x^2) \)

\[ g(x^2) = 3(x^2)^2 - 6x^2 + 2 = 3x^4 - 6x^2 + 2 \]

**Example 6**

If you have \( g(x) = 3x^2 - 6x + 2 \)

Evaluate for \( g(x + 2) \)

\[ g(x + 2) = 3(x + 2)^2 - 6(x + 2) + 2 \]

\[ g(x + 2) = 3(x^2 + 4x + 4) - 6(x + 2) + 2 \]

\[ g(x + 2) = 3x^2 + 12x + 12 - 6x - 12 + 2 \]

\[ g(x + 2) = 3x^2 + 6x + 2 \]

This is the composition of functions. If (f) and (g) are functions, then the composite of those two functions is \( (g \circ f)(x) = g(f(x)) \)

**Example 7**

Find a symbolic representation for the composite function \( g \circ f \) that converts (x) miles into inches.

Let \( f(x) = 5280x \) and \( g(x) = 12x \)

\[ (g \circ f)(x) = g(f(x)) = g(5280x) = 12(5280x) = 63360x \]

**Example 8**

Let \( f(x) = x^2 + 3x + 2 \) and \( g(x) = \frac{1}{x} \)

Evaluate \( (f \circ g)(2) \) and \( (g \circ f)(2) \)

\[ (f \circ g)(2) = f(g(2)) = f(\frac{1}{2}) = (\frac{1}{2})^2 + 3(\frac{1}{2}) + 2 = \frac{15}{4} \]

Now:

\[ (g \circ f)(2) = g(f(2)) = g(2^2 + (3)(2) + 2) = g(12) = \frac{1}{12} \]

As you can see, depending on the output of one function, the results will vary. This is because the functions are different. So, even the same (x) will give different values because of the different functions.

**Example 9**

Find representations for these functions

If \( (f \circ g)(x) \) and \( (g \circ f)(x) \)

\( f(x) = x + 2 \) and \( g(x) = x^3 - 2x^2 -1 \)

\[ (f \circ g)(x) = f(g(x)) = f(x^3 - 2x^2 - 1) \]

Function (f) adds 2 to the input

\[ f(x^3 - 2x^2 - 1) = (x^3 - 2x^2 -1) + 2 = x^3 - 2x^2 + 1 \]

To find \( (g \circ f)(x) \)

\[ (g \circ f)(x) = g(f(x)) = g(x + 2) \]

\[ g(x + 2) = (x + 2)^3 - 2(x + 2)^2 - 1 \]

This last example is the reverse process we have been using. We are going to write a function as a composition of two functions.

**Example 10**

Find functions (f) and (g) so that \( h(x) = (g \circ f)(x) \)

\[ h(x) = (x + 3)^2 \]

\( f(x) = x + 3 \) and \( g(x) = x^2 \)

\[ (g \circ f)(x) = g(f(x)) = g(x + 3) = (x + 3)^2 \]

**Example 11**

Find functions (f) and (g) so that \( h(x) = (g \circ f)(x) \)

\[ h(x) = \sqrt{2x - 7} \]

\( f(x) = 2x - 7 \) and \( g(x) = x^2 \)

\[ (g \circ f)(x) = g(f(x)) = g(2x - 7) = \sqrt{2x - 7} \]

**Example 12**

Find functions (f) and (g) so that \( h(x)= (g \circ f)(x) \)

\[ h(x) = \frac{1}{x^2 + 2x} \]

\( f(x) = x^2 + 2x \) and \( g(x) = \frac{1}{x} \)

\[ (g \circ f)(x) = g(f(x)) = g(x^2 + 2x) = \frac{1}{x^2 + 2x} \]

**Conclusion**

Addition, subtraction, multiplication, and division are used to combine functions. Composition of functions is another way of saying we are building functions from separate parts. However, composing functions is different from the former way to combine them. When composing functions, you are using the output of one function as the input of another function. This process can be reversed for different effects.