Skip to main content
Mathematics LibreTexts

1.3: Logic

  • Page ID
    23208
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    Two of the most subtle words in the English language are the words “and” and “or.” One has only three letters, the other two, but it is absolutely amazing how much confusion these two tiny words can cause. Our intent in this section is to clear the mystery surrounding these words and prepare you for the mathematics that depends upon a thorough understanding of the words “and” and “or.”

    Set Notation

    We begin with the definition of a set.

    Definition 1

    A set is a collection of objects.

    The objects in the set could be anything at all: numbers, letters, first names, cities, you name it. In this section we will focus on sets of numbers, but it is important to understand that the objects in a set can be whatever you choose them to be.

    If the number of objects in a set is finite and small enough, we can describe the set simply by listing the elements (objects) in the set. This is usually done by enclosing the list of objects in the set with curly braces. For example, let

    \[A=\{1,3,5,7,9,11\}\]

    Now, when we refer to the set A in the narrative, everyone should know we’re talking about the set of numbers 1, 3, 5, 7, 9, and 11.

    It is also possible to describe the set A with words. Although there are many ways to do this, one possible description might be “Let A be the set of odd natural numbers between 1 and 11, inclusive.” This descriptive technique is particularly efficient when the set you are describing is either infinite or too large to enumerate in a list.

    For example, we might say “let A be the set of all real numbers that are greater than 4.” This is much better than trying to list each of the numbers in the set A, which would be futile in this case. Another possibility is to combine the curly brace notation with a textual description and write something like

    \[A=\{ real numbers that are greater than 4\}\]

    If we’re called upon to read this notation aloud, we would say “A is the set of all real numbers that are greater than 4,” or something similar.

    There are a number of more sophisticated methods we can use to describe a set. One description that we will often employ is called set-builder notation and has the following appearance.

    \[A=\{x : some statement describing x\}\]

    It is standard to read the notation \(\{x : \quad\}\) aloud as follows: “The set of all x such that.” That is, the colon is pronounced “such that.” Then you would read the description that follows the colon. For example, the set

    \[A=\{x : x<3\}\]

    is read aloud “A is the set of all x such that x is less than 3.” Some people prefer to use a “bar” instead of a colon and they write

    \[A=\{x | \text { some statement describing } x\}\]

    This is also pronounced “A is the set of all x such that,” and then you would read the text description that follows the “bar.” Thus, the notation

    \[A=\{x | x<3\}\]

    is identical to the notation \(A=\{x : x<3\}\) used above and is read in exactly the same manner, “A is the set of all x such that x is less than 3.” We prefer the colon notation, but feel free to use the “bar” if you like it better. It means the same thing.

    A moment’s thought will reveal the fact that the notation \(A=\{x : x<3\}\) is not quite descriptive enough. It’s probably safe to say, since the description of x is “x < 3,” that this notation is referring to numbers that are less than 3, but what kind of numbers? Natural numbers? Integers? Rational numbers? Irrational numbers? Real numbers? The notation \(A=\{x : x<3\}\) doesn’t really tell the whole story.

    We’ll fix this deficiency in a moment, but first recall that in our preliminary chapter, we used specific symbols to represent certain sets of numbers. Indeed, we used the following:

    \[\begin{aligned} \mathbb{N} &=\{\text { natural numbers }\} \\ \mathbb{Z} &=\{\text { integers }\} \\ \mathbb{Q} &=\{\text { rational numbers }\} \\ \mathbb{R} &=\{\text { real numbers }\} \end{aligned}\]

    We can use these symbols to help denote the type of number described with our setbuilder notation. For example, if we write

    \[A=\{x \in \mathbb{N} : x<3\}\]

    then we say “A is the set of all x in the natural numbers such that x is less than 3,” or more simply, “the set of all natural numbers that are less than 3.” The symbol ∈ is the Greek letter “epsilon,” and when used in set-builder notation, it is pronounced “is an element of,” or “is in.” Of course, the only natural numbers \(\mathbb{N}=\{1,2,3, \ldots\}\) that are less than 3 are the natural numbers 1 and 2. Thus, \(A = {1, 2}\), the “set whose members are 1 and 2.”

    On the other hand, if we write

    \[A=\{x \in \mathbb{Z} : x<3\}\]

    then we say that “A is the set of x in the set of integers such that x is less than 3,” or more informally, “A is the set of all integers less than 3.” Of course, the integers \(\mathbb{Z}=\{0, \pm 1, \pm 2, \pm 3, \ldots\}^{2}\) less than 3 are infinite in number. We cannot list all of them unless we appeal to the imagination with something like

    \[A=\{\ldots,-3,-2,-1,0,1,2\}\]

    The ellipsis . . . means “etc.” We’ve listed enough of the numbers to establish a pattern, so we’re permitted to say “and so on.” The reader intuits that the earlier numbers in the list are −4, −5, etc.

    Let’s look at another example. Suppose that we write \[A=\{x \in \mathbb{R} : x<3\}\]

    Then we say “A is the set of all x in the set of real numbers such that x is less than 3,” or more informally, “A is the set of all real numbers less than 3.” Of course, this is another infinite set and it’s not hard to imagine that the notation \(\{x \in \mathbb{R} : x<3\}\) used above is already optimal for describing this set of real numbers.

    In this text, we will mostly deal with sets of real numbers. Thus, from this point forward, if we write

    \[A=\{x : x<3\}\]

    we will assume that we mean to say that “A is the set of all real numbers less than 3.” That is, if we write \(A=\{x : x<3\}\), we understand this to mean \(A=\{x \in \mathbb{R} : x<3\}\). In the case when we want to use a specific set of numbers, we will indicate that as we did above, for example, in \(A=\{x \in \mathbb{N} : x<3\}\).

    The Real Line and Interval Notation

    Suppose that we draw a line (affectionately known as the “real line”), then plot a point anywhere on that line, then map the number zero to that point (called the “origin”), as shown in Figure \(\PageIndex{1}\). Secondly, decide on a unit distance and map the number 1 to that point, again shown in Figure \(\PageIndex{1}\).

    F1.jpg

    Figure \(\PageIndex{1}\) Establishing the origin and a unit length on the real line.

    Now that we’ve established a unit distance, every real number corresponds to a point on the real line. Vice-versa, every point on the real line corresponds to a real number. This defines a one-to-one correspondence between the real numbers in \(\mathbb{R}\) and the points on the real line. In this manner, the point on the line and the real number can be thought of as synonymous. Figure \(\PageIndex{2}\) shows several real numbers plotted on the real line.


    WeChataf07f4b478511c00bda71b5627f2b3ce.png

    Figure \(\PageIndex{2}\) Sample numbers on the real line.

    Now, suppose that we’re asked to shade all real numbers in the set \(\{x : x>3\}\). Because this requires that we shade every real number that is greater than 3 (to the right of 3), we use the shading shown in Figure \(\PageIndex{3}\) to represent the set \(\{x : x>3\}\).

    WeChatc1705c00273b9f737e8991cafcceef88.png

    Figure \(\PageIndex{3}\). Shading all real numbers greater than 3.

    Although technically correct, the image in Figure 3 contains more information than is really needed. The picture is acceptable, but crowded. The really important information is the fact that the shading starts at 3, then moves to the right. Also, because 3 is not in the set \({x : x > 3}\), that is, 3 is not greater than 3, we do not shade the point corresponding to the real number 3. Note that we’ve indicated this fact with an “empty” circle at 3 on the real line.

    Thus, when shading the set \({x : x > 3}\) on the real line, we need only label the endpoint at 3, use an “empty” circle at 3, and shade all the real numbers to the right of 3, as shown in Figure \(\PageIndex{4}\).


    WeChat087a62511f3acbfbebc316e9fdc96219.png

    Figure \(\PageIndex{4}\). Shading all real numbers greater than 3. The endpoint is the only information that needs to be labeled. It is not necessary to show any other tickpoints and/or labels.

    Because we’re shading all numbers from 3 to positive infinity in Figure \(\PageIndex{4}\), we’ll use the following interval notation to represent this “interval” of numbers (everything between 3 and positive infinity).

    \[(3, \infty)=\{x : x>3\}\]

    Similarly, Table \(\PageIndex{1}\) lists the set-builder and interval notations, as well as shading of the sets on the real line, for several situations, including the one just discussed.

    There are several points of emphasis regarding the intervals in Table \(\PageIndex{1}\).

    1. When we want to emphasize that we are not including a point on the real line, we use an “empty circle.” Conversely, a “filled circle” means that we are including the point on the real line. Thus, the real lines in the first two rows of Table \(\PageIndex{1}\) do not include the number 3, but the real lines in the last two rows in Table \(\PageIndex{1}\) do include the number 3.

    2. The use of a parenthesis in interval notation means that we are not including that endpoint in the interval. Thus, the parenthesis use in \((-\infty, 3)\) in the second row of Table \(\PageIndex{1}\) means that we are not including the number 3 in the interval.

    Number line Set-builder notation Interval notation
    WeChat60fa9f83dbd7d990596f8ef291ef3a48.png {x : x > 3} \((3, \infty)\)
    WeChat5c2e27817c0c16536c5a4dcd8a304417.png {x : x < 3} \((-\infty, 3)\)
    WeChat1545c7003d775d30aa8df34d5bd762f0.png \(\{x : x \geq 3\}\) \([3, \infty)\)
    WeChat25bf7fea68d20816b1419bdf8b5274cf.png \(\{x : x \leq 3\}\) \((-\infty, 3]\)

    Table \(\PageIndex{1}\) Number lines, set-builder notation, and interval notation.

    3. The use of a bracket in interval notation means that we are including the bracketed number in the interval. Thus, the bracket used in \([3, \infty)\), as seen in the third row of Table \(\PageIndex{1}\), means that we are including the number 3 in the interval.

    4. The use of \(\infty\) in \((3, \infty)\) in row one of Table \(\PageIndex{1}\) means that we are including every real number greater than 3. The use of \(-\infty\) in \((-\infty, 3]\) means that we are including every real number less than or equal to 3. As \(-\infty\) and \(\infty\) are not actual numbers, it makes no sense to include them with a bracket. Consequently, you must always use a parenthesis with \(-\infty\) or \(\infty\).

    Union and Intersection

    The intersection of two sets A and B is defined as follows.

    Definition 3

    The intersection of the sets A and B is the set of all objects that are in A and in B. In symbols, we write

    \[A \cap B=\{x : x \in A \text { and } x \in B\}\]

    In order to understand this definition, it’s absolutely crucial that we understand the meaning of the word “and.” The word “and” is a conjunction, used between statements P and Q, as in “It is raining today and my best friend is the Lone Ranger.” In order to determine the truth or falsehood of this statement, you must first examine the truth or falsehood of the statements P and Q on each side of the word “and.”

    The only way that the speaker is telling the truth is if both statements P and Q are true. In other words, the statement “It is raining today and my best friend is the Lone Ranger” is true if and only if the statement “It is raining today” is true and the statement “my best friend is the Lone Ranger” is also true. Logicians like to make up a construct called a truth table, like the one shown in Table \(\PageIndex{2}\).

    Points in Table \(\PageIndex{2}\) to consider:

    P Q P and Q
    T T T
    T F F
    F T F
    F F F

    Table \(\PageIndex{2}\) Truth table for the conjunction “and.”

    • In the first row (after the header row) of Table \(\PageIndex{2}\), if statements P and Q are both true (indicated with a T), then the statement “P and Q” is also true.
    • In the remaining rows of Table \(\PageIndex{2}\), one or the other of statements P or Q are false (indicated with an F), so the statement “P and Q” is also false.

    Therefore, the statement “P and Q” is true if and only if P is true and Q is true.

    Example \(\PageIndex{1}\)

    If A = {1, 3, 5, 7, 9} and B = {2, 5, 7, 8, 11}, find the intersection of A and B.

    Solution

    As a reminder, the intersection of A and B is

    \[A \cap B=\{x : x \in A \text { and } x \in B\}\]

    Thus, we are looking for the objects that are in A and in B. The only objects that are in A and in B (remember, both statements “in A” and “in B” must be true) are 5 and 7, so we write:

    \[A \cap B=\{5,7\}\]

    Mathematicians and logicians both use a visual aid called a Venn Diagram to represent sets. John Venn was an English mathematician who devised this visualization of logical relationships. Consider the ellipse A in Figure \(\PageIndex{5}\). Everything inside the boundary of this ellipse constitutes the set A = {1, 3, 5, 7, 9}. That’s why you see these numbers inside the boundary of this ellipse.

    Consider the ellipse B in Figure \(\PageIndex{5}\). Everything inside the boundary of this ellipse constitutes the set B = {2, 5, 7, 8, 11}. That’s why you see these numbers inside the boundary of this ellipse.

    WeChat7201ea9d5cfa945141861d23e44edafe.png

    Figure \(\PageIndex{5}\) Venn Diagram

    Now, note that only two numbers, 5 and 7, are contained within the boundaries of both A and B. These are the numbers that are in the intersection of the sets A and B.

    The shaded region in Figure \(\PageIndex{6}\) is the area that belongs to both of the sets A and B. Note how this shaded region is aptly named “the intersection of the sets A and B.” This is the region that is in common to the sets A and B, the region where the sets A and B overlap or “intersect.”

    WeChatcb496129be0b3adace7cd846d9d2ab0f.png

    Figure \(\PageIndex{6}\) The shaded region is the intersection of the sets A and B. That is, the shaded region is \(A \cap B\).

    This leads to the following important piece of advice.

    Note

    When asked to find the intersection of two sets A and B, look to see where the sets intersect or overlap. That is, look to see the elements that are in both sets A and B.

    Let’s move on to the definition of the union of two sets A and B.

    Definition

    The union of the sets A and B is the set of all objects that are in A or in B. In symbols, we write

    \[A \cup B=\{x : x \in A \text { or } x \in B\}\]

    In order to understand this definition, it’s critical that we understand the meaning of the word “or.” The word “or” is a disjunction, used between statements P and Q, as in “It is raining today or my best friend is the Lone Ranger.” In order to determine the truth or falsehood of this statement, you must first examine the truth or falsehood of the statements P and Q on each side of the word “or.”

    The speaker is telling the truth if either statement P is true or statement Q is true. In other words, the statement “It is raining today or my best friend is the Lone Ranger” is true if and only if the statement “It is raining today” is true or the statement “my best friend is the Lone Ranger” is true. Logicians like to make up a construct called a truth table, like the one shown in Table \(\PageIndex{3}\).

    P Q P or Q
    T T T
    T F T
    F T T
    F F F

    Table \(\PageIndex{3}\) Truth table for the conjunction “or.”

    Points in Table \(\PageIndex{3}\) to consider:

    • In the last row of Table \(\PageIndex{3}\) , both statements P and Q are false (indicated with an F), so the statement P or Q is also false.
    • In the first three rows (after the header row) of Table \(\PageIndex{3}\) , either statement P is true or statement Q is true (indicated with a T), so the statement P or Q is also true.

    Therefore, the statement “P or Q” is true if and only if either statement, P or Q, is true.

    Example \(\PageIndex{2}\)

    If A = {1, 3, 5, 7, 9} and B = {2, 5, 7, 8, 11}, find the union of A and B.

    Solution

    As a reminder, the union of A and B is \[A \cup B=\{x : x \in A \text { or } x \in B\}\]

    Thus, an object is in the union of A and B if and only if it is in either set. The numbers that are in either set are the numbers \[A \cup B=\{1,2,3,5,7,8,9,11\}\]

    If we look again at the Venn Diagram in Figure \(\PageIndex{5}\), we see that this union \(A \cup B\) = {1, 2, 3, 5, 7, 8, 9, 11} lists every number that is in either set in Figure \(\PageIndex{5}\).

    Thus, the shaded region in Figure \(\PageIndex{7}\) is the union of sets A and B. Note how this region is well-named, as that’s what you’re actually doing, taking the “union” of the two sets A and B. That is, the union contains all elements that belong to either A or B. Less formally, the union is a way of combining everything that occurs in either set.

    WeChat95287088d5f90153804ebb6925a95753.png

    Figure \(\PageIndex{7}\). The shaded region is the union of sets A and B. That is, the shaded region is \(A \cup B\).

    This leads to the following important piece of advice.

    Note

    When asked to find the union of two sets A and B, in your answer, include everything from both sets.

    Simple Compound Inequalities

    Let’s apply what we’ve learned to find the unions and/or intersections of intervals of real numbers. The easiest approach is through a series of examples. Let’s begin.

    Example \(\PageIndex{3}\)

    On the real line, sketch the set of real numbers in the set {x : x < 3 or x < 5}. Use interval notation to describe your final answer.

    Solution

    First, let’s sketch two sets, {x : x < 3} and {x : x < 5}, on separate real lines, one atop the other as shown in Figure \(\PageIndex{8}\).

    WeChate8a410f3d3c40c44ca241e73bc926210.png

    Figure \(\PageIndex{8}\) Sketch each set separately.

    Now, to sketch the solution, note the word “or” in the set {x : x < 3 or x < 5}. Thus, we need to take the union of the two shaded real lines in Figure \(\PageIndex{8}\). That is, we need to shade everything that is shaded on either of the two number lines. Of course, this would be everything less than 5, as shown in Figure \(\PageIndex{9}\).

    WeChat4ac8438b6c31a0ff029dc59eec8fa9dc.png

    Figure \(\PageIndex{9}\) The final solution is the union of the two shaded sets in Figure \(\PageIndex{8}\).

    Thus, the final solution is {x : x < 5}, which in interval notation, is \((-\infty, 5)\).

    Let’s look at another example.

    Example \(\PageIndex{4}\)

    On the real line, sketch the set of real numbers in the set {x : x < 3 and x < 5}. Use interval notation to describe your final answer.

    Solution

    In Example \(\PageIndex{3}\), you were asked to shade the set {x : x < 3 or x < 5} on the real line. In this example, we’re asked to sketch the set {x : x < 3 and x < 5}. Note that the set-builder notations are identical except for one change, the “or” of Example \(\PageIndex{3}\) has been replaced with the word “and.”

    Again, sketch two sets, {x : x < 3} and {x : x < 5}, on separate real lines, one atop the other as shown in Figure \(\PageIndex{10}\).

    WeChat9771d5ea48926858a9859c911ca5371f.png

    Figure \(\PageIndex{10}\). Sketch each set separately.

    Now, to sketch the solution, note the word “and” in the set {x : x < 3 and x < 5}. Thus, we need to take the intersection of the two shaded real lines in Figure \(\PageIndex{10}\).. That is, we need to shade everything that is common to the two number lines. Of course, this would be everything less than 3, as shown in Figure \(\PageIndex{11}\).

    WeChatf4ad597e65730474fcab29bb4d71ead8.png

    Figure \(\PageIndex{11}\). The final solution is the intersection of the two shaded sets in Figure \(\PageIndex{10}\).

    Thus, the final solution is {x : x < 3}, which in interval notation, is \((-\infty, 3)\).

    Note

    If you answer “or” when the answer requires “and,” or vice-versa, you have not made a minor mistake. Indeed, this is a huge error, as demonstrated in Example \(\PageIndex{3}\) and Example \(\PageIndex{4}\).

    Before attempting another example, we pause to define a bit of notation that will be extremely important in our upcoming work.

    Definition

    The notation

    \[a<x<b\]

    is interpreted to mean

    \[x>a \text { and } x<b\]

    Alternatively, we could have said that a < x < b is identical to saying “a < x and x < b,” but saying “a < x” is the same as saying “x > a.” We prefer to say “x > a and x < b,” and will use this order throughout our work, but the form “a < x and x < b” is equally valid.

    The really key point to make here is the fact that the statement a < x < b is an “and” statement. If it is used properly, it’s a good way to describe the numbers that lie between a and b.

    Let’s look at an example.

    Example \(\PageIndex{5}\)

    On the real line, sketch the set of real numbers in the set {x : 3 < x < 5}. Use interval notation to describe your answer.

    Solution

    First, let’s write what’s meant by the notation {x : 3 < x < 5}. By definition, this set is the same as the set

    \[\{x : x>3 \text { and } x<5\}\]

    Thus, the first step is to sketch the sets {x : x > 3} and {x : x < 5} on individual real lines, stacked one atop the other, as shown in Figure \(\PageIndex{12}\).

    WeChatf698feec595f244c28b9681e5d4e9bf5.png

    Figure \(\PageIndex{12}\). Sketch each set separately.

    Now, to sketch the solution, note the word “and” in the set {x : x > 3 and x < 5}. Thus, we need to take the intersection of the two lines in Figure \(\PageIndex{12}\). That is, we need to shade the numbers on the real line that are in common to the two lines shown in Figure \(\PageIndex{12}\). The numbers 3 and 5 are not shaded in both sets in Figure \(\PageIndex{12}\), so they will not be shaded in our final solution. However, all real numbers between 3 and 5 are shaded in both sets in Figure \(\PageIndex{12}\), so these numbers will be shaded in the final solution shown in Figure \(\PageIndex{13}\).

    WeChat93c18bc2d8d93d28436e2f332f6172f9.png

    Figure \(\PageIndex{13}\). The final solution is the intersection of the two shaded sets in Figure \(\PageIndex{12}\).

    In a most natural way, the interval notation for the shaded solution in Figure \(\PageIndex{13}\) is (3, 5). That is,

    \[(3,5)=\{x : 3<x<5\}\]

    Similarly, here are the set-builder and interval notations, as well as shading of the sets on the real line, for several situations, including the one just discussed.

    Number line Set-builder notation Interval notation
    WeChatbda14c0e8f5c8d2cdca47a2ae2711cd8.png \(\{x : 3 < x < 5\}\) \((3,5)\)
    WeChata8fd3db058b13b5147fbb57ffbfa6eb7.png

    \(\{x : 3 \leq x \leq 5\}\)

    \([3,5]\)
    WeChat817ee4b8a9e4af7c63ab82d72557a784.png \(\{x : 3 \leq x < 5\}\) \([3,5)\)
    WeChatf49ae38c11cba9912f6c2f7b15f4671e.png \(\{x : 3 < x \leq 5\}\) \((3,5]\)

    Table \(\PageIndex{4}\). Number lines, set-builder notation, and interval notation.

    There are several points of emphasis regarding the intervals in Table \(\PageIndex{4}\).

    1. When we want to emphasize that we are not including a point on the real line, we use an “empty circle.” Conversely, a “filled circle” means that we are including the point on the real line. Thus, the interval in the first row of Table \(\PageIndex{4}\) does not include the endpoints at 3 and 5, but the interval in the second row of Table \(\PageIndex{4}\) does include the endpoints at 3 and 5.
    2. The use of a parenthesis in interval notation means that we are not including that endpoint in the interval. Thus, the parentheses used in (3, 5) in the first row of Table \(\PageIndex{4}\) means that we are not including the numbers 3 and 5 in that interval.
    3. The use of a bracket in interval notation means that we are including the bracketed number in the interval. Thus, the brackets used in [3, 5], as seen in the second row of Table \(\PageIndex{4}\), means that we are including the numbers 3 and 5 in the interval.
    4. Finally, note that some of our intervals are “open” on one end but “closed” (filled) on the other end, such as those in rows 3 and 4 of Table \(\PageIndex{4}\).

    Definition

    Some terminology:

    • The interval (3, 5) is open at each end. Therefore, we call the interval (3, 5) an open interval.
    • The interval [3, 5] is closed (filled) at each end. Therefore, we call the interval [3, 5] a closed interval.
    • The intervals (3, 5] and [3, 5) are neither open nor closed.

    Let’s look at another example.

    Example \(\PageIndex{6}\)

    On the real line, sketch the set of all real numbers in the set \(\{x : x > 3 or x < 5\}\). Use interval notation to describe your answer.

    Solution

    Note that the only difference between this current example and the set shaded in Example \(\PageIndex{4}\) is the fact that we’ve replaced the word “and” in \(\{x : x > 3 and x < 5\}\) with the word “or” in \(\{x : x > 3 or x < 5\}\). But, as we’ve seen before, this can make a world of difference.

    Thus, the first step is to sketch the sets \(\{x : x > 3\}\) and \(\{x : x < 5\}\) on individual real lines, stacked one atop the other, as shown in Figure \(\PageIndex{14}\).

    WeChate55660b0a59e03cb1ebfd4dd3ac5fcf2.png

    Figure \(\PageIndex{14}\). Sketch each set separately

    Now, to sketch the solution, note the word “or” in the set \(\{x : x > 3 or x < 5\}\). Thus, we need to take the union of the two lines in Figure \(\PageIndex{14}\). That is, we need to shade the numbers on the real line that are shaded on either of the two lines shown in Figure \(\PageIndex{14}\). However, this means that we will have to shade every number on the line, as shown in Figure \(\PageIndex{15}\). You’ll note no labels for 3 and 5 on the real line in Figure \(\PageIndex{15}\), as there are no endpoints in this solution. The endpoints, if you will, are at negative and positive infinity.

    WeChatf71372d63832986875d32f591e69cd38.png

    Figure \(\PageIndex{15}\). The final solution is the union of the two shaded sets in Figure \(\PageIndex{14}\).

    Thus, in a most natural way, the interval notation for the shaded solution in Figure \(\PageIndex{15}\) is \((-\infty, \infty)\).

    Let’s look at another example.

    Example \(\PageIndex{7}\)

    On the real line, sketch the set of all real numbers in the set \(\{x : x < −1 or x > 3\}\). Use interval notation to describe your answer.

    Solution

    The first step is to sketch the sets \(\{x : x < −1\}\) and \(\{x : x > 3\}\) on separate real lines, stacked one atop the other, as shown in Figure \(\PageIndex{16}\).

    WeChat01a488eb7ae09f18f50e8cc87faa93b0.png

    Figure \(\PageIndex{16}\). Sketch each set separately.

    To sketch the solution, note the word “or” in the set \(\{x : x < −1 or x > 3\}\). Thus, we need to take the union of the two shaded real lines in Figure \(\PageIndex{16}\). That is, we need to shade the numbers on the real line that are shaded on either real line in Figure \(\PageIndex{16}\). Thus, every number smaller than −1 is shaded, as well as every number greater than 3. The result is shown in Figure \(\PageIndex{17}\).

    WeChate5025bd3ae2c0a8b52622aebb72034f1.png

    Figure \(\PageIndex{17}\). The final solution is the union of the shaded real lines in Figure \(\PageIndex{16}\).

    Here is an important tip.

    Note

    If you wish to use interval notation correctly, follow one simple rule: Always sweep your eyes from left to right describing what you see shaded on the real line.

    If we follow this advice, as we sweep our eyes from left to right across the real line shaded in Figure \(\PageIndex{17}\), we see that numbers are shaded from negative infinity to −1, and from 3 to positive infinity. Thus, in a most natural way, the interval notation for the shaded solution set in Figure \(\PageIndex{17}\) is

    \[(-\infty,-1) \cup(3, \infty)\]

    There are several important points to make here:

    Note how we used the union symbol \(\cup\) to join the two intervals in \((-\infty,-1) \cup(3, \infty)\) in a natural manner.

    The union symbol is used between sets of numbers, while the word “or” is used between statements about numbers. It is incorrect to exchange the roles of the union symbol and the word “or.” Thus, writing \(\{x : x<-1 \cup x>3\}\) is incorrect, as it would also be to write \((-\infty,-1)\) or \((3, \infty)\).

    We reinforce earlier discussion about the difference between “filled” and “open” circles, brackets, and parentheses in Table 5, where we include several comparisons of interval and set-builder notation, including the current solution to Example \(\PageIndex{7}\).

    Number line Set-builder notation Interval notation
    WeChatf53d03f738331879eb0692dd8625d2f2.png \(\{x : x<-1\) or \(x>3\}\) \((-\infty,-1) \cup(3, \infty)\)
    WeChatba514ec0bdd1cb5c3f4d99acace2bb81.png \(\{x : x \leq-1\) or \(x \geq 3\}\) \((-\infty,-1] \cup[3, \infty)\)
    WeChat7b6757d8d32d2358f013f72f6cfbf85e.png \(\{x : x \leq-1\) or \(x>3\}\) \((-\infty,-1] \cup(3, \infty)\)
    WeChat5608eb1ed2eb2db2316c100c505f1e6d.png \(\{x : x<-1\) or \(x \geq 3\}\) \((-\infty,-1) \cup[3, \infty)\)

    Again, we reinforce the following points.

    • Note how sweeping your eyes from left to right, describing what is shaded on the real line, insures that you write the interval notation in the correct order.
    • A bracket is equivalent to a filled dot and includes the endpoint, while a parenthesis is equivalent to an open dot and does not include the endpoint.

    Let’s do one last example that should forever cement the notion that there is a huge difference between the words “and” and “or.”

    Example \(\PageIndex{8}\)

    On the real line, sketch the set of all real numbers in the set \(\{x : x<-1\) and \(x>3\}\). Describe your solution.

    Solution

    First and foremost, note that the only difference between this example and Example \(\PageIndex{6}\) is the fact that we changed the “or” in \(\{x : x<-1\) or \(x>3\}\) to an “and” in \(\{x : x<-1\) and \(x>3\}\). The preliminary sketches are identical to those in Figure 16.

    WeChat408b237856b9c3870780b38d247eec26.png

    Figure \(\PageIndex{18}\). Sketch \(\{x : x<-1\}\) and \(\{x : x > 3\}\) on separate real lines.

    Now, note the word “and” in \(\{x : x < −1 and x > 3\}\). Thus, we need to take the intersection of the shaded real lines in Figure \(\PageIndex{18}\). That is, we need to shade on a single real line all of the numbers that are shaded on both real lines in Figure \(\PageIndex{18}\). However, there are no points shaded in common on the real lines in Figure 18, so the solution set is empty, as shown in Figure \(\PageIndex{19}\).

    WeChat7f04ee6b5c597bec4a30c39980dd7f67.png

    Figure \(\PageIndex{19}\). The solution is empty so we leave the real line blank.

    Pretty impressive! The last two examples clearly demonstrate that if you interchange the roles of “and” and “or,” you have not made a minor mistake. Indeed, you’ve changed the whole meaning of the problem. So, be careful with your “ands” and “ors.”


    This page titled 1.3: Logic is shared under a CC BY-NC-SA license and was authored, remixed, and/or curated by David Arnold.

    • Was this article helpful?