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

Learn mode and median calculations with simple examples. Find middle values and the most frequent data points in a small dataset.

---

## Measures of Central Tendency

In statistics, we often want to know where the "center" of our data lies. Mode and Median are two ways to see this center or tendency of the data.

## Median: The Middle Value

The median is simply the **data value that is exactly in the middle** after all data has been sorted from smallest to largest.

**How to Find the Median:**

Component: MathContainer
Children:

```math
\text{1. Sort Data: From smallest to largest}
```

```math
\text{2. Find the Middle Position}
```

- **If the number of data points is odd ($$n$$ is odd):**

  
  
  ```math
  \text{Median} = \text{Value at position } \frac{n+1}{2}
  ```

  **Example (Odd Data):**

  Suppose the test scores of $$5 \text{ students}$$ are: $$7, 8, 6, 9, 7$$

  Sort: $$6, 7, 7, 8, 9$$ (there are $$5$$ data points, $$n=5$$)

  Middle position: $$(5+1)/2 = 3$$. The data at the $$3^{\text{rd}}$$ position is $$7$$.

  So, $$\text{Median} = 7$$.

- **If the number of data points is even ($$n$$ is even):**

  
  
  ```math
  \text{Median} = \frac{\text{Value at position }(n/2) + \text{Value at position }((n/2)+1)}{2}
  ```

  **Example (Even Data):**

  Suppose the test scores of $$6 \text{ students}$$ are: $$7, 8, 6, 9, 7, 10$$

  Sort: $$6, 7, 7, 8, 9, 10$$ (there are $$6$$ data points, $$n=6$$)

  Middle positions: Position $$6/2 = 3$$ and position $$(6/2) + 1 = 4$$.

  The two middle numbers are $$7$$ and $$8$$.

  Median is the average of $$7$$ and $$8$$: $$(7+8)/2 = 7.5$$.

  So, Median is $$7.5$$.

Visible text: - **If the number of data points is odd ( is odd):**

 
 

 **Example (Odd Data):**

 Suppose the test scores of are: 

 Sort: (there are data points, )

 Middle position: . The data at the position is .

 So, .

- **If the number of data points is even ( is even):**

 
 

 **Example (Even Data):**

 Suppose the test scores of are: 

 Sort: (there are data points, )

 Middle positions: Position and position .

 The two middle numbers are and .

 Median is the average of and : .

 So, Median is .

The median is useful because it is not heavily affected by extremely large or small values (outliers) at the ends of the data.

## Mode: The Most Frequent Value

The mode is even simpler. The mode is the **data value that appears most often** or has the highest frequency.

**How to Find the Mode:**

Component: MathContainer
Children:

```math
\text{1. Count the frequency of each data value}
```

```math
\text{2. Find the data value with the highest frequency}
```

**Example:**

Test scores data:

```math
7, 8, 6, 9, 7, 8, 7
```

- Score $$6$$ appears $$1 \text{ time}$$
- Score $$7$$ appears $$3 \text{ times}$$
- Score $$8$$ appears $$2 \text{ times}$$
- Score $$9$$ appears $$1 \text{ time}$$

Visible text: - Score appears 
- Score appears 
- Score appears 
- Score appears

The most frequent score is $$7$$ (appears $$3 \text{ times}$$).

Visible text: The most frequent score is (appears ).

So, the mode is $$7$$.

Visible text: So, the mode is .

**Important Notes about Mode:**

- A dataset might have **no mode** (if all values appear with the same frequency).
- It can have **one mode** (unimodal).
- It can have **two modes** (bimodal), if there are two values with the same highest frequency.
- It can have **more than two modes** (multimodal).

Like the median, the mode is also not affected by extreme values (outliers).

## Range Shows Data Spread

Besides looking at the center of the data with mode and median, sometimes we also need to know how **spread out** our data is. One of the simplest ways is to look at the **Range**.

The range is the **difference between the largest and smallest data values**.

```math
\text{Range} = \text{Largest Data} - \text{Smallest Data}
```

**Example:**

Data: $$6, 7, 7, 8, 9, 10$$

Visible text: Data:

Largest data $$= 10$$

Visible text: Largest data

Smallest data $$= 6$$

Visible text: Smallest data

Range $$= 10 - 6 = 4$$

Visible text: Range

The range gives us a quick idea of how far our data spreads from end to end.

So, Median and Mode focus on the "center" of the data, while Range focuses on the "spread" of the data.