The popular DEFLATE algorithm uses Huffman coding on top of Lempel-Ziv.In general, if we have a random source of data (= 1 bit entropy/bit), no encoding, including Huffman, is likely to compress it on average.  If Lempel-Ziv were perfect (which it approaches for most classes of sources, as the length goes to infinity), post encoding with Huffman wouldn't help.  Of course, Lempel-Ziv isn't perfect, at least with finite length, and so some redundancy remains.It is this remaining redundancy which the Huffman coding partially eliminates and thereby improves compression.My question is: Why is this remaining redundancy successfully eliminated by Huffman coding and not LZ? What properties of Huffman versus LZ make this happen? Would simply running LZ again (that is, encoding the LZ compressed data with LZ a second time) accomplish something similar? If not, why not? Likewise, would first compressing with Huffman and then afterwards with LZ work, and if not, why?UPDATE:It is clear that even after LZ, some redundancy will remain.  Several people have made that point.  What isn't clear is: Why is that remaining redundancy better addressed by Huffman than LZ? What's unique about it in contrast with the original source redundancy, where LZ works better than Huffman?
Why does Huffman coding eliminate entropy that Lempel-Ziv doesn't?
ds.algorithms;it.information theory;coding theory;encoding