The rule of sum is so simple that it's hard to explain.
Choosing (1 of N items) OR (1 of M items) can be done in N + M ways.
If there are 435 members of the House of Representatives and 100 members of the Senate and you may choose to speak to one member of Congress, you have:
$$ 435 + 100 = 535 $$535 possible choices.
Choosing (1 of N items) AND (1 of M items) can be done in N x M different ways.
So, there are 435 members of the House and 100 members of the Senate. If we have the opportunity to speak to one member from each body, we have:
$$ 435 \times 100 = 43500 $$possible ways to choose 1 member of the house AND one member of the Senate.
A circuit can store a bit, a binary digit, 1 or 0. So, for 1 bit, there are 2 possible states. So, for an 8-bit system, we can choose 1 or 0 for each bit. Therefore, there are
$$ 2 \times 2 \times 2 \times 2 \times 2 \times 2 \times 2 \times 2 = 2^8 = 256 $$possible states for these 8 bits.
Say we are going to choose a foo or bar and definitely a baz. Let's say there are 2 of each. We may make our selection in:
$$ (2 + 2) \times 2 = 8 $$ways.
With such a small example, we can enumerate the possibilities. Let's call the two foos f and o, the two bars, b and a, and the two bazes z and x. Then, the ways in which we can choose 1 (foo or bar) and 1 baz is:
| foo or bar | baz |
|---|---|
| f | x |
| f | z |
| o | x |
| o | z |
| b | x |
| b | z |
| a | x |
| a | z |
These examples my be laughably simple. But, these simple rules form the basis of the discrete math which rules the digital world. From here, permutations, combinations, arrangements, set theory, discrete probability and all sorts of mind-bending ideas flow.
great read and well written.