Given function $f(x)= cosx – x$ is continous in the given interval $\left [ 0, \pi \right ]$
$f(0) = 1$
$f(\pi) = -(1+\pi)$
According to Mean value theorem, since $f(\pi) = -(1+\pi) \leq f(x)=0 \leq f(x)=1$
atleast one root exists in the given interval $\left [ 0, \pi \right ]$
$f'(x) = -sinx-1$ is negative in interval $\left [ 0, \pi \right ]$
Slope of $f(x)$ is negative in interval $\left [ 0, \pi \right ]$
$f(x)$ is monotonically decreasing function in interval $\left [ 0, \pi \right ]$
Hence only one root exists for $0= cosx – x$ in interval $\left [ 0, \pi \right ]$
Option $B$ is correct