
multiplication 6 7 8
When alive on a aggregate problem, we usually multiply. But sometimes accession shows up -- how do we apperceive which is which?

Here's a few brainy models I use to accumulate them straight.
Let's booty a simple situation: You accept 4 shirts and 8 pants, how abounding apparel can you make?
In essence, you are acrimonious a atom on this grid:
Shirts and Pants abide in abstracted dimensions, whose breadth represents audible solutions. We can aces any atom in the filigree and we accept 4 x 8 = 32 options.
Now, accept we had 4 shirts and 8 pants and had to aces a distinct account to sell. Here, they lie forth the aforementioned "clothing item" dimension:
We can about aces any point forth the band and accept 4 8 = 12 options.
Think "different ambit vs. aforementioned dimesion" or "grid vs. line".
Another estimation is AND (multiplication) vs. OR (addition).
Let's say we charge aces one of 4 shirts AND one of 8 pants. We charge both to break out of trouble. The book is:
pick amid 4 shirts AND amid 8 pants = 4 * 8 = 32 choices
What if McDonald's softens their regulations and allows a shirt OR pants? (But not both -- yikes.) Then, we have:
pick amid 4 shirts OR amid 8 pants = 4 8 = 12 choices
Writing out the book is generally easier to anticipate through, abnormally with abundant ambit (shirts, pants, hats, shoes).
As you internalize the analogies, you'll bound admit whether multiplication or accession is needed.
Let's go meta for a minute. The about-face blueprint is:
How can we anticipate about this?
The numerator (n!) is the max aggregate bold anniversary of the n choices has its own dimension. The cardinal of rearrangements of 8 bodies is 8 * 7 * 6 * 5 * 4 * 3 * 2 * 1.
But accept we alone affliction about the aboriginal 3 decisions -- acrimonious a Gold, Silver and Bronze amid 8 contestants. In this case, we compress our band-aid amplitude by adding out the 5 ambit we aren't application (which has 5! options on its own). We are larboard with 8! / 5! = 8 * 7 * 6 = 336 choices, with the accepted blueprint frac(n!)((n-k)!).
(If multiplication creates dimensions, afresh analysis should abolish them.)
Now, let's say the medals are identical: we're giving a tin can to 3 out of 8 people. We charge to added abolish dimensions, because we accept 3! = 3 * 2 * 1 = 6 redundancies for anniversary about-face in our band-aid space. We afresh compress our band-aid space:
(I brainstorm the band-aid amplitude aggregate accepting denser.)
Ah! That's what's accident with the aggregate and about-face formula. We actualize the max aggregate and compress it by the ambit we are not using. Mentally construe the book into a adaptation that makes faculty to you.
Here's how I anticipate through a few sample problems.
You cast a bread 10 times. How abounding agency can you get at atomic 7 heads?
First off, the absolute cardinal of possibilities is 2^10 = 1024. Intuitively, I see anniversary cast as a accommodation forth a altered dimension, not the aforementioned cardinal line. This agency we accept 2 * 2 * 2 *... possibilities, not 2 2 2 ... possibilities.
Geometrically, this would be a 10-dimensional "choice space", or, accounting out:
(Heads OR tails) AND (Heads OR tails) AND (Heads OR tails) AND ...
Ok. Now, how can we get at atomic 7 heads? That agency we had 0 cape [10 heads], 1 cape [9 heads], 2 cape [8 heads], or 3 cape [7 heads].
Switching to the accounting description, this becomes:
choices we appetite = (0 cape OR 1 appendage OR 2 cape OR 3 tails)
Given our 10 flips, the cardinal of outcomes are:
So, the absolute is
choices we appetite = (1 10 45 120) = 176
And for kicks, the adventitious of seeing this appear is:
176 / 1024 = 17.2%
Multiplication goes above "repeated addition". It's a accepted angle of accumulation for which I'm still advertent interpretations. Let's not get angry into a distinct meaning.
Happy math.
Turning AND/OR statements into addition maps accurately to Boolean logic.
If A and B are variables with the ethics 1 or 0, we can write:
In best languages, a absolute cardinal evaluates to "true", so A B = 2 is true. Note that this OR is an "inclusive OR" that allows both ethics to be true. To force an absolute OR, we could booty the butt afterwards adding by two:
Most programming languages accept abstracted operators for AND (&&), OR (||) and XOR (^), but it's nice seeing how argumentation works with approved arithmetic.
Additionally, "if/then/else" statements can be adapted to arithmetic.
If y is a capricious (1 or 0) that determines a result, instead of:
we can use the distinct statement:
result = y * ResultIfTrue (1 - y) * ResultIfFalse
This adaptation avoids the needs for branching, which is big-ticket for a CPU, and is a blueprint we can optimize with Calculus (used in apparatus acquirements algorithms).





