# Nakafa Learning Content

> For AI agents: use [llms.txt](https://nakafa.com/llms.txt) for the site index. Markdown versions are available by appending `.md` to content URLs or sending `Accept: text/markdown`.

URL: https://nakafa.com/en/subjects/mathematics/function-composition-inverse-function/properties-of-function-composition
Source: https://raw.githubusercontent.com/nakafaai/nakafa.com/refs/heads/main/packages/contents/material/lesson/mathematics/function-composition-inverse-function/properties-of-function-composition/en.mdx

Explore function composition properties: non-commutative order, associative grouping, and identity elements. Learn (f∘g) rules with proofs.

---

## Properties of Function Composition

Function composition, which involves combining functions sequentially, has several important properties we need to know. Let's study these properties using the following example functions:

Component: MathContainer
Children:

```math
f(x) = 2x + 1
```

```math
g(x) = x^2 + 4
```

```math
h(x) = \frac{1}{x+1}
```

### Non-Commutative Property

The first and most common property is that the order in which functions are composed **matters**. Changing the order of functions usually results in a different composite function.

In general, $$(f \circ g)(x)$$ is **not equal to** $$(g \circ f)(x)$$.

Visible text: In general, is **not equal to** .

**Example:**

Let's compare $$(g \circ f)(x)$$ and $$(f \circ g)(x)$$.

Visible text: Let's compare and .

1.  **Calculating $$(g \circ f)(x)$$:**

    <MathContainer>
      
    
    ```math
    (g \circ f)(x) = g(f(x)) = g(2x+1)
    ```

      
    
    ```math
    g(2x+1) = (2x+1)^2 + 4 = (4x^2 + 4x + 1) + 4 = 4x^2 + 4x + 5
    ```

    </MathContainer>

2.  **Calculating $$(f \circ g)(x)$$:**

    <MathContainer>
      
    
    ```math
    (f \circ g)(x) = f(g(x)) = f(x^2+4)
    ```

      
    
    ```math
    f(x^2+4) = 2(x^2+4) + 1 = (2x^2 + 8) + 1 = 2x^2 + 9
    ```

    </MathContainer>

Visible text: 1. **Calculating :**

 <MathContainer>
 
 

 
 

 </MathContainer>

2. **Calculating :**

 <MathContainer>
 
 

 
 

 </MathContainer>

Since $$4x^2 + 4x + 5 \neq 2x^2 + 9$$, it is proven that $$(g \circ f)(x) \neq (f \circ g)(x)$$. This property also applies to other compositions, for example $$(f \circ h)(x) \neq (h \circ f)(x)$$ and $$(g \circ h)(x) \neq (h \circ g)(x)$$.

Visible text: Since , it is proven that . This property also applies to other compositions, for example and .

### Associative Property

If we compose three or more functions, the order of **performing** the composition does not affect the final result, as long as the order of the **functions** remains the same.

Mathematically, for functions $$f$$, $$g$$, and $$h$$, the following holds:

Visible text: Mathematically, for functions , , and , the following holds:

```math
((f \circ g) \circ h)(x) = (f \circ (g \circ h))(x)
```

This means we can compose $$f$$ with $$g$$ first, and then compose the result with $$h$$. Alternatively, we can compose $$g$$ with $$h$$ first, and then compose $$f$$ with the result. The outcome will be the same.

Visible text: This means we can compose with first, and then compose the result with . Alternatively, we can compose with first, and then compose with the result. The outcome will be the same.

**Example:**

Let's check if $$((f \circ g) \circ h)(x) = (f \circ (g \circ h))(x)$$.

Visible text: Let's check if .

1.  **Calculating $$((f \circ g) \circ h)(x)$$:**

    We already know $$(f \circ g)(x) = 2x^2 + 9$$.

    <MathContainer>
      
    
    ```math
    ((f \circ g) \circ h)(x) = (f \circ g)(h(x)) = (f \circ g)(\frac{1}{x+1})
    ```

      
    
    ```math
    (f \circ g)(\frac{1}{x+1}) = 2\left(\frac{1}{x+1}\right)^2 + 9 = \frac{2}{(x+1)^2} + 9
    ```

    </MathContainer>

2.  **Calculating $$(f \circ (g \circ h))(x)$$:**

    First, find $$(g \circ h)(x)$$:

    <MathContainer>
      
    
    ```math
    (g \circ h)(x) = g(h(x)) = g(\frac{1}{x+1})
    ```

      
    
    ```math
    g(\frac{1}{x+1}) = \left(\frac{1}{x+1}\right)^2 + 4 = \frac{1}{(x+1)^2} + 4
    ```

    </MathContainer>

    Now, compose $$f$$ with this result:

    <MathContainer>
      
    
    ```math
    (f \circ (g \circ h))(x) = f((g \circ h)(x)) = f\left(\frac{1}{(x+1)^2} + 4\right)
    ```

      
    
    ```math
    f\left(\frac{1}{(x+1)^2} + 4\right) = 2\left(\frac{1}{(x+1)^2} + 4\right) + 1 = \frac{2}{(x+1)^2} + 8 + 1 = \frac{2}{(x+1)^2} + 9
    ```

    </MathContainer>

Visible text: 1. **Calculating :**

 We already know .

 <MathContainer>
 
 

 
 

 </MathContainer>

2. **Calculating :**

 First, find :

 <MathContainer>
 
 

 
 

 </MathContainer>

 Now, compose with this result:

 <MathContainer>
 
 

 
 

 </MathContainer>

Since both results are the same ($$\frac{2}{(x+1)^2} + 9$$), the associative property is proven to hold: $$((f \circ g) \circ h)(x) = (f \circ (g \circ h))(x)$$.

Visible text: Since both results are the same (), the associative property is proven to hold: .

This associative property also applies to other combinations of function order, such as $$((h \circ f) \circ g)(x) = (h \circ (f \circ g))(x)$$ and $$((g \circ f) \circ h)(x) = (g \circ (f \circ h))(x)$$.

Visible text: This associative property also applies to other combinations of function order, such as and .

### Identity Element

There is a special function called the **identity function**, denoted by $$I(x)$$, which is defined as $$I(x) = x$$. This function does not change its input.

Visible text: There is a special function called the **identity function**, denoted by , which is defined as . This function does not change its input.

If a function $$f$$ is composed with the identity function $$I$$ (from either the left or the right), the result is the function $$f$$ itself.

Visible text: If a function is composed with the identity function (from either the left or the right), the result is the function itself.

Component: MathContainer
Children:

```math
(f \circ I)(x) = f(I(x)) = f(x)
```

```math
(I \circ f)(x) = I(f(x)) = f(x)
```

**Example:**

With $$f(x) = 2x + 1$$:

Visible text: With :

- $$(f \circ I)(x) = f(I(x)) = f(x) = 2x + 1$$
- $$(I \circ f)(x) = I(f(x)) = I(2x+1) = 2x + 1$$

Visible text: - 
-

Both result in the function $$f(x)$$ again.

Visible text: Both result in the function again.