Free preview

83 lessons

Mathematical Foundations for ML

Free preview

Mathematical Foundations for ML · 83 lessons

Build the maths foundations that make ML click

No surprise gaps

Actually remember it

Skip what you know

One subscription. All learning paths included.

Our content is best on a larger screen

Negation and De Morgan's laws

Negating simple statements

Explanation

Every statement has a negation - a new statement with the opposite truth value. If PP is true, its negation is false, and vice versa.

Negation

Definition

The negation of a statement PP, written ¬P\neg P (read "not PP"), is true when PP is false and false when PP is true.

We often label a statement with a letter, for example PP: "x>3x > 3", and write its negation as ¬P\neg P: "x3x \leq 3".

This mirrors complements from sets: just as AcA^c contains everything not in AA, the negation ¬P\neg P captures the opposite of PP.

Negating mathematical statements takes a little care. The negation must capture every value the original misses, with no overlap and no gaps. Here are some common patterns:

StatementNegationWhy
x>3x > 3x3x \leq 3Flips direction and swaps strict for non-strict. Using x<3x < 3 would lose x=3x = 3.
x10x \leq 10x>10x > 10Same rule: flip direction, swap non-strict for strict.
xAx \in AxAx \notin ASwap \in and \notin.
ABA \subseteq BA⊈BA \not\subseteq BAt least one element of AA is not in BB.
nn is evennn is oddAdd or remove "not" (equivalently, "nn is not even").

Key Point

The original statement and its negation form a partition: exactly one of PP and ¬P\neg P is true for any given value. There is no middle ground.

Example

Negate each of the following statements and determine the truth value of both the original and its negation.

  • PP: x>5x > 5 where x=3x = 3
  • QQ: nZn \in \mathbb{Z} where n=4.7n = 4.7
  • RR: nn is a perfect square where n=9n = 9

Solution

Statement PP: x>5x > 5

The negation flips the inequality and swaps strict for non-strict:

¬Px5\neg P\text{: } x \leq 5

With x=3x = 3: the original PP is false (33 is not greater than 55), and the negation ¬P\neg P is true (353 \leq 5). The truth values are opposite, as expected.

Statement QQ: nZn \in \mathbb{Z}

The negation swaps membership:

¬QnZ\neg Q\text{: } n \notin \mathbb{Z}

With n=4.7n = 4.7: the original QQ is false (4.74.7 is not an integer), and the negation ¬Q\neg Q is true (4.7Z4.7 \notin \mathbb{Z}).

Statement RR: nn is a perfect square

The negation adds "not":

¬Rn is not a perfect square\neg R\text{: } n \text{ is not a perfect square}

With n=9n = 9: the original RR is true (9=329 = 3^2), so the negation ¬R\neg R is false.

In every case, the original and its negation have opposite truth values - exactly one is true.

Practice questions

4 questions

Let PP: x<7x < 7. What is ¬P\neg P?

Select the correct answer:

+ 3 more questions

Negating "and" statements

Explanation

We can negate individual statements. What about compound ones? Let's start with conjunctions - statements joined by "and."

Consider PQP \wedge Q. What does it mean for this to be false?

Recall that PQP \wedge Q requires both parts to hold. So it fails whenever at least one part fails - that is, when PP is false or QQ is false. The negation of PQP \wedge Q is therefore ¬P\neg P or ¬Q\neg Q.

Negating a conjunction (De Morgan's first law)

Definition

The negation of PQP \wedge Q is:

¬(PQ)=¬P¬Q\neg(P \wedge Q) = \neg P \vee \neg Q

Negate each part and change "and" to "or."

A common mistake

Gotcha

A tempting but wrong negation of PQP \wedge Q is ¬P\neg P and ¬Q\neg Q. This says both parts fail, but the original is false as soon as one part fails. Forgetting to swap the connective is the most common error.

This is one half of what are called De Morgan's laws - we will meet the other half next.

Example

Negate the statement: xx is positive and xx is an integer. Then verify your negation for x=3x = -3, x=4x = 4, and x=0.5x = 0.5.

Solution

Step 1: Identify PP and QQ.

  • PP: xx is positive
  • QQ: xx is an integer

The original statement is PQP \wedge Q.

Step 2: Negate each part.

  • ¬P\neg P: xx is not positive, i.e. x0x \leq 0
  • ¬Q\neg Q: xx is not an integer, i.e. xZx \notin \mathbb{Z}

Step 3: Apply De Morgan's first law - swap "and" for "or":

¬(PQ)=¬P¬Q\neg(P \wedge Q) = \neg P \vee \neg Q

So the negation is: x0x \leq 0 or xZx \notin \mathbb{Z}.

Verification:

  • x=3x = -3: original is false, negation is true. Opposite, as expected.
  • x=4x = 4: original is true, negation is false. Opposite.
  • x=0.5x = 0.5: original is false, negation is true. Opposite.
Full working for each value

Details

Practice questions

4 questions

What is the negation of x>0x > 0 and x<10x < 10?

Select the correct answer:

+ 3 more questions

Negating "or" statements

Explanation

We have seen that negating PQP \wedge Q swaps the connective to "or." Now consider the other direction: what does it mean for PQP \vee Q to be false?

Recall that PQP \vee Q requires at least one part to hold. So it fails only when neither holds - when PP is false and QQ is false. The negation of PQP \vee Q is therefore ¬P\neg P and ¬Q\neg Q.

Negating a disjunction (De Morgan's second law)

Definition

The negation of PQP \vee Q is:

¬(PQ)=¬P¬Q\neg(P \vee Q) = \neg P \wedge \neg Q

Negate each part and change "or" to "and."

Together with the rule for negating "and" statements, we have a pair known as De Morgan's laws: negation always swaps the connective. "And" becomes "or", and "or" becomes "and."

Connection to set complements

Details

Example

Negate the statement: nn is even or n>20n > 20. Then verify your negation for n=15n = 15, n=22n = 22, and n=3n = 3.

Solution

Step 1: Identify PP and QQ.

  • PP: nn is even
  • QQ: n>20n > 20

The original statement is PQP \vee Q.

Step 2: Negate each part.

  • ¬P\neg P: nn is odd
  • ¬Q\neg Q: n20n \leq 20

Step 3: Apply De Morgan's second law - swap "or" for "and":

¬(PQ)=¬P¬Q\neg(P \vee Q) = \neg P \wedge \neg Q

So the negation is: nn is odd and n20n \leq 20.

Verification:

  • n=15n = 15: original is false, negation is true. Opposite.
  • n=22n = 22: original is true, negation is false. Opposite.
  • n=3n = 3: original is false, negation is true. Opposite.
Full working for each value

Details

Practice questions

4 questions

What is the negation of nn is prime or nn is odd?

Select the correct answer:

+ 3 more questions