We know that \cos \frac{\pi}{9},\cos \frac{5\pi}{9},\cos \frac{7\pi}{9} are different and they are
roots of equation \cos 3x = \cos \frac{\pi}{3} = \frac{1}{2}
or 4\cos^3 x - 3\cos\,x =\frac{1}{2}
or
so \cos\frac{\pi}{9}, \cos\frac{5\pi}{9}, \cos\frac{7\pi}{9} are roots of equation
x^3 - \frac{3}{4}x - \frac{1}{8}= 0
let x_1= \cos\frac{\pi}{9}, x_2 = \cos\frac{5\pi}{9}, x_3=\cos\frac{7\pi}{9}
Now x_1,x_2,x_3 are roots of equation
f(x) = x^3 - \frac{3}{4}x - \frac{1}{8}= 0\cdots(1)
by Vieta's formula we have
x_1 + x_2 + x_3 = 0\cdots(2)
x_1 x_2 + x_2x_3 + x_3 x_1 = \frac{-3}{4}\cdots(3)
Further f(1) = (1-x_1)(1-x_2)(1-x_3) = 1- \frac{1}{4} - \frac{1}{8} = \frac{1}{8}\cdots(3)
And we need to evaluate \frac{1}{1-x_1 } + \frac{1}{1-x_2} + \frac{1}{1-x_3}
Now
\frac{1}{1-x_1 } + \frac{1}{1-x_2} + \frac{1}{1-x_3}
= \frac{(1-x_2)(1-x_3) + (1-x_1)(1-x_3) + (1-x_1)(1-x_2)}{(1-x_1)(1-x_2)(1-x_3)}
= \frac{1-x_2 - x_3 + x_2x_3 + 1-x_1 - x_3 + x_1x_3 + 1-x_1 - x_2 + x_1x_2}{(1-x_1)(1-x_2)(1-x_3)}
= \frac{3 - 2(x_1 + x_2 + x_3) + (x_2x_3 + x_3x_1 + x_1x_2)}{(1-x_1)(1-x_2)(1-x_3)}
= \frac{3 - 2 * 0 + \frac{-3}{4}}{\frac{1}{8}} putting the values using (2) , (3) and (4)
= 18
Hence \frac{1}{1-\cos \frac{\pi}{9}} + \frac{1}{1-\cos \frac{5\pi}{9}} + \frac{1}{1-\frac{7\pi}{9}}= 18