Discrete mathematics combines mathematical reasoning with computational foundations. This introduction... Show more
Understanding Discrete Math and Logic











Introduction to Logic
Logic forms the foundation of mathematical reasoning and clear thinking. When you understand logic, you can distinguish valid arguments from invalid ones and build stronger mathematical proofs.
The rules of logic help us understand statements like "There exists an integer that is not the sum of two squares" or mathematical formulas like "For every positive integer n, the sum of positive integers not exceeding n is n/2".
In computer science, logic isn't just theoretical—it's practical. Whether you're designing circuits, programming algorithms, or debugging code, logical thinking is essential to your success.
Remember: Logic isn't just about being "logical" in everyday speech—it's a precise mathematical system with specific rules and applications.

The Circuit
When analyzing electrical circuits, we often make logical conjectures about how they function. Let's examine some statements about a circuit with lamps L1-L6:
- If lamp L4 shines, then lamp L1 shines too.
- If L2 shines then L5 shines too.
- If L5 doesn't shine, then L2 doesn't shine either.
- If L5 shines, then L2 shines.
- If L2 doesn't shine, then L5 doesn't shine.
- If L1 or L6 shines then L3 or L4 shines.
- If L1 and L3 then L2 and not L5.
These statements demonstrate how logic helps us understand relationships between components in a system. Some statements may seem similar but have different logical meanings.
Try this: Pick any two statements from above and determine if they're logically equivalent by writing out what happens in all possible scenarios.

Proposition
A proposition is a declarative sentence that is either true or false, but not both. This definition is crucial because it forms the foundation of logical reasoning.
Examples of propositions include:
- "Washington, D.C., is the capital of the United States of America." (True)
- "Toronto is the capital of Canada." (False)
- "1 + 1 = 2." (True)
- "2 + 2 = 3." (False)
Not everything is a proposition. Questions like "What time is it?" or commands like "Read this carefully" are not propositions because they don't declare facts that can be judged true or false.
Mathematical expressions with variables are not propositions by themselves because their truth value depends on the values assigned to the variables.
We use letters (typically p, q, r, s) to represent propositions, similar to how we use letters for variables in algebra. The truth value is denoted by T (or 1) for true propositions and F (or 0) for false ones.

Propositional Calculus
We have 4 basic logic operators used in the propositional calculus.
Based on them we can validate other propositions called Compound propositions by using the Truth Tables.
- The negation: (no $P$), which reverses the truth value of a proposition
- The disjunction: ($P$ or $Q$), which combines propositions with "or"
- The conjunction: ($Q$ and $R$), which combines propositions with "and"
- The implication: $P \Rightarrow Q$ or $R$, which shows logical consequence
These operators allow us to build complex logical expressions and analyze their truth values systematically. In computer science, these operators translate directly to operations in Boolean logic, which forms the basis of digital circuit design and programming.
Pro tip: When working with truth tables, remember that with n propositions, you'll need to examine 2^n possible combinations of truth values.

The Negation
The negation of a proposition A is "no A," denoted or .
It is False when A is True and True when A is False. This logic operator can be summarized in the following Truth table:
| A | $\neg A$ |
|---|---|
| 0 | 1 |
| 1 | 0 |
The negation is a fundamental operation that simply flips the truth value of a proposition. It's similar to the NOT gate in digital electronics.
An interesting property worth noting is that the proposition has the same truth table as A. In other words, negating a negation brings you back to the original proposition.
This operation is critical because it allows us to express the opposite of any logical statement, which is essential for constructing complex logical arguments and proofs.

The Conjunction
The proposition "A and B" is True when A and B are simultaneously True. It is False elsewhere.
| A | B | A and B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
The conjunction has important properties:
- Commutativity: The assertions "A and B" and "B and A" have the same truth table.
- Associativity: The assertions "A and (B and C)" and "(A and B) and C" have the same truth table.
These properties allow us to rearrange conjunctions without changing their meaning, which is useful when simplifying complex logical expressions or constructing proofs.
In computing: Conjunction is equivalent to the AND gate in digital circuits, and the && operator in many programming languages.

The Disjunction
The proposition "A or B" is False when A and B are simultaneously False.
It is True if one of them or both of them are True.
| A | B | A or B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
The disjunction has key properties similar to conjunction:
- It's commutative: "A or B" equals "B or A"
- It's associative: "A or (B or C)" equals "(A or B) or C"
Two important logical equivalences worth remembering:
- The assertion "no(A or B)" has the same truth table as "(no A) and (no B)"
- The assertion "no(A and B)" has the same truth table as "(no A) or (no B)"
These are known as De Morgan's laws, which are extremely useful in simplifying logical expressions.

