How Does Color Conversion and Downsampling work When JPEG compressing a grayscale image?
Normally, monochrome images should be stored as images with a single channel. However, I have seen digital images with three channels containing the same values. This results in a displayed image looking grayscale.
Before compression multichannel data, it is common to decorrelate the channels. For RGB, one often concert them to luminance and chrominances. Several formulae can be seen, linear and nonlinear, to convert $R$, $G$ and $B$ to $L$ and the two $C_x$:
$$ L= \mathrm{c2l}(R,G,B)$$
and
$$ C_x= \mathrm{c2r}_x(R,G,B)$$
In most cases I know, for the same repeated channel (say $R$, but whatever),
$$ L= \mathrm{c2l}(R,R,R)\simeq R$$
and
$$ C_x= \mathrm{c2r}_x(R,R,R)\simeq 0$$
so the compression code will naturally &quot;cancel&quot; the unnecessary channel triplication for a grayscale image. As a side node, this can be the cause of errors in computing compression ratios,  as the original image is three times the size it should have been. This uses to happen  in  monaural (mono) audio stored on two duplicated stereo channels.
To be more concrete, with the classical linear YUV conversion:
Y =  0.299R + 0.587G + 0.114B
U = -0.147R - 0.289G + 0.436B
V =  0.615R - 0.515G - 0.100B

and since:
 0.299 + 0.587 + 0.114 = 1
-0.147 - 0.289 + 0.436 = 0
 0.615 - 0.515 - 0.100 = 0

one can see that the chrominance images are zero (or close to zero for nonlinear transforms), and remain very small in amplitude after DCT and subsampling, and will be unnoticeable in JPEG compression.