## Composition of Functions

By combining these 2 function into 1 function, we have performed function composition, which is the focus of this section.

## Definition of Function Composition

Function composition is a method to combine existing functions. Another method is to carry out the usual algebraic operations on functions, including addition, subtraction, multiplication, & division.

We do this by performing the operations with the function outputs, defining the result as the output of our new function.

For Example, when we need to add 2 columns of numbers that represent a Father and mother’s separate annual Salaries over a period of years, with the result being their total household income.

We want to do this for every year, adding only that year’s salaries and then collecting all the data in a new column.

If F(x) is the father’s salary and M(x) is the mother’s salary in year x, and we want A to represent the total income, then we can define a new function.

A(x)=F(x)+M(x)

If this holds true for every year, then we can focus on the relation between the functions without reference to a year and write

A=F+M

Just as for this sum of 2 functions, we can define product, difference, & ratio functions for any pair of functions that have the same kinds of inputs (not always numbers) and the same kinds of outputs. In this way, we can think of adding, subtracting, multiplying, & dividing functions.

“Function Composition” is applying one function to the results of another:

→ f (x) → g(x) →

The result of f () is sent through g ()

It is written: (g o f)(x), Which means: g(f(x))

Example

f (x) = 3x+4 and g (x) = x3

x” is just a placeholder. To avoid confusion let’s just call it “input”:

f (input) = 3(input)+4

g (input) = (input)3

Let’s start:

(g o f)(x) = g (f (x))

First we apply f, then apply g to that result:

f (x) → g (x) →

(g o f)(x) = g (3x+4) = (3x+4)3

What if we reverse the order of f and g?

(f o g)(x) = f (g (x))

First we apply g, then apply f to that result:

g (x) → f (x) →

(f o g)(x) = f (x3) = 3x3+4

Get a different result!

When we reverse the order the result is rarely the same.

Be careful which function comes first.

## Symbol

The symbol for composition is a small circle:

(g o f)(x)

It is not a filled in dot: (g · f)(x), as that means multiply.

## De-Composing Function

We can go the other way and break up a function into a composition of other functions.

Example

(3x+4)3

That function can be made from two functions:

(3x+4)3 = (g o f)(x)

(3x+4)3 = g (3x+4) = g (f (x))

if we switch 3x+4 with x, we’ll get

g (x) = x3

Because g (3x+4) = g (f (x)), we get

f (x) = 3x+4

This can be useful if the original function is too complicated to work on.