Given a dataset that is sorted either in ascending or descending order, the median divides the data into two parts. The general formula for calculating the median is as follows:
Here, n is the number of items in the data. The steps involved in calculating the median are as follows:
- Sort the numbers in either ascending or descending order.
- If n is odd, find the (n+1)/2th term. The value corresponding to this term is the median.
- If n is even, find the (n+1)/2th term. The median value is the average of numbers on either side of the median position.
For a set of integers such as x, we must arrange them in ascending order and then select the middle integer.
x in ascending order = (2,2,3,4,5,6,8,9,12).
Here, the median is 5.