> For the complete documentation index, see [llms.txt](https://cs.arkb.me/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cs.arkb.me/hardware-software/boolean-algebra.md).

# Boolean Algebra

Just like normal algebra, Boolean algebra uses letters to represent values and uses them as expressions. Boolean algebra uses the values TRUE and FALSE (i.e. 1 and 0).

## Notation

<table><thead><tr><th width="374">Expression</th><th>Meaning</th></tr></thead><tbody><tr><td>A, B, C, etc.</td><td>Used to represent an unknown value, just like <em>x</em> or <em>y</em> in normal algebra.</td></tr><tr><td><span class="math">\overline A</span></td><td>NOT A. An overline represents the NOT operation being applied to what is below the line.</td></tr><tr><td><span class="math">A \cdot B</span></td><td>A AND B. The dot represents AND operation.</td></tr><tr><td><span class="math">A  + B</span></td><td>A OR B. The plus sign represents OR operation.</td></tr></tbody></table>

## Order of Precedence

The following list shows the order of precedence (Highest to Lowest):

* Brackets
* NOT
* AND
* OR

## Boolean Identities

There are numerous Boolean identities that can help *simplify* Boolean expressions:

$$
A \cdot 0 = 0
$$

$$
B \cdot 1 = B
$$

$$
C \cdot C = C
$$

$$
D + 0 = D
$$

$$
E + 1 = 1
$$

$$
F + F = F
$$

$$
\overline{\overline{C}} = C
$$

## De Morgan's Law

De Morgan's law can be very useful when simplifying logical expressions. It can be remembered by recalling the phrase:

> Break the bar and change the sign

The "bar" refers to the overline representing the NOT sign and the sign refers to changing the dot or plus sign.&#x20;

Example of using De Morgan's law on $$\overline{A + B}$$:&#x20;

* Step 1: Break the bar $$\overline{A} + \overline{B}$$
* Step 2: Change the sign: $$\overline{A} \cdot \overline{B}$$

De Morgan's law can also be used in reverse, by changing the sign and building the bar. Following is an example of changing $$\overline{C} + \overline{D}$$:

* Step 1: Change the sign $$\overline{C} \cdot \overline{D}$$
* Step 2: Build the bar $$\overline{C \cdot D}$$

## Distributive Rules

Just like mathematics, you can expand and factorise Boolean expressions.

$$
A \cdot (B + C) = A \cdot B + A \cdot C
$$

## Example Questions

<details>

<summary>Simplify the Boolean expression <span class="math">A + \overline{B\cdot A}</span></summary>

1. Use De Morgan's Law to break bar $$A + \overline{B} + \overline{A}$$
2. Use $$A + \overline{A} = 1$$ -> $$\overline{B} + 1$$
3. \= 1

</details>

<details>

<summary>Simplify the Boolean expression <span class="math">C \cdot B + \overline{C} \cdot B</span></summary>

1. Factorise: $$B \cdot (C + \overline{C})$$&#x20;
2. $$= B \cdot (1) = B$$

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cs.arkb.me/hardware-software/boolean-algebra.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
