The given observations are already in ascending order. Adding a row corresponding to cumulative frequencies to the given data, we get
xi
3
6
9
12
13
15
21
22
fi
3
4
5
2
4
5
4
3
c.f.
3
7
12
14
18
23
27
30
Now, N=30, which is even. ∴ Median is the mean of the 15th and 16th observations. Both of the these observations lie in the cumulative frequency 18, for which the corresponding observation is 13. ∴ Median M=215th observation + 16th observation =213+13=13
Now,
∣xi−M∣
10
7
4
1
0
2
8
9
fi
3
4
5
2
4
5
4
3
fi∣xi−M∣
30
28
20
2
0
10
32
27
We have, i=1∑8fi=30 and i=1∑8fi∣xi−M∣=149
Therefore M.D. (M) =N1i=1∑8fi∣xi−M∣=301×149=4.97