# Function Composition: How to Decompose a Function

Calculus > Function Composition

In order to figure out function composition (or to decompose a function), you must be familiar with the eight common function types and with basic function transformations, like what a negative sign does to a function (flips an axis around the origin) or what happens if you add a constant (it shifts to the left that number of units). In calculus, composite functions are usually represented by f(x) and g(x), where f(x) is a function that takes some kind of action on g(x). Being able to split a function into two can be useful in calculus if the original function is too complicated to work with.

## Function Composition Sample Problem

Sample problem 1: Identify the functions in the equation f(g(x)) = -(x – 3)2 + 5

Step 1: Identify the original function(s). The original function is either going to be: linear, polynomial, square (quadratic), absolute value, square root, rational, sine or cosine. In this example, the original function is the square – (x – 3)2 (the square – (x – 3) has been shifted up five units).

Step 2: Write the functions using standard terminology (f(x) and g(x)).
f(g(x)) = -(x – 3)2 + 5, so:
g(x) = – (x – 3)2
f(x) = x + 5

Sample problem 2: Identify the functions in the equation f(g(x)) = (x + 2 / x)3

Step 1: Look for the original function f(x) — see Step 1 of sample problem 1 above. In this example, the original function isn’t an obvious example of a basic function type. However, while the function f(x) = x + 2/x isn’t a basic type, the second function g(x) — x3 is (it’s a cubic polynomial). So:
f(g(x)) = (x + 2 / x)2
f(x) = x + 2 /x
g(x) = x3

Tip: When trying to find composite functions, look for the simplest transformation, usually involving x and a cube, square, simple addition, division, multiplication, subtraction etc.. This simple transformation is either going to be f(x) or g(x).

------------------------------------------------------------------------------

If you prefer an online interactive environment to learn R and statistics, this free R Tutorial by Datacamp is a great way to get started. If you're are somewhat comfortable with R and are interested in going deeper into Statistics, try this Statistics with R track.