math path
week 1 · day 2

And, Or, Not — the Words That Make Rules

Three little words, with exact meanings, that show up everywhere

Easy 25 min 180 xp
After this you can
  • Understand 'and', 'or', and 'not' as precise rules, using everyday examples
  • See why 'or' in logic usually means 'one, the other, or both'
  • Say the exact opposite of a rule correctly (the part everyone gets wrong)
  • Feel how these words connect to how you already make decisions

Words you already use, made exact

Yesterday you saw what it feels like to *know* something is true. Today, three tiny words: and, or, not. You use them constantly — "bring an umbrella if it's raining or cloudy," "you can enter if you have a ticket and you're on the list." Math just pins down their *exact* meaning so there's never any doubt. No formulas again today. Just careful thinking about words you already know.

"And" — both things have to be true

A bouncer at a door has a rule:

> "You get in if you have a ticket AND you're on the list."

When does someone get in? Only when both are true — ticket *and* on the list. Miss either one and you're out. "And" is strict: every part must hold. If your rule has three ands, all three must be true. One failure sinks the whole thing.

the 'and' rule — all four situations
   ticket?   on list?   |  get in?
   -------------------------------
   yes       yes        |  YES  (both true -> in)
   yes       no         |  no   (missing the list)
   no        yes        |  no   (missing the ticket)
   no        no         |  no   (missing both)

That little table just lists every possible situation (each thing is either yes or no, so there are four) and what the rule says in each. Listing all the situations is a superpower: once the table is filled in, there's *nothing left to argue about*. The rule is completely, exactly pinned down.

"Or" — at least one, and here's the surprise

Another rule:

> "Bring an umbrella if it's raining OR it's cloudy."

When do you bring the umbrella? If it's raining. If it's cloudy. And — here's the part that trips people — also if it's both raining *and* cloudy. In everyday speech "or" sometimes means "one or the other but not both" ("soup or salad?"). But in logic and math, "or" almost always means "at least one is true — including both." Only when *neither* is true do you skip the umbrella.

the 'or' rule — umbrella?
   raining?   cloudy?   |  umbrella?
   ---------------------------------
   yes        yes       |  YES  (both -> still yes!)
   yes        no        |  YES
   no         yes       |  YES
   no         no        |  no   (neither -> skip it)
Key idea
The one thing to remember about or: it's happy when at least one part is true, *including when both are*. It only says "no" when everything is false. If you ever want "one or the other but not both," you have to say that on purpose — plain "or" always lets both count.

"Not" — flip it

"Not" is the simplest: it flips true to false and false to true. "It is not raining" is true exactly when "it is raining" is false. That's all. But "not" becomes interesting the moment you point it at a whole *rule* — because saying the exact opposite of an and/or rule is where almost everyone slips.

The opposite of a rule (the part people get wrong)

Back to the bouncer: "ticket AND on the list." What's the exact opposite — the situation where you *don't* get in?

The tempting wrong answer is "no ticket AND not on the list." But think: you also fail if you have a ticket but you're *not* on the list. You don't need to be missing *both* to be turned away — missing either one is enough. So the real opposite is:

> "no ticket OR not on the list."

Look what happened: the "and" flipped into an "or", and each part got a "not." That flip is a real rule, and it's worth burning in:

Note
To say the opposite of an "and" rule, flip it to "or" and negate each part. To say the opposite of an "or" rule, flip it to "and" and negate each part. - opposite of "A and B" → "not-A or not-B" - opposite of "A or B" → "not-A and not-B" Everyday check: the opposite of "the door is locked and the window is shut" is "the door is unlocked or the window is open" — you only need *one* of them to fail for the "locked up tight" rule to be broken. This little flip prevents a huge number of mistakes, in math and later in code.
Predict first
A website says: "Your password is valid if it's at least 8 characters long AND it has a number." Someone's password is rejected. Using the flip rule, describe *exactly* the situation(s) in which it gets rejected.

What you did today

You took three words you use every day and made them exact: and needs everything, or needs at least one (both is fine), not flips. And you learned the one move people constantly botch — saying the true opposite of a rule by flipping and/or and negating the parts. That's not "math you memorize"; it's careful thinking you can now trust. Same as the cookies: get concrete, and it's just common sense sharpened.

finished reading?
Your task, you write the code

Say the exact opposite

No formulas, no code — plain words. For each rule below, (a) list all the situations in a little table like the ones above, and (b) write its exact OPPOSITE using the flip rule (and↔or, negate each part), then double-check your opposite makes sense in words: (1) 'You pass the class if you do the homework AND pass the exam.' (2) 'The alarm goes off if a door opens OR a window opens.' (3) 'You get the discount if you're a student OR it's a Tuesday.' Everything you need is in this lesson.

deliverable: your situation-tables and the exact opposite of each rule, in plain words
self-review before running
  • For the 'and' rule, your opposite uses 'or' and negates each part
  • For the 'or' rules, your opposite uses 'and' and negates each part
  • You noticed that failing just ONE part of an 'and' rule breaks it
  • Your opposites actually make sense when you read them aloud
stretchTry a rule with three parts: 'You may enter if you have a ticket AND you're 18+ AND you're on the list.' Write its exact opposite in plain words. (Hint: the 'and's all become 'or's, and any single failure is enough.) This is the same skill, just longer.

Self-check

01In logic, 'A OR B' is true when:
02'A AND B' is true when:
03The exact opposite of 'A AND B' is:
04A rule says 'valid if 8+ characters AND has a number.' A password fails when:
0/4 correct · 0/4 checked