How to Calculate Median, Mode and Covariance

Like Mathematics, Statistics are also one of the most difficult university subjects to study and learn. Statistics is a discipline made up of characters , that is, aspects of reality that can be observed (the state of a beach, the profession of a person who works) and  variables,  in the sense that they can take on different expressions (bathing, polluted; shoemaker, writer, deputy, director). These, in turn, must be able to be detected on the subjects who express them ( statistical units ); the latter must belong to a  community  (a single data collected on a single individual is of no interest in statistics!). Statistics therefore have two main objectives: to synthesize, that is, to prepare the data collected in a form (tables, graphs, numerical summaries) that allows a better understanding of the phenomena with respect to which the survey was performed. Its second objective is to synthesize , that is , to extend the result of the analysis carried out on the data of a limited group of statistical units ( sample ) to the entire community to which it belongs ( universe, population ).

Today I would like to give a short guide on how to easily and effortlessly calculate the median, the mode and the covariance, which are the main basis of mathematical and scientific disciplines.

Table of Contents


In descriptive statistics, the median term indicates the value  (or set of values) assumed by the statistical units that are in the middle of the distribution… .. if the data are odd; while it is the sum of the two values ​​divided by two if the data is an even number. In particular, to calculate the median:

  • the numbers (n) are sorted in ascending (or descending) order;
  • if the number of data is odd, the median corresponds to the central value, i.e. the value that occupies the position (n + 1) / 2
  • if the data in question are odd, the median is estimated using the two values ​​that occupy the positions (n ​​/ 2) and [(n / 2) + 1]. Generally, however, their arithmetic mean is chosen if the character is quantitative.

So, if the data list is made up of the numbers: 18 24 32 60 70, the median is 32 (that is, the value in the center). If the list is made up of odd-numbered data such as 5 22 34 52, the median is 28: that is: 22 + 34 = 56/2 = 28.


The  mode  or  norm  of the frequency distribution X, is the modality (or class of modality) characterized by the maximum frequency and is often represented with the symbology  ν 0 . In practice, it is the value that appears most frequently.

This means that if we have this list of data: 2 2 4 5 6 7 8, the mode is 2; that is the number that is repeated several times. In the sequence 45 46 46 47 48 50 50, on the other hand, there are two fashions: 46 and 50. There are cases in which the fashion can be null, as no number is repeated.


The  covariance  is a statistical indicator that expresses the dependence between two variables. That is, it measures how much these vary together and is calculated by observing precisely how these variables are distributed. Let’s see how to calculate it. First of all, the calculation explains when two variables have a trend that varies simultaneously and therefore provides us with an indication of the degree of  dependence  between the two. To calculate the covariance, we must start from the distribution of two random variables: thus having the set of values ​​that the two variables assume, we can calculate the average. The variance is nothing more than the expected value (E) of the product of the distances of the two variables from the respective mean, in statistics indicated with E (variable). The formula is: Cov (X, Y) = E [(X – E [X]] * (Y – E [Y])].

Let’s take an example. The variable X takes values: 3,5,7.

The variable Y takes values: 3,6,9. First of all, it will be necessary to calculate the expected values ​​of the two variables (ie the averages). E [X] = (3 + 5 + 7) / 3 = 5. E [Y] = 6 (calculated with the same procedure). Now we need to calculate the distances of the variables from the mean, obtaining for the variable X: -2 (3-5), 0 (5-5), 2 (7-5). Similarly for Y we will have: -3, 0, 3. At this point, we calculate the product of these differences by obtaining 6 (-2 x -3), 0 (0 x 0), 6 (2 x 3). Finally, we need to calculate the average of these products to get the covariance, which in this case is equal to 4 (i.e. the average of 6, 0 and 6).

by Abdullah Sam
I’m a teacher, researcher and writer. I write about study subjects to improve the learning of college and university students. I write top Quality study notes Mostly, Tech, Games, Education, And Solutions/Tips and Tricks. I am a person who helps students to acquire knowledge, competence or virtue.

Leave a Comment