# 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/addition-subtraction-function
Source: https://raw.githubusercontent.com/nakafaai/nakafa.com/refs/heads/main/packages/contents/material/lesson/mathematics/function-composition-inverse-function/addition-subtraction-function/en.mdx

Learn how to add and subtract functions one step at a time with domain intersection rules. Learn function operations through clear examples and practice problems.

---

## Combining Functions

Imagine you have two function machines, let's call them machine $$f$$ and machine $$g$$. Each machine has its own rules, which are its function ($$f(x)$$ and $$g(x)$$) and the raw materials it can process (its domain, $$D_f$$ and $$D_g$$). We can combine these two machines to create a new machine using addition or subtraction operations.

Visible text: Imagine you have two function machines, let's call them machine and machine . Each machine has its own rules, which are its function ( and ) and the raw materials it can process (its domain, and ). We can combine these two machines to create a new machine using addition or subtraction operations.

Component: LineEquation
Props:
- title: Function Addition Visualization
- description: Observe how the lines $$f(x)=x$$ and{" "}
$$g(x)=2$$ are added to become{" "}
$$(f+g)(x)=x+2$$.
  Visible text: Observe how the lines and{" "}
 are added to become{" "}
.
- data: [
{
points: Array.from({ length: 11 }, (_, i) => ({
x: i - 5,
y: i - 5,
z: 0,
})),
color: getColor("AMBER"),
labels: [{ text: "f(x)=x", at: 6, offset: [1, -0.5, 0] }],
},
{
points: Array.from({ length: 11 }, (_, i) => ({ x: i - 5, y: 2, z: 0 })),
color: getColor("SKY"),
labels: [{ text: "g(x)=2", at: 8, offset: [1, 0.5, 0] }],
},
{
points: Array.from({ length: 11 }, (_, i) => ({
x: i - 5,
y: i - 5 + 2,
z: 0,
})),
color: getColor("VIOLET"),
labels: [{ text: "(f+g)(x)=x+2", at: 9, offset: [1.5, -0.5, 0] }],
},
]

## Addition of Two Functions

If we want to add function $$f$$ and function $$g$$, we simply add the results from each function for the same value of $$x$$. The result is a new function we call $$(f+g)$$.

Visible text: If we want to add function and function , we simply add the results from each function for the same value of . The result is a new function we call .

```math
(f+g)(x) = f(x) + g(x)
```

**Important note:** The combined machine $$(f+g)$$ can only process raw materials (values of $$x$$) that can be processed by _both_ original machines, $$f$$ and $$g$$. So, the domain (domain of origin) of the function $$(f+g)$$ is the intersection of the domain of $$f$$ and the domain of $$g$$.

Visible text: **Important note:** The combined machine can only process raw materials (values of ) that can be processed by _both_ original machines, and . So, the domain (domain of origin) of the function is the intersection of the domain of and the domain of .

```math
D_{f+g} = D_f \cap D_g
```

This means that $$x$$ must be a member of $$D_f$$ **AND** also a member of $$D_g$$.

Visible text: This means that must be a member of **AND** also a member of .

### Example of Addition

Suppose we have two functions:

1.  $$f(x) = x^2$$, with domain $$D_f = \{x | x \in \mathbb{R}\}$$ (all
    real numbers).
2.  $$g(x) = \sqrt{x+2}$$, with domain $$D_g = \{x | x \ge -2, x \in \mathbb{R}\}$$ (all
    real numbers greater than or equal to $$-2$$, because the square root cannot be
    negative).

Visible text: 1. , with domain (all
 real numbers).
2. , with domain (all
 real numbers greater than or equal to , because the square root cannot be
 negative).

**Step** $$1$$: Determine the resulting function from addition

Visible text: **Step** : Determine the resulting function from addition

```math
(f+g)(x) = f(x) + g(x) = x^2 + \sqrt{x+2}
```

**Step** $$2$$: Determine the domain of the resulting function

Visible text: **Step** : Determine the domain of the resulting function

We find the intersection of $$D_f$$ and $$D_g$$:

Visible text: We find the intersection of and :

Component: MathContainer
Children:

```math
D_{f+g} = D_f \cap D_g = \{x | x \in \mathbb{R}\} \cap \{x | x \ge -2, x \in \mathbb{R}\}
```

```math
D_{f+g} = \{x | x \ge -2, x \in \mathbb{R}\}
```

So, the resulting function from addition is $$(f+g)(x) = x^2 + \sqrt{x+2}$$ with domain $$\{x | x \ge -2, x \in \mathbb{R}\}$$.

Visible text: So, the resulting function from addition is with domain .

## Subtraction of Two Functions

The process is similar to addition. To subtract function $$g$$ from function $$f$$, we subtract the result of $$g(x)$$ from $$f(x)$$ for the same value of $$x$$. The result is a new function $$(f-g)$$.

Visible text: The process is similar to addition. To subtract function from function , we subtract the result of from for the same value of . The result is a new function .

```math
(f-g)(x) = f(x) - g(x)
```

Its domain is also the same as for addition, namely the intersection of the domain of $$f$$ and the domain of $$g$$. Why? Because again, the value of $$x$$ must be processable by both initial functions before it can be subtracted.

Visible text: Its domain is also the same as for addition, namely the intersection of the domain of and the domain of . Why? Because again, the value of must be processable by both initial functions before it can be subtracted.