The Implication
"", is read "if , then " " implies " "for , it is sufficient " "for , it needs " " is a sufficient condition for " " is a necessarily condition for ".
Its Truth Table is:
| A | B | A ⇒ B |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 1 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
Attention: By definition, "A ⇒ B" is True when A is False! This often confuses students, but it's crucial to understanding implication.
An important equivalence: "A ⇒ B" has the same truth table as "(not A) or B".
Critical insight: The logical implication is not the same as causality in the real world. A statement like "If 1+1=2, then x^n + y^n = z^n has no integer solutions for n≥3" is logically true, even though there's no causal relationship.

Converse, Contrapositive, and Inverse
When working with an implication , we can derive related implications:
The converse of is:
- The truth of and are independent.
The contrapositive of is:
- The propositions and have the same truth table.
The negation of is:
The contrapositive is particularly useful in mathematics. When proving "if A then B," we can instead prove "if not B then not A," which is often easier.
This relationship between an implication and its contrapositive provides a powerful alternative approach to mathematical proofs.

The Equivalence
"" can be read as " is equivalent to " " if and only if " " is a necessarily and sufficient condition to "
Its truth table is the same as " and ". This means:
Conclusion: "" is True means that A and B have the same truth value.
Unlike implication, equivalence represents a stronger relationship between propositions - they must both be true together or both be false together.
Equivalence is not generally associative. That is, "" doesn't have the same truth table as " and ".
In mathematical proofs, a sequence of equivalences is often used when solving systems of equations because each step maintains the same solution set as the original.
We thought you’d never ask...
What is the Knowunity AI companion?
Our AI companion is specifically built for the needs of students. Based on the millions of content pieces we have on the platform we can provide truly meaningful and relevant answers to students. But its not only about answers, the companion is even more about guiding students through their daily learning challenges, with personalised study plans, quizzes or content pieces in the chat and 100% personalisation based on the students skills and developments.
Where can I download the Knowunity app?
You can download the app in the Google Play Store and in the Apple App Store.
Is Knowunity really free of charge?
That's right! Enjoy free access to study content, connect with fellow students, and get instant help – all at your fingertips.
Most popular content
9Origins and Dynamics of the Columbian Exchange
Analyze the ecological and economic motivations behind the initial transfer of goods, people, and diseases between the Old and New Worlds.
Introduction to Early Cultural Interactions
Analyze the initial social and religious encounters between Europeans, Africans, and Indigenous peoples in the colonial Americas.
Origins of Ancient River Civilizations
Analyze the environmental factors and technological innovations that led to the rise of early states in Mesopotamia, Egypt, and the Indus Valley.
Motivations for European Exploration
Analyze the economic, religious, and political factors that drove European powers to the Americas during the 15th and 16th centuries.
Foundations of Ethical Guidelines in Research
Practice the core principles of the APA ethical code including informed consent, debriefing, and the role of Institutional Review Boards.
Introduction to Native American Societies
Examine the diverse social, political, and economic structures of North American indigenous groups prior to European contact.
Introduction to Biological Elements of Life
Practice identifying the essential elements including carbon, nitrogen, phosphorus, and sulfur that compose biological macromolecules.
Introduction to the Spanish Encomienda System
Explore the fundamental economic and social structures of the Spanish colonial system, focusing on the encomienda and the casta social hierarchy.
Origins and Continuity of the Byzantine Empire
Analyze the political and cultural transitions from the Roman Empire to the Byzantine Empire, focusing on the reign of Justinian I and his code.
Can't find what you're looking for? Explore other subjects.
Students love us — and so will you.
The app is very easy to use and well designed. I have found everything I was looking for so far and have been able to learn a lot from the presentations! I will definitely use the app for a class assignment! And of course it also helps a lot as an inspiration.
This app is really great. There are so many study notes and help [...]. My problem subject is French, for example, and the app has so many options for help. Thanks to this app, I have improved my French. I would recommend it to anyone.
Wow, I am really amazed. I just tried the app because I've seen it advertised many times and was absolutely stunned. This app is THE HELP you want for school and above all, it offers so many things, such as workouts and fact sheets, which have been VERY helpful to me personally.
Understanding Discrete Math and Logic
Discrete mathematics combines mathematical reasoning with computational foundations. This introduction to logic will help you understand the building blocks of mathematical thinking and how they apply to computer science and problem-solving.

