We want the simplest algebraic expression to represent any function so that we need minimum circuitry to implement it. The simplest algebraic expression is the one with minimum number of literals. We need to find a method to get the simplest expression. This method is called Karnaugh map method.
If we have n variables then there would be 2n min terms and hence 2n number of blocks in the K-map and also min terms are arranged in their gray code order (not in binary order). 2-variable map and 3-variable map are shown below:
Also there are min terms mentioned in the squares of the map
Similarly we can have a K-map for 4 variables, 5 variables, 6 variables etc but we generally use only till 4 variables maps as higher maps are difficult to use.
Now to simplify any expression we first convert the expression into its canonical form and then mark a 1 in the corresponding column of min terms present in the expression and then we’ll combine 1’s and make groups of 2 or 4 or 8 or 16 terms and then write the shortened expression.
Any two adjacent squares in the K map differ only by 1 bit change. So the thing where the term corresponding to one square differs from the term corresponding to the adjacent square is that one literal is in compliment form and same literal in other is non-compliment. So sum of those min terms would lead to elimination of one literal and simplified result would be a single AND term.
Also note that squares on one edge of the k-map are adjacent to the opposite edge of the K-map. Hence m0 is adjacent to m2, m4 is adjacent to m6 but m0 is not adjacent to m6. Similarly we can check the adjacent cells in 4-variable map.