Mastering K-maps: Simplifying Expressions in Discrete Structures
School
Academies of Loudoun**We aren't endorsed by this school
Course
CHE AP
Subject
Computer Science
Date
Dec 10, 2024
Pages
9
Uploaded by HighnessUniverse20364
13.2 K-maps: IntroductionK-mapsA K-mapis a graphical function representation that eases the simpli±cation process forexpressions involving a few variables by adjacently placing minterms that differ by exactly onevariable. K-map is short for Karnaugh map. Like a country map that lays out cities next to eachother, a K-map lays out minterms instead.A K-map lays out possible minterms as adjacent cells (boxes). Adjacent minterm cells differ byexactly one variable. Each function minterm cell gets a 1; other cells get 0.A K-map is a reoriented truth table.PARTICIPATIONACTIVITY13.2.1: A two-variable K-map: Adjacent cells differ by exactly onevariable.ab0101aby00110101y =11110000a'b'ab'+a'baba'aab'bb'ab01011. The basic K-map structure for two variables has two columns (for b = 0 and b = 1)and two rows (for a = 0 and a = 1), totaling four cells.2. Like a truth table, each cell represents a possible minterm.3. In the K-map, adjacent cells differ by one variable. Ex: a'b and ab are verticallyadjacent and differ in variable a.4. Like a truth table, a designer inserts 1s in certain K-map cells to represent a function'sminterms.CaptionsStart2x speed12/3/24, 1:28 PMSection 13.2 - CSC 208 DE: Introduction to Discrete Structures | zyBookshttps://learn.zybooks.com/zybook/NVCCCSC208DEBuskeyAcademicYear2024/chapter/13/section/21/9
PARTICIPATIONACTIVITY13.2.2: Two-variable K-map basics.Given function y = ab + a'b, represented in the K-map above.1)(J) corresponds to whichminterm?2)(K) corresponds to whichminterm?3)(L) should have what value (0or 1)?4)Cells (J) and (K) differ in whatvariable: a or b?5)Cells (L) and (K) differ in whatvariable: a or b?Feedback?CheckShow answerCheckShow answerCheckShow answerCheckShow answer12/3/24, 1:28 PMSection 13.2 - CSC 208 DE: Introduction to Discrete Structures | zyBookshttps://learn.zybooks.com/zybook/NVCCCSC208DEBuskeyAcademicYear2024/chapter/13/section/22/9
6)Cells (L) and (J) differ in howmany variables?CHALLENGEACTIVITY13.2.1: Two-variable K-map basics.Select the shown minterm(s).604874.4248254.qx3zqy7Simplifying an expression with a K-mapCheckShow answerCheckShow answerFeedback?Starta' b'010123456123456abCheckNextFeedback?112/3/24, 1:28 PMSection 13.2 - CSC 208 DE: Introduction to Discrete Structures | zyBookshttps://learn.zybooks.com/zybook/NVCCCSC208DEBuskeyAcademicYear2024/chapter/13/section/23/9
Because adjacent minterm cells differ by one variable, a K-map's key bene±t is to make i(j + j')simpli±cation opportunities obvious: Adjacent 1s are an i(j + j') opportunity. Circling two adjacent1s graphically represents the algebraic simpli±cation i(j + j') = i(1) = i. After drawing such a circle,a designer can write a product term and omit the differing variable.PARTICIPATIONACTIVITY13.2.3: Simpli±cation with a two-variable K-map: i(j + j')opportunities are obvious.A powerful feature of a K-map is how easily a minterm is replicated (recall an earlier section'sexample) by circling a cell twice.PARTICIPATIONACTIVITY13.2.4: Circling a 1 twice is like replicating a minterm to create i(j+ j') opportunities.ab010100y = ab' + ab11y = aab' + aba(b' + b)a(1)a1. Given a sum-of-minterms equation, a designer can write 1s in the appropriate K-mapcells (like for a truth table's rows). y = ab' + ab yields 1s in the bottom two cells.2. Adjacent 1s are an i(j + j') simpli±cation opportunity. Algebraically, the circlerepresents ab' + ab = a(b' + b) = a(1) = a.3. A designer need not write expressions. Instead, after drawing the circle, the designereliminates the differing variable. Here b differs and a stays 1, so the circle'sexpression is a.CaptionsFeedback?ab010111y = ab + a'b + a'b'10a'b' + a'ba'a'b + aby =+a'ba'(b' + b)a'b(a' + a)Start2x speedStart2x speed12/3/24, 1:28 PMSection 13.2 - CSC 208 DE: Introduction to Discrete Structures | zyBookshttps://learn.zybooks.com/zybook/NVCCCSC208DEBuskeyAcademicYear2024/chapter/13/section/24/9
Table 13.2.1: Rules for simplifying a sum-of-minterms expression with aK-map.Rule1:Cover every 1at least once using circles. Add the circle's term to theexpression.Rule2:Use the fewest and largest circlespossible to achieve the simplestexpression.PARTICIPATIONACTIVITY13.2.5: Basic two-variable K-map.Consider the K-maps above.1)Circle (L) is what simpli±edterm?bb1. Given a sum-of-minterms equation y = ab + a'b + a'b', a designer places 1s in the threecells corresponding to those three minterms.2. The designer draws a circle around the top two 1s. For that circle, a = 0 and b differs,so the circle represents a'.3. A second circle around the right two 1s has b = 1, and a differs, so represents b. Notethat the 1 for minterm a'b is circled twice, which is like replicating a'b algebraically.4. Drawing K-map circles is easier than algebraically simplifying. The designer draws thetwo circles and writes a term for each, so y = a' + b. The equations are never written.CaptionsFeedback?Feedback?12/3/24, 1:28 PMSection 13.2 - CSC 208 DE: Introduction to Discrete Structures | zyBookshttps://learn.zybooks.com/zybook/NVCCCSC208DEBuskeyAcademicYear2024/chapter/13/section/25/9
2)Is circle (M) necessary? Type:yes or no3)Is circle (P) a good circle?Type: yes or noCHALLENGEACTIVITY13.2.2: Two-variable K-map simpli±cation.Add the fewest and largest circles to cover all the 1s.604874.4248254.qx3zqy7CheckShow answerCheckShow answerCheckShow answerFeedback?Start01001100123abAdd circleUndo12/3/24, 1:28 PMSection 13.2 - CSC 208 DE: Introduction to Discrete Structures | zyBookshttps://learn.zybooks.com/zybook/NVCCCSC208DEBuskeyAcademicYear2024/chapter/13/section/26/9
Example: Out-of-bed alarmAn example in an earlier section involved sounding an alarm (s = 1) if a person was up from bed(u = 1) and a button was pressed (b = 1), or a person was up and a button was not pressed. Thecaptured equation was s = ub + ub'. A K-map can simplify the equation.PARTICIPATIONACTIVITY13.2.6: Simplifying with a K-map: Out-of-bed alarm.PARTICIPATIONACTIVITY13.2.7: Out-of-bed alarm system.Consider the example above.23CheckNextFeedback?ub01011001s = ub' + ubus = uOut-of-bed alarmubs1. A designer captures an out-of-bed alarm system as s = ub' + ub (which is in sum-of-minterms form).2. The designer places 1s on a two-variable K-map, one for ub' (lower left cell), and onefor ub (lower right cell). The designer places 0s in the other cells.3. The designer draws the largest possible circle covering those 1s. That circle is for u =1 and differs in b, so the circle represents u.4. The designer adds that term to the simpli±ed equation for s. The K-map helped thedesigner simplify the expression. The resulting circuit is a wire.CaptionsFeedback?1Start2x speed12/3/24, 1:28 PMSection 13.2 - CSC 208 DE: Introduction to Discrete Structures | zyBookshttps://learn.zybooks.com/zybook/NVCCCSC208DEBuskeyAcademicYear2024/chapter/13/section/27/9
1)The designer captured behavior as s= ub + ub', but simpli±cation yieldeds = u. Thus, the designer incorrectlycaptured the original behavior.TrueFalse2)The simpli±cation on the K-map isobvious.TrueFalseExample: Motion-sensing lightAn earlier section captured and simpli±ed algebraically a motion-sensing lamp's behavior. Thatexample can more easily be simpli±ed by a K-map.PARTICIPATIONACTIVITY13.2.8: Simplifying with a K-map: Motion-sensing light.Feedback?Inputs:Outputs:m: motion sensedt: test modei: illuminate lampIlluminate lamp if motion and not test mode,or if test mode and no motion, or if test mode and motionGoal:i = mt' + tm' + tmi = mt' + m't + mti = mt' + m't + mt + mti = mt' + mt + m't + mti = m(t' + t) + (m' +m) ti = m(1) + (1)ti = m(1) + t(1)i = m + tAlgebraic simplificationK-map simplification0101mti = mt' + m't + mt111i = m+tmti1. For the motion-sensing lamp, simplifying the captured equation i = mt' + tm' + tmrequired seven steps and non-obvious replications of terms.CaptionsStart2x speed12/3/24, 1:28 PMSection 13.2 - CSC 208 DE: Introduction to Discrete Structures | zyBookshttps://learn.zybooks.com/zybook/NVCCCSC208DEBuskeyAcademicYear2024/chapter/13/section/28/9
PARTICIPATIONACTIVITY13.2.9: Motion-sensing light system.Consider the example above.1)How many equations were involvedusing algebraic simpli±cation?TwoEight2)How many circles were drawn usingK-map simpli±cation?TwoThree3)K-maps help with simpli±cation bynot obeying algebraic properties.TrueFalseHow wasthissection?|2. In contrast, simpli±cation with a K-map is straightforward. The designer places 1s inthe three cells for minterms mt', m't, and mt.3. Then the designer easily draws two circles to cover the 1s, yielding terms m and t.The simpli±ed equation is i = m + t. The resulting circuit is an OR gate.Feedback?Feedback?Provide section feedback12/3/24, 1:28 PMSection 13.2 - CSC 208 DE: Introduction to Discrete Structures | zyBookshttps://learn.zybooks.com/zybook/NVCCCSC208DEBuskeyAcademicYear2024/chapter/13/section/29/9