Median in a list of n elements(n is odd) lies at (n+1)/2 ^{th} index when the list is sorted.
Note that this is a set( and not a multiset) so all elements are distinct.
Let us sort the elements in the set and call the median at (n+1)/2^{th }as E.
A subset of 3 elements are to be chosen at random. So no. of ways of doing that is C(n,3).
Now when we calculate the median of this subset of 3 elements then also median will lie at (3+1)/2=2. This means if the elements of subset are arranged in ascending order then the middle element will be the median.
Our task is to find whether the median of these subsets of size 3 is E or not.
For that to happen the subset must contain E, an element less than E and the other element more than E so that E lies in the middle in sorted list of the subset.
How many elements are less than E in the original sorted list?
from 1 upto index(E)-1 = 1 to (n+1)/2-1 = 1 to (n-1)/2
i.e. (n-1)/2 elements
How many elements are more than E in the original sorted list?
index(E)+1 to n = (n+1)/2+1 to n = (n+3)/2 to n
So no. of elements is = n-( (n+3)/2) = (n-1)/2
Now out of the 3 elements of subset one should be E,
one should be lesser than E :
How many ways can we select one element from the original list so that it is less than E?
C(n-1/2, 1)
one should be more than E :
How many ways can we select one element from the original list so that it is more than E?
C(n-1/2, 1)
So the total probability of creating a subset such that it contains E, one element less than E and one more than E is
1x C(n-1/2,1) x C(n-1/2,1)
Total no. of subsets of 3 possible is C(n,3)
So probability = {1x C(n-1/2,1) x C(n-1/2,1)} /C(n,3)
$\frac {\frac{n-1}{2} * \frac{n-1}{2} } {\frac{n(n-1)(n-2))}{3!}} = \frac{3(n-1)}{2n(n-2)}$