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

Learn step function modeling with real-world applications like bookstore discounts, elevator capacity, and floor/ceiling functions. Learn piecewise graphing.

---

## Understanding Step Functions

A step function is a type of mathematical function that has constant values on certain intervals and experiences sudden jumps at specific points. The graph of this function resembles stairs, with horizontal lines connecting points of discontinuity.

### Mathematical Definition

A step function can be defined as a piecewise function of the form:

```math
f(x) = \begin{cases} c_1, & \text{if } a_1 \leq x < b_1 \\ c_2, & \text{if } a_2 \leq x < b_2 \\ c_3, & \text{if } a_3 \leq x < b_3 \\ \vdots \\ c_n, & \text{if } a_n \leq x < b_n \end{cases}
```

where $$c_1, c_2, c_3, \ldots, c_n$$ are constants and $$[a_i, b_i)$$ are non-overlapping intervals.

Visible text: where are constants and are non-overlapping intervals.

**Characteristics of step functions:**

- Constant values on each interval
- Jump discontinuities at interval boundary points
- Graph shaped like stairs
- Belongs to the category of piecewise functions

## Types of Step Functions

### Floor Function

The floor function, denoted by $$\lfloor x \rfloor$$, gives the largest integer less than or equal to $$x$$.

Visible text: The floor function, denoted by , gives the largest integer less than or equal to .

```math
\lfloor x \rfloor = \max\{n \in \mathbb{Z} : n \leq x\}
```

To make it easier to understand, let's look at the following example:

Component: LineEquation
Props:
- title: Floor Function $$f(x) = \lfloor x \rfloor$$
  Visible text: Floor Function
- description: The graph shows the floor function that gives the largest integer value
that does not exceed x.
- data: [
{
points: Array.from({ length: 41 }, (_, i) => {
const x = (i - 20) * 0.25;
return { x, y: Math.floor(x), z: 0 };
}),
color: getColor("PURPLE"),
showPoints: false,
smooth: false,
labels: [{ text: "f(x) = ⌊x⌋", at: 30, offset: [1, -1, 0] }],
},
]
- cameraPosition: [0, 0, 12]
- showZAxis: false

**Floor function value table:**

| $$x$$ | $$-2.5$$ | $$-1.7$$ | $$-1$$ | $$-0.3$$ | $$0$$ | $$0.8$$ | $$1$$ | $$1.9$$ | $$2.4$$ |
| --------------------------------------- | ---- | ---- | --- | ---- | --- | --- | --- | --- | --- |
| $$\lfloor x \rfloor$$ | $$-3$$ | $$-2$$ | $$-1$$ | $$-1$$ | $$0$$ | $$0$$ | $$1$$ | $$1$$ | $$2$$ |

Visible text: | | | | | | | | | | |
| --------------------------------------- | ---- | ---- | --- | ---- | --- | --- | --- | --- | --- |
| | | | | | | | | | |

### Ceiling Function

The ceiling function, denoted by $$\lceil x \rceil$$, gives the smallest integer greater than or equal to $$x$$.

Visible text: The ceiling function, denoted by , gives the smallest integer greater than or equal to .

```math
\lceil x \rceil = \min\{n \in \mathbb{Z} : n \geq x\}
```

Let's look at the following example:

Component: LineEquation
Props:
- title: Ceiling Function $$f(x) = \lceil x \rceil$$
  Visible text: Ceiling Function
- description: The graph shows the ceiling function that gives the smallest integer value
that is not less than x.
- data: [
{
points: Array.from({ length: 41 }, (_, i) => {
const x = (i - 20) * 0.25;
return { x, y: Math.ceil(x), z: 0 };
}),
color: getColor("ORANGE"),
showPoints: false,
smooth: false,
labels: [{ text: "f(x) = ⌈x⌉", at: 30, offset: [1, -1, 0] }],
},
]
- cameraPosition: [0, 0, 12]
- showZAxis: false

### Unit Step Function (Heaviside)

The unit step function or Heaviside function, denoted by $$H(x)$$ or $$u(x)$$, is defined as:

Visible text: The unit step function or Heaviside function, denoted by or , is defined as:

```math
H(x) = \begin{cases} 0, & \text{if } x < 0 \\ 1, & \text{if } x \geq 0 \end{cases}
```

Unlike the floor and ceiling functions, the unit step function has a value of $$0$$ for $$x < 0$$ and $$1$$ for $$x \geq 0$$.

Visible text: Unlike the floor and ceiling functions, the unit step function has a value of for and for .

Component: LineEquation
Props:
- title: Unit Step Function $$H(x)$$
  Visible text: Unit Step Function
- description: The graph shows the unit step function that jumps from $$0$$ to{" "}
$$1$$ at point $$x = 0$$.
  Visible text: The graph shows the unit step function that jumps from to{" "}
 at point .
