maths.freeDiscrete Math & Logic › Boolean algebra and logic circuits

Boolean algebra and logic circuits

The laws of Boolean algebra, sum-of-products form, simplification, and building adders from gates.

Boolean algebra is the algebra of two values, 0 and 1, with the operations AND (written \( xy \) or \( x \land y \)), OR (\( x + y \) or \( x \lor y \)) and NOT (\( \bar x \)). Its laws look like ordinary algebra with a few surprises. Both operations are commutative and associative, each distributes over the other, \( x + 0 = x \) and \( x \cdot 1 = x \), and \( x + \bar x = 1 \), \( x\bar x = 0 \). The surprises are idempotence \( x + x = x \), absorption \( x + xy = x \), and distributivity of OR over AND, \( x + yz = (x + y)(x + z) \), which fails for numbers. De Morgan's laws \( \overline{x + y} = \bar x\,\bar y \) and \( \overline{xy} = \bar x + \bar y \) complete the list.

Every Boolean function can be written in sum-of-products (disjunctive normal) form: for each row of the truth table where the function is 1, write the product (the minterm) that is 1 only in that row, and OR them together. So a function of \( n \) variables is determined by its truth table, and there are \( 2^{2^n} \) of them: \( 2^n \) rows, each with an output of 0 or 1. The example is the multiplexer \( pq + \bar p r \): it outputs \( q \) when \( p = 1 \) and \( r \) when \( p = 0 \).

Simplifying an expression means fewer gates. Minterms that differ in one variable merge: \( xy + x\bar y = x(y + \bar y) = x \). The consensus law \( xy + \bar x z + yz = xy + \bar x z \) removes a redundant term. For a handful of variables, a Karnaugh map arranges the truth table so that mergeable minterms sit next to each other; for more, algorithms such as Quine-McCluskey do the same systematically.

A logic circuit wires gates together, and arithmetic is built this way. A half adder adds two bits: the sum bit is \( x \oplus y \) (exclusive or) and the carry is \( xy \). A full adder also takes an incoming carry \( c \): sum \( x \oplus y \oplus c \) and carry \( xy + c(x \oplus y) \). Chaining \( n \) full adders adds two \( n \)-bit numbers, and NAND gates alone can build every one of these, because NOT, AND and OR can all be made from NAND.

Picture it: a truth table is a column of switches, one row per input combination. A sum-of-products circuit has one AND gate per lit row, each recognising its row, feeding a single OR gate that lights the output whenever any row matches.

Think it: to prove a Boolean identity you may either use the laws or check all \( 2^n \) rows; both are complete methods. Every law has a dual, obtained by swapping AND with OR and 0 with 1, and the dual of a true identity is true. That halves the list of laws to remember.

Contoh yang dikerjakan · truth table of (p and q) or (not p and r)

Truth table of (p and q) or (not p and r)

Langkah demi langkah

  1. \left(p \wedge q\right) \vee \left(r \wedge \neg p\right)

    3 variable(s) → 8 rows. Fill in every combination.

  2. \

    Contingent: true for some inputs, false for others.

Tunjukkan jawapan
\left(p \wedge q\right) \vee \left(r \wedge \neg p\right)

Sekarang kau Pilih masalah, atau taip atau lukis sendiri. Setiap langkah, gambar, jawapan tersembunyi sehingga anda tanya.

Jaga kerja awak sendiri.

Akaun percuma menambah nota pada setiap pengajaran, rekod apa yang anda selesaikan, masalah yang anda selesaikan di satu tempat, dan seorang guru yang anda boleh tanya tentang halaman ini. Matematik itu sendiri terbuka kepada semua orang, sama ada anda log masuk atau tidak.

Daftar Masuk Log masuk

Simbol yang digunakan di sini

Tekan simbol mana-mana untuk definisi penuh, gambar, dan apa makna setiap huruf dalamnya.

Bagaimana untuk: Boolean algebra and logic circuits

  1. Write the truth table of the function you need.
  2. Write one minterm for each row with output 1 and OR them together.
  3. Merge minterms that differ in one variable, and apply absorption and consensus.
  4. Check the simplified expression against the truth table.
  5. Translate the expression into gates: one AND per product term, one OR to combine them.

Soalan yang orang tanya

Is Boolean algebra the same as propositional logic?

The algebra of truth values with and, or and not is exactly propositional logic written algebraically. Boolean algebra is more general: the subsets of a set under union, intersection and complement obey the same laws.

Why is NAND called universal?

NOT x is x NAND x, AND is the NOT of a NAND, and OR is (NOT x) NAND (NOT y). Since NOT, AND and OR express every Boolean function, NAND alone does too.

What makes mathematics "discrete"?

It deals with separate, countable objects (integers, graphs, statements) rather than continuous quantities. No limits, no infinitesimals; instead induction, counting and logic.

How does a proof by induction work?

Show the statement for the first case, then show that whenever it holds for n it holds for n + 1. Like dominoes: the first falls, and each knocks over the next.

What order should I take these lessons in?

Logic and proof first, because every later lesson proves things. Then induction, sets, relations and functions, counting, recurrences, graphs, Boolean algebra and automata, and finally algorithms and complexity, which use nearly everything before them.

Is discrete mathematics the same as the maths of computer science?

Largely. Data structures are graphs and trees, correctness arguments are induction, running times are recurrences and sums, circuits are Boolean algebra, and what a computer can do efficiently is the subject of the last lessons. It is also ordinary mathematics in its own right.

Do I need calculus for this course?

No. School algebra is enough. A little familiarity with limits helps when comparing growth rates, and the lesson on asymptotic analysis explains the one limit fact it uses.

Lebih dalam Discrete Math & Logic