How to calculate the silhouette coefficient?

Calculate the silhouette coefficient of point Pi from the above image.

To apply the given formula, how to know which is a(i) and b(i)?

a(i) : the average distance between 'i' and all other data within the same cluster (source)

b(i) : the lowest average distance of 'i' to all points in any other cluster, of which 'i' is not a member (source)

So, from the question, a(i) will be 24 as point 'Pi' belongs to cluster A and b(i) will be 48 as it is the least average distance that 'Pi' has from any other cluster than A (to which it belongs).

So, as a(i) < b(i), silhouette coefficient s(i) = 1 - 24/48 = 0.5

$$a_i = 24$$

$$b_i = (48 + 72)/2=60$$

$$1 - 24/60 =.6$$