- data: [
{
points: Array.from({ length: 21 }, (_, i) => {
const x = i - 10;
return { x, y: x >= 0 ? 1 : 0, z: 0 };
}),
color: getColor("TEAL"),
showPoints: false,
smooth: false,
labels: [{ text: "H(x)", at: 12, offset: [1, 0.5, 0] }],
},
]
- cameraPosition: [0, 0, 12]
- showZAxis: false

## Properties of Step Functions

**General properties:**

1. Domain: $$\mathbb{R}$$ (usually)
2. Range: Set of discrete values
3. Continuity: jump discontinuities at certain points

Visible text: 1. Domain: (usually)
2. Range: Set of discrete values
3. Continuity: jump discontinuities at certain points

**Special properties of floor and ceiling functions:**

1. $$\lfloor x \rfloor \leq x < \lfloor x \rfloor + 1$$
2. $$\lceil x \rceil - 1 < x \leq \lceil x \rceil$$
3. $$\lceil x \rceil = \lfloor x \rfloor + 1 \text{ if} x \notin \mathbb{Z}$$
4. $$\lceil x \rceil = \lfloor x \rfloor \text{ if} x \in \mathbb{Z}$$

Visible text: 1. 
2. 
3. 
4.

**Comparison table of floor and ceiling functions:**

| $$x$$ | $$\lfloor x \rfloor$$ | $$\lceil x \rceil$$ | Difference |
| ---- | --------------------------------------- | ------------------------------------- | ---------- |
| $$-2.3$$ | $$-3$$ | $$-2$$ | $$1$$ |
| $$-1$$ | $$-1$$ | $$-1$$ | $$0$$ |
| $$0.7$$ | $$0$$ | $$1$$ | $$1$$ |
| $$2$$ | $$2$$ | $$2$$ | $$0$$ |
| $$3.8$$ | $$3$$ | $$4$$ | $$1$$ |

Visible text: | | | | Difference |
| ---- | --------------------------------------- | ------------------------------------- | ---------- |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |

## Transformations of Step Functions

### Vertical Translation

The function $$f(x) = \lfloor x \rfloor + k$$ shifts the floor function graph upward (if $$k > 0$$) or downward (if $$k < 0$$).

Visible text: The function shifts the floor function graph upward (if ) or downward (if ).

Component: LineEquation
Props:
- title: Vertical Translation of Floor Function
- description: Comparison of $$f(x) = \lfloor x \rfloor$$ with{" "}
$$g(x) = \lfloor x \rfloor + 2$$ and{" "}
$$h(x) = \lfloor x \rfloor - 1$$.
  Visible text: Comparison of with{" "}
 and{" "}
.
- data: [
{
points: Array.from({ length: 41 }, (_, i) => {
const x = (i - 20) * 0.25;
return { x, y: Math.floor(x), z: 0 };
}),
color: getColor("PURPLE"),
showPoints: false,
smooth: false,
labels: [{ text: "f(x) = ⌊x⌋", at: 30, offset: [0, 0.5, 0] }],
},
{
points: Array.from({ length: 41 }, (_, i) => {
const x = (i - 20) * 0.25;
return { x, y: Math.floor(x) + 2, z: 0 };
}),
color: getColor("CYAN"),
showPoints: false,
smooth: false,
labels: [{ text: "g(x) = ⌊x⌋ + 2", at: 30, offset: [0, 0.5, 0] }],
},
{
points: Array.from({ length: 41 }, (_, i) => {
const x = (i - 20) * 0.25;
return { x, y: Math.floor(x) - 1, z: 0 };
}),
color: getColor("ROSE"),
showPoints: false,
smooth: false,
labels: [{ text: "h(x) = ⌊x⌋ - 1", at: 30, offset: [2, 0.5, 0] }],
},
]
- cameraPosition: [0, 0, 12]
- showZAxis: false

### Horizontal Translation

The function $$f(x) = \lfloor x - h \rfloor$$ shifts the graph to the right (if $$h > 0$$) or to the left (if $$h < 0$$).

Visible text: The function shifts the graph to the right (if ) or to the left (if ).

## Practice Problems

1. Determine the value of $$\lfloor 3.7 \rfloor + \lceil -2.3 \rceil$$

2. A bookstore gives discounts based on the number of purchases:

Visible text: 1. Determine the value of 

2. A bookstore gives discounts based on the number of purchases:

- $$1\text{-}5$$ books: no discount
- $$6\text{-}10$$ books: $$10\%$$ discount
- $$11\text{-}20$$ books: $$15\%$$ discount
- $$> 20$$ books: $$20\%$$ discount

   If the price per book is $$\text{Rp}50{,}000$$, create a function that represents the total price after discount!

Visible text: - books: no discount
- books: discount
- books: discount
- books: discount

 If the price per book is , create a function that represents the total price after discount!

3. Graph of function $$f(x) = 2\lfloor x \rfloor - 1$$ for $$-3 \leq x \leq 3$$

4. Solve the equation $$\lfloor 2x + 1 \rfloor = 5$$

5. An elevator can accommodate a maximum of $$8 \text{ people}$$. If there are $$n \text{ people}$$ who want to use the elevator, how many times must the elevator operate?