```math
D_{f-g} = D_f \cap D_g
```

### Example of Subtraction

We use the same functions as in the addition example:

1.  $$f(x) = x^2$$, $$D_f = \{x | x \in \mathbb{R}\}$$
2.  $$g(x) = \sqrt{x+2}$$, $$D_g = \{x | x \ge -2, x \in \mathbb{R}\}$$

Visible text: 1. , 
2. ,

**Step** $$1$$: Determine the resulting function from subtraction

Visible text: **Step** : Determine the resulting function from subtraction

```math
(f-g)(x) = f(x) - g(x) = x^2 - \sqrt{x+2}
```

**Step** $$2$$: Determine the domain of the resulting function
Its domain is the same as the domain of the addition result because the intersection rule is the same:

Visible text: **Step** : Determine the domain of the resulting function
Its domain is the same as the domain of the addition result because the intersection rule is the same:

```math
D_{f-g} = D_f \cap D_g = \{x | x \ge -2, x \in \mathbb{R}\}
```

So, the resulting function from subtraction is $$(f-g)(x) = x^2 - \sqrt{x+2}$$ with domain $$\{x | x \ge -2, x \in \mathbb{R}\}$$.

Visible text: So, the resulting function from subtraction is with domain .

## Practice Problems

Given the functions $$f(x) = 2x - 1$$ with $$D_f = \{x | x \in \mathbb{R}\}$$ and function $$g(x) = x^2 + 3$$ with $$D_g = \{x | x \in \mathbb{R}\}$$.

Visible text: Given the functions with and function with .

1.  Determine $$(f+g)(x)$$ and its domain $$D_{f+g}$$.
2.  Determine $$(f-g)(x)$$ and its domain $$D_{f-g}$$.
3.  Calculate the value of $$(f+g)(2)$$.
4.  Calculate the value of $$(f-g)(-1)$$.

Visible text: 1. Determine and its domain .
2. Determine and its domain .
3. Calculate the value of .
4. Calculate the value of .

### Answer Key

1.  **Finding $$(f+g)(x)$$:**

    <MathContainer>
      
    
    ```math
    (f+g)(x) = f(x) + g(x)
    ```

      
    
    ```math
    = (2x - 1) + (x^2 + 3)
    ```

      
    
    ```math
    = x^2 + 2x + 2
    ```

    </MathContainer>

    **Finding Domain $$D_{f+g}$$:**

    <MathContainer>
      
    
    ```math
    D_{f+g} = D_f \cap D_g
    ```

      
    
    ```math
    = \{x | x \in \mathbb{R}\} \cap \{x | x \in \mathbb{R}\}
    ```

      
    
    ```math
    = \{x | x \in \mathbb{R}\}
    ```

    </MathContainer>

    So, $$(f+g)(x) = x^2 + 2x + 2$$ with domain all real numbers.

2.  **Finding $$(f-g)(x)$$:**

    <MathContainer>
      
    
    ```math
    (f-g)(x) = f(x) - g(x)
    ```

      
    
    ```math
    = (2x - 1) - (x^2 + 3)
    ```

      
    
    ```math
    = 2x - 1 - x^2 - 3
    ```

      
    
    ```math
    = -x^2 + 2x - 4
    ```

    </MathContainer>

    **Finding Domain $$D_{f-g}$$:**

    <MathContainer>
      
    
    ```math
    D_{f-g} = D_f \cap D_g
    ```

      
    
    ```math
    = \{x | x \in \mathbb{R}\} \cap \{x | x \in \mathbb{R}\}
    ```

      
    
    ```math
    = \{x | x \in \mathbb{R}\}
    ```

    </MathContainer>

    So, $$(f-g)(x) = -x^2 + 2x - 4$$ with domain all real numbers.

3.  **Calculating $$(f+g)(2)$$:**

    We use the result from number $$1$$: $$(f+g)(x) = x^2 + 2x + 2$$

    <MathContainer>
      
    
    ```math
    (f+g)(2) = (2)^2 + 2(2) + 2
    ```

      
    
    ```math
    = 4 + 4 + 2
    ```

      
    
    ```math
    = 10
    ```

    </MathContainer>

4.  **Calculating $$(f-g)(-1)$$:**

    We use the result from number $$2$$: $$(f-g)(x) = -x^2 + 2x - 4$$

    <MathContainer>
      
    
    ```math
    (f-g)(-1) = -(-1)^2 + 2(-1) - 4
    ```

      
    
    ```math
    = -(1) - 2 - 4
    ```

      
    
    ```math
    = -7
    ```

    </MathContainer>

Visible text: 1. **Finding :**

 <MathContainer>
 
 

 
 

 
 

 </MathContainer>

 **Finding Domain :**

 <MathContainer>
 
 

 
 

 
 

 </MathContainer>

 So, with domain all real numbers.

2. **Finding :**

 <MathContainer>
 
 

 
 

 
 

 
 

 </MathContainer>

 **Finding Domain :**

 <MathContainer>
 
 

 
 

 
 

 </MathContainer>

 So, with domain all real numbers.

3. **Calculating :**

 We use the result from number : 

 <MathContainer>
 
 

 
 

 
 

 </MathContainer>

4. **Calculating :**

 We use the result from number : 

 <MathContainer>
 
 

 
 

 
 

 </MathContainer>