This is Exercise 23 of the textbook "Abstract Algebra: Theory and Applications" by Thomas W. Judson, 2016; Page 111. Chapter 8 "Algebraic Coding Theory" mainly deals with binary linear code.
Exercise 23: How many check positions are needed for a single error-correcting code with 20 information positions? With 32 information positions?
My attempt: Suppose that the number of check bits is $r$. Then we have $$2^r - 1 \ge r + 20$$ and $$2^r - 1 \ge r + 32$$ respectively. Therefore, $r$ are $5$ and $6$, respectively.
However, the (partial) answer given in the textbook (Page 331) is $r = 6$ for the case of 20 information bits:
For 20 information positions, at least 6 check bits are needed to ensure an error-correcting code.
What is wrong with my argument?
And how to solve this problem (for both cases of 20 and 32 information bits)?