Sign up to see the content. It's free!
- Access to all documents
- Improve your grades
- Join milions of students
Introduction to Logic
Logic forms the foundation of mathematical reasoning and clear thinking. When you understand logic, you can distinguish valid arguments from invalid ones and build stronger mathematical proofs.
The rules of logic help us understand statements like "There exists an integer that is not the sum of two squares" or mathematical formulas like "For every positive integer n, the sum of positive integers not exceeding n is n/2".
In computer science, logic isn't just theoretical—it's practical. Whether you're designing circuits, programming algorithms, or debugging code, logical thinking is essential to your success.
Remember: Logic isn't just about being "logical" in everyday speech—it's a precise mathematical system with specific rules and applications.

Sign up to see the content. It's free!
- Access to all documents
- Improve your grades
- Join milions of students
The Circuit
When analyzing electrical circuits, we often make logical conjectures about how they function. Let's examine some statements about a circuit with lamps L1-L6:
- If lamp L4 shines, then lamp L1 shines too.
- If L2 shines then L5 shines too.
- If L5 doesn't shine, then L2 doesn't shine either.
- If L5 shines, then L2 shines.
- If L2 doesn't shine, then L5 doesn't shine.
- If L1 or L6 shines then L3 or L4 shines.
- If L1 and L3 then L2 and not L5.
These statements demonstrate how logic helps us understand relationships between components in a system. Some statements may seem similar but have different logical meanings.
Try this: Pick any two statements from above and determine if they're logically equivalent by writing out what happens in all possible scenarios.

Sign up to see the content. It's free!
- Access to all documents
- Improve your grades
- Join milions of students
Proposition
A proposition is a declarative sentence that is either true or false, but not both. This definition is crucial because it forms the foundation of logical reasoning.
Examples of propositions include:
- "Washington, D.C., is the capital of the United States of America." (True)
- "Toronto is the capital of Canada." (False)
- "1 + 1 = 2." (True)
- "2 + 2 = 3." (False)
Not everything is a proposition. Questions like "What time is it?" or commands like "Read this carefully" are not propositions because they don't declare facts that can be judged true or false.
Mathematical expressions with variables are not propositions by themselves because their truth value depends on the values assigned to the variables.
We use letters (typically p, q, r, s) to represent propositions, similar to how we use letters for variables in algebra. The truth value is denoted by T (or 1) for true propositions and F (or 0) for false ones.

Sign up to see the content. It's free!
- Access to all documents
- Improve your grades
- Join milions of students
Propositional Calculus
We have 4 basic logic operators used in the propositional calculus.
Based on them we can validate other propositions called Compound propositions by using the Truth Tables.
- The negation: (no $P$), which reverses the truth value of a proposition
- The disjunction: ($P$ or $Q$), which combines propositions with "or"
- The conjunction: ($Q$ and $R$), which combines propositions with "and"
- The implication: $P \Rightarrow Q$ or $R$, which shows logical consequence
These operators allow us to build complex logical expressions and analyze their truth values systematically. In computer science, these operators translate directly to operations in Boolean logic, which forms the basis of digital circuit design and programming.
Pro tip: When working with truth tables, remember that with n propositions, you'll need to examine 2^n possible combinations of truth values.

Sign up to see the content. It's free!
- Access to all documents
- Improve your grades
- Join milions of students
The Negation
The negation of a proposition A is "no A," denoted or .
It is False when A is True and True when A is False. This logic operator can be summarized in the following Truth table:
| A | $\neg A$ |
|---|---|
| 0 | 1 |
| 1 | 0 |
The negation is a fundamental operation that simply flips the truth value of a proposition. It's similar to the NOT gate in digital electronics.
An interesting property worth noting is that the proposition has the same truth table as A. In other words, negating a negation brings you back to the original proposition.
This operation is critical because it allows us to express the opposite of any logical statement, which is essential for constructing complex logical arguments and proofs.

Sign up to see the content. It's free!
- Access to all documents
- Improve your grades
- Join milions of students
The Conjunction
The proposition "A and B" is True when A and B are simultaneously True. It is False elsewhere.
| A | B | A and B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
The conjunction has important properties:
- Commutativity: The assertions "A and B" and "B and A" have the same truth table.
- Associativity: The assertions "A and (B and C)" and "(A and B) and C" have the same truth table.
These properties allow us to rearrange conjunctions without changing their meaning, which is useful when simplifying complex logical expressions or constructing proofs.
In computing: Conjunction is equivalent to the AND gate in digital circuits, and the && operator in many programming languages.

Sign up to see the content. It's free!
- Access to all documents
- Improve your grades
- Join milions of students
The Disjunction
The proposition "A or B" is False when A and B are simultaneously False.
It is True if one of them or both of them are True.
| A | B | A or B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
The disjunction has key properties similar to conjunction:
- It's commutative: "A or B" equals "B or A"
- It's associative: "A or (B or C)" equals "(A or B) or C"
Two important logical equivalences worth remembering:
- The assertion "no(A or B)" has the same truth table as "(no A) and (no B)"
- The assertion "no(A and B)" has the same truth table as "(no A) or (no B)"
These are known as De Morgan's laws, which are extremely useful in simplifying logical expressions.

Sign up to see the content. It's free!
- Access to all documents
- Improve your grades
- Join milions of students
The Implication
"", is read "if , then " " implies " "for , it is sufficient " "for , it needs " " is a sufficient condition for " " is a necessarily condition for ".
Its Truth Table is:
| A | B | A ⇒ B |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 1 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
Attention: By definition, "A ⇒ B" is True when A is False! This often confuses students, but it's crucial to understanding implication.
An important equivalence: "A ⇒ B" has the same truth table as "(not A) or B".
Critical insight: The logical implication is not the same as causality in the real world. A statement like "If 1+1=2, then x^n + y^n = z^n has no integer solutions for n≥3" is logically true, even though there's no causal relationship.

Sign up to see the content. It's free!
- Access to all documents
- Improve your grades
- Join milions of students
Converse, Contrapositive, and Inverse
When working with an implication , we can derive related implications:
The converse of is:
- The truth of and are independent.
The contrapositive of is:
- The propositions and have the same truth table.
The negation of is:
The contrapositive is particularly useful in mathematics. When proving "if A then B," we can instead prove "if not B then not A," which is often easier.
This relationship between an implication and its contrapositive provides a powerful alternative approach to mathematical proofs.

Sign up to see the content. It's free!
- Access to all documents
- Improve your grades
- Join milions of students
The Equivalence
"" can be read as " is equivalent to " " if and only if " " is a necessarily and sufficient condition to "
Its truth table is the same as " and ". This means:
Conclusion: "" is True means that A and B have the same truth value.
Unlike implication, equivalence represents a stronger relationship between propositions - they must both be true together or both be false together.
Equivalence is not generally associative. That is, "" doesn't have the same truth table as " and ".
In mathematical proofs, a sequence of equivalences is often used when solving systems of equations because each step maintains the same solution set as the original.
We thought you’d never ask...
What is the Knowunity AI companion?
Our AI companion is specifically built for the needs of students. Based on the millions of content pieces we have on the platform we can provide truly meaningful and relevant answers to students. But its not only about answers, the companion is even more about guiding students through their daily learning challenges, with personalised study plans, quizzes or content pieces in the chat and 100% personalisation based on the students skills and developments.
Where can I download the Knowunity app?
You can download the app in the Google Play Store and in the Apple App Store.
Is Knowunity really free of charge?
That's right! Enjoy free access to study content, connect with fellow students, and get instant help – all at your fingertips.
Most popular content
9Origins and Dynamics of the Columbian Exchange
Analyze the ecological and economic motivations behind the initial transfer of goods, people, and diseases between the Old and New Worlds.
Introduction to Early Cultural Interactions
Analyze the initial social and religious encounters between Europeans, Africans, and Indigenous peoples in the colonial Americas.
Origins of Ancient River Civilizations
Analyze the environmental factors and technological innovations that led to the rise of early states in Mesopotamia, Egypt, and the Indus Valley.
Motivations for European Exploration
Analyze the economic, religious, and political factors that drove European powers to the Americas during the 15th and 16th centuries.
Foundations of Ethical Guidelines in Research
Practice the core principles of the APA ethical code including informed consent, debriefing, and the role of Institutional Review Boards.
Introduction to Native American Societies
Examine the diverse social, political, and economic structures of North American indigenous groups prior to European contact.
Introduction to Biological Elements of Life
Practice identifying the essential elements including carbon, nitrogen, phosphorus, and sulfur that compose biological macromolecules.
Introduction to the Spanish Encomienda System
Explore the fundamental economic and social structures of the Spanish colonial system, focusing on the encomienda and the casta social hierarchy.
Origins and Continuity of the Byzantine Empire
Analyze the political and cultural transitions from the Roman Empire to the Byzantine Empire, focusing on the reign of Justinian I and his code.
Can't find what you're looking for? Explore other subjects.
Students love us — and so will you.
The app is very easy to use and well designed. I have found everything I was looking for so far and have been able to learn a lot from the presentations! I will definitely use the app for a class assignment! And of course it also helps a lot as an inspiration.
This app is really great. There are so many study notes and help [...]. My problem subject is French, for example, and the app has so many options for help. Thanks to this app, I have improved my French. I would recommend it to anyone.
Wow, I am really amazed. I just tried the app because I've seen it advertised many times and was absolutely stunned. This app is THE HELP you want for school and above all, it offers so many things, such as workouts and fact sheets, which have been VERY helpful to me personally.