Visible text: 3. Graph of function for 

4. Solve the equation 

5. An elevator can accommodate a maximum of . If there are who want to use the elevator, how many times must the elevator operate?

### Answer Key

1. **Calculating floor and ceiling function values:**

   <MathContainer>
     
   
   ```math
   \lfloor 3.7 \rfloor = 3 \text{ (largest integer} \leq 3.7\text{)}
   ```

     
   
   ```math
   \lceil -2.3 \rceil = -2 \text{ (smallest integer} \geq -2.3\text{)}
   ```

     
   
   ```math
   \lfloor 3.7 \rfloor + \lceil -2.3 \rceil = 3 + (-2) = 1
   ```

   </MathContainer>

2. **Bookstore discount function model:**

   Let $$n$$ be the number of books purchased, then the total price after discount is:

   <MathContainer>
     
   
   ```math
   H(n) = \begin{cases} 50000n, & \text{if } 1 \leq n \leq 5 \\ 50000n \times 0.9, & \text{if } 6 \leq n \leq 10 \\ 50000n \times 0.85, & \text{if } 11 \leq n \leq 20 \\ 50000n \times 0.8, & \text{if } n > 20 \end{cases}
   ```

   </MathContainer>

3. **Graph of function $$f(x) = 2\lfloor x \rfloor - 1$$:**

   For each interval:

   - $$-3 \leq x < -2: f(x) = 2(-3) - 1 = -7$$
   - $$-2 \leq x < -1: f(x) = 2(-2) - 1 = -5$$
   - $$-1 \leq x < 0: f(x) = 2(-1) - 1 = -3$$
   - $$0 \leq x < 1: f(x) = 2(0) - 1 = -1$$
   - $$1 \leq x < 2: f(x) = 2(1) - 1 = 1$$
   - $$2 \leq x \leq 3: f(x) = 2(2) - 1 = 3$$

   If we create the graph, it would look approximately like the following:

   <LineEquation
     title={
       <>
         Graph of $$f(x) = 2\lfloor x \rfloor - 1$$
       </>
     }
     description={
       <>
         The graph shows the transformation of the floor function with a scale
         factor of $$2$$ and vertical translation of $$-1$$.
       </>
     }
     data={[
       {
         points: Array.from({ length: 25 }, (_, i) => {
           const x = (i - 12) * 0.25;
           return { x, y: 2 * Math.floor(x) - 1, z: 0 };
         }),
         color: getColor("VIOLET"),
         showPoints: false,
         smooth: false,
         labels: [{ text: "f(x) = 2⌊x⌋ - 1", at: 18, offset: [1, 1, 0] }],
       },
     ]}
     cameraPosition={[0, 0, 10]}
     showZAxis={false}
   />

4. **Solving the equation $$\lfloor 2x + 1 \rfloor = 5$$:**

   <MathContainer>
     
   
   ```math
   5 \leq 2x + 1 < 6
   ```

     
   
   ```math
   4 \leq 2x < 5
   ```

     
   
   ```math
   2 \leq x < 2.5
   ```

   </MathContainer>

   So the solution set is $$x \in [2, 2.5)$$.

5. **Calculating the number of elevator operations:**

   If there are $$n \text{ people}$$ and the elevator can accommodate a maximum of $$8 \text{ people}$$, then the number of elevator operations required is:

   
   
   ```math
   f(n) = \lceil \frac{n}{8} \rceil
   ```

   The ceiling function is used because if there are remaining people (less than $$8$$), one additional elevator operation is still required.

Visible text: 1. **Calculating floor and ceiling function values:**

 <MathContainer>
 
 

 
 

 
 

 </MathContainer>

2. **Bookstore discount function model:**

 Let be the number of books purchased, then the total price after discount is:

 <MathContainer>
 
 

 </MathContainer>

3. **Graph of function :**

 For each interval:

 - 
 - 
 - 
 - 
 - 
 - 

 If we create the graph, it would look approximately like the following:

 <LineEquation
 title={
 <>
 Graph of 
 </>
 }
 description={
 <>
 The graph shows the transformation of the floor function with a scale
 factor of and vertical translation of .
 </>
 }
 data={[
 {
 points: Array.from({ length: 25 }, (_, i) => {
 const x = (i - 12) * 0.25;
 return { x, y: 2 * Math.floor(x) - 1, z: 0 };
 }),
 color: getColor("VIOLET"),
 showPoints: false,
 smooth: false,
 labels: [{ text: "f(x) = 2⌊x⌋ - 1", at: 18, offset: [1, 1, 0] }],
 },
 ]}
 cameraPosition={[0, 0, 10]}
 showZAxis={false}
 />

4. **Solving the equation :**

 <MathContainer>
 
 

 
 

 
 

 </MathContainer>

 So the solution set is .

5. **Calculating the number of elevator operations:**

 If there are and the elevator can accommodate a maximum of , then the number of elevator operations required is:

 
 

 The ceiling function is used because if there are remaining people (less than ), one additional elevator operation is still required.