A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

Variables in Logic

Middle & High School Depth 56 in the knowledge graph ☐ I know this ☆ Set as goal
9,558topics build on this
274prerequisites beneath it
See this on the map →
What Is an Argument?Variable Expressions→→Conditional Statements (If-Then Formal)Introduction to Propositional Logic+2 more
variables propositions abstraction logic

Core Idea

Just as algebra uses letters like x and y to stand for unknown numbers, logic uses letters like P and Q to stand for statements that can be true or false. Writing "If P, then Q" lets you study the structure of an argument without specifying what P and Q actually say. This abstraction is what makes logic powerful — a rule about "If P, then Q" applies to every argument with that shape, whether P means "it rains" or "the number is even." Variables in logic separate the form of reasoning from its content.

How It's Best Learned

Begin with a concrete argument: "If it is raining, then the ground is wet." Label the parts: let P = "it is raining" and Q = "the ground is wet." Then show the same structure in a different context: P = "you study," Q = "you pass." The identical form "If P, then Q" captures both. Have students translate five different arguments into P-Q form and recognize they share a structure. Connect to algebraic variables: in algebra, x + x = 2x works for any number; in logic, "If P, then Q" works for any statements.

Common Misconceptions

Explainer

In algebra, you learned to write x + 5 = 12 and solve for x. The letter x stands for an unknown number. Logic does something similar but with a different kind of object: instead of numbers, logical variables stand for statements. When you write P to mean "the sun is shining" or Q to mean "I will go for a walk," you are creating placeholders that let you talk about the structure of reasoning without getting caught up in the details.

Why bother? Because logical structure is what determines whether reasoning is valid. The argument "If it is raining, then the ground is wet; it is raining; therefore the ground is wet" has exactly the same structure as "If the number is even, then it is divisible by 2; the number is even; therefore it is divisible by 2." Both are instances of "If P, then Q; P; therefore Q." By working with variables, you study all arguments of this form simultaneously rather than analyzing each one individually.

The key difference from algebraic variables: in algebra, x represents a number and can take values like 3 or -7.5. In logic, P represents a complete statement and can take exactly two values — true or false. There is no "partially true" or "somewhat false" in classical logic. When you substitute a specific statement for P, that statement is either true or false, and the logical structure tells you what follows.

The letters you choose are arbitrary. P and Q are traditional, but you could use A and B, or S₁ and S₂, or any other labels. What matters is consistency: once you define P as "it is raining," you must use P for that same statement throughout the argument. This is the same discipline as algebra — once you say x = 3, you cannot later treat x as 5 within the same problem.

This abstraction is what turns logic from a collection of specific arguments into a general science of reasoning. Every rule you will learn — about conditionals, contrapositives, truth tables, and proofs — will be stated in terms of variables, and will therefore apply to every possible argument with the matching structure.

Practice Questions 3 questions

Prerequisite Chain

Understanding Zero → The Number Zero → Counting to Five → Counting to 10 → Counting to 20 → Counting a Set of Objects Up to 20 → Cardinality: The Last Number Counted → Matching Numerals to Quantities → Subitizing Small Quantities → Addition Within 10 → Making 10 as an Addition Strategy → Addition Within 20 → Doubles and Near Doubles → Doubles Facts Within 10 → Near Doubles Facts Within 20 → Mental Math Strategies for Addition → Mental Math: Adding and Subtracting Tens → Addition Within 100 → Repeated Addition as Multiplication → Multiplication as Equal Groups → Multiplication: Arrays → Basic Multiplication Facts Through 10 → Multiplication Facts Within 100 → Division as Equal Sharing → Division as Grouping (Measurement Division) → Division: Grouping (Repeated Subtraction) Model → Division: Fair Sharing Model → Division as Equal Sharing → Division as Grouping → Basic Division Facts → Division Facts Within 100 → Multiplication and Division Fact Families → Relationship Between Multiplication and Division → Division Facts as Inverse of Multiplication → Remainders and Quotients in Division → Division Word Problems → Multi-Step Word Problems → Solving Multi-Step Word Problems → Multiplication Word Problems → Division Word Problems → Introduction to Long Division → Factors and Multiples → Prime and Composite Numbers → Equivalent Fractions → Relating Fractions and Decimals → Decimal Place Value → Integers and the Number Line → Opposites and Additive Inverses → Absolute Value → Adding Integers → Subtracting Integers → Multiplying Integers → Introduction to Exponents → Order of Operations → Integer Order of Operations → Variable Expressions → Variables in Logic

Longest path: 57 steps · 274 total prerequisite topics

Prerequisites (2)

Leads To (4)