# Advantages of a Gray code in 16-QAM

I'm looking at a system using a gray code on 16-QAM. When a symbol changes, you move from one of the 16 symbols in the constellation to any of the 16 symbols. I'm wondering if there is in fact an advantage to using a Gray coding? It seems to me to just be arbitrarily renumbering the constellation and won't actually change the performance.

In the theory and practical world of today's Digital Communications, Source and Channel are separated way too much. Source coding happens somewhere up in the 6th or 5th layer of the Protocol stack and Channel coding occurs at the PHY layer(layer 1), beyond which Modulation happens. So when it comes to transmission at the Physical layer, for a systems designer, it is plausible to assume that the source sequences are i.i.d Binary digits with equal prior probabilities.

For bandlimited systems design with a maximum power constraint put on it (like our cellphones), where you don't have too much bandwidth to just signal using binary alphabets i.e. you end up using a bigger constellation at the cost of incurring more decoding/demodulation complexity, lesser separation between sequences (because of power limit) and other parameters, there is one paradigm which treats Coding and Modulation together (eg. see Trellis coded modulation [1]) and the other which treats them independently. Unfortunately when you treat Coding and Modulation separately, there's still no conclusive proof of Mathematical formulation of Minimum distances between sequences of codes that are mapped onto the modulator. Having said this all,

1. If you use Trellis coded modulation, Gray mapping is not ideal; what is rather ideal has been set forth by Ungerboeck's rule of Mapping by set partitioning (in an optimal real world sense). You should refer to [1].

2. If you decouple Coding and Modulation for bandlimited system design, since there's still no concrete mathematical formulation for system performance, it doesn't matter what you use as the Mapping.

3. But for an uncoded system, Gray Mapping is always optimal in a sense that it minimizes the number of bits that can be demodulated with error when using Maximum Likelihood Demodulation (or Minimum Distance).

So if you're working with a coded system, there are guidelines for mapping the case of Trellis coded modulation. For Non-Binary(systems design in the bandlimited case without Convolutional codes i.e. using Block codes for bandlimited signaling) case, bad luck; there's still nothing. If you're someone who's analyzing a system in an uncoded fashion, Gray mapping is the optimal. Performance of different systems can be predicted using mathematical formulations pretty easily except for the 2nd case. For any coded system in power-limited regime, Probability of error can be derived.

For the uncoded systems, enough mathematical formulation have appeared already for ML Demodulation over AWGN and Fading Channels. Also note that Gray coding is ideal in the case of AWGN receiver(with or without fading) over which most of the analysis is usually made.

[1] G. Ungerboeck, “Channel coding with multilevel/phase signals,” IEEE Trans. Inform. Theory, vol. IT-28, pp. 55–67, Jan. 1982.

On an ideal basis your statement is true. A gray code minimizes the entropy change between adjacent states in a sequence, since you can't predict the order of the data sequence coming at the modulator this is just addition complexity. If your data is coming in an orderly fashion, I'd suggest that a gray coding would be dis-advantageous as it forces the data pattern into sub-regions of the constellation and minimizes the separation within the constellation space. You would end up with bursts of lower SNR.