Unit 1, lesson 2

Relations, Functions, and the Vertical Line Test

What relations and functions are as sets of ordered pairs, how inputs, outputs and the domain fit together, and how the vertical line test spots an input with two outputs.

  • Theory part 3
  • Practice part 4
  • Sets and Functions

A class list pairs every student with a date of birth. Two students may share a birthday, but no student has two. That one-sided rule is exactly what separates a function from any other way of pairing things, and on a graph you can see it with a single vertical line.

Key terms

Ordered pair

Definition An ordered pair (a,b)(a, b) consists of a first coordinate aa and a second coordinate bb, in that order. Two ordered pairs are equal exactly when their first coordinates are equal and their second coordinates are equal,

(a,b)=(c,d)  ⟺  a=c and b=d.\begin{aligned} &(a, b) = (c, d) \\[0.4em] &\iff a = c \text{ and } b = d. \end{aligned}

The same notation (a,b)(a, b) is also used for an open interval. The context tells which one is meant.

In plain words In a pair, order matters. The pair (2,5)(2, 5) and the pair (5,2)(5, 2) are different, while the sets {2,5}\{2, 5\} and {5,2}\{5, 2\} are the same.

Example Suppose (x−1,4)=(3,y+2)(x - 1, 4) = (3, y + 2). Comparing first coordinates gives x−1=3x - 1 = 3, and comparing second coordinates gives 4=y+24 = y + 2. So x=4x = 4 and y=2y = 2.

Coordinate plane

Definition The coordinate plane is a plane with two perpendicular real number lines, the horizontal xx-axis and the vertical yy-axis, which cross at their common zero point, the origin. Positive numbers lie to the right on the xx-axis and upward on the yy-axis. Each point PP is matched with exactly one ordered pair (x,y)(x, y) of real numbers, and each ordered pair of real numbers with exactly one point. The number xx is where the vertical line through PP crosses the xx-axis, and yy is where the horizontal line through PP crosses the yy-axis. In this way the plane is identified with the set

R2={(x,y)∣x∈R and y∈R}.\mathbb{R}^2 = \{(x, y) \mid x \in \mathbb{R} \text{ and } y \in \mathbb{R}\}.

The axes split the rest of the plane into four quadrants, numbered I to IV counterclockwise starting at the upper right. Points on an axis belong to no quadrant.

QuadrantSign of xxSign of yy
Ipositivepositive
IInegativepositive
IIInegativenegative
IVpositivenegative

In plain words The first coordinate says how far to go right or left from the origin, and the second says how far to go up or down.

Example To plot (3,−2)(3, -2), start at the origin, move 3 units right and then 2 units down. The point lies in quadrant IV. The point (−2,3)(-2, 3) lies in quadrant II, so swapping the coordinates moved the point somewhere else entirely. The point (0,−5)(0, -5) lies on the yy-axis and in no quadrant.

Relation

Definition For sets AA and BB, write A×BA \times B for the set of all ordered pairs with first coordinate in AA and second coordinate in BB,

A×B={(a,b)∣a∈A and b∈B}.\begin{aligned} &A \times B \\[0.4em] &\quad = \{(a, b) \mid a \in A \text{ and } b \in B\}. \end{aligned}

A relation from AA to BB is any subset RR of A×BA \times B. When (a,b)∈R(a, b) \in R, we say that aa is related to bb. A relation between real numbers is a set of ordered pairs of real numbers, and its graph is the set of all points in the coordinate plane with those coordinates.

In plain words A relation is a collection of pairs that says which first items go with which second items. Any collection of pairs counts, with no further conditions.

Example Let A={1,2,3}A = \{1, 2, 3\} and B={4,5,6}B = \{4, 5, 6\}. The set R={(1,4),(1,6),(3,5)}R = \{(1, 4), (1, 6), (3, 5)\} is a relation from AA to BB. In it, 11 is related to two elements and 22 to none. An equation can define a relation too. The pairs (x,y)(x, y) of real numbers with x2+y2=25x^2 + y^2 = 25 form a relation whose graph is the circle of radius 55 centered at the origin. It contains (3,4)(3, 4), (3,−4)(3, -4) and (−5,0)(-5, 0).

Function

Definition A function ff from a set AA to a set BB, written f ⁣:A→Bf \colon A \to B, is a relation from AA to BB in which every element of AA is the first coordinate of exactly one ordered pair in ff. If (a,b)∈f(a, b) \in f, then bb is called the value of ff at aa.

“Exactly one” contains two requirements. Every element of AA has at least one partner, and no element of AA has two different partners. When no sets AA and BB are named, a set of ordered pairs is simply called a function if no first coordinate appears in two pairs with different second coordinates. It is then a function from the set of its first coordinates.

In plain words A function gives each allowed input one and only one output.

Example Again let A={1,2,3}A = \{1, 2, 3\} and B={4,5,6}B = \{4, 5, 6\}. The set

f={(1,4),(2,6),(3,4)}f = \{(1, 4), (2, 6), (3, 4)\}

is a function from AA to BB, since 11, 22 and 33 each appear exactly once as a first coordinate. The relation RR from the previous section is not a function from AA to BB, because 11 has two partners and 22 has none.

Domain

Definition The domain of a relation is the set of all first coordinates of its pairs. For a function f ⁣:A→Bf \colon A \to B the domain is the whole set AA, and every element of the domain has exactly one value. The set of all values is the range of ff, which has a lesson of its own. When a function of real numbers is given by a formula and no domain is stated, the domain is the set of all real numbers for which the formula gives a real number, called the natural domain.

In plain words The domain is the set of inputs the function accepts, and the function must have an answer for every one of them.

Example The function {(−1,1),(0,0),(1,1),(2,4)}\{(-1, 1), (0, 0), (1, 1), (2, 4)\} has domain {−1,0,1,2}\{-1, 0, 1, 2\} and range {0,1,4}\{0, 1, 4\}. The pairs (x,x)(x, \sqrt{x}) with x≥0x \ge 0 form a function with domain [0,∞)[0, \infty). No pair starts with −4-4, because −4\sqrt{-4} is not a real number.

Inputs, outputs and variables

Definition For a function ff, an input is an element xx of the domain, and the output for xx is the unique yy with (x,y)∈f(x, y) \in f. Suppose a function is described by an equation solved for yy, such as y=x2+1y = x^2 + 1, which gives exactly one yy for each allowed xx. Then xx is called the independent variable, since it can take any value in the domain, and yy is called the dependent variable, since its value is determined by xx. The graph of the function is the set of all points (x,y)(x, y) where yy is the output for xx, with the independent variable on the horizontal axis.

In plain words You choose the input, and the function decides the output. The independent variable is the one you are free to choose.

Example A square with side length ss centimeters has area

A=s2 square centimeters.A = s^2 \text{ square centimeters.}

Here ss is the independent variable and AA is the dependent one. The input s=3s = 3 gives the output A=9A = 9, so the pair (3,9)(3, 9) is on the graph. Only positive side lengths make sense for a real square, so in this situation the domain is (0,∞)(0, \infty).

Mapping diagram

Definition A mapping diagram of a relation from a finite set AA to a finite set BB lists the elements of AA in one column and the elements of BB in a second column, and draws an arrow from aa to bb for each pair (a,b)(a, b) in the relation. The relation is a function from AA to BB exactly when every element of AA has exactly one arrow leaving it. Elements of BB may receive any number of arrows, including none.

In plain words Count the arrows leaving each input. One arrow from every input means a function, whatever happens on the output side.

Example Take A={1,2,3}A = \{1, 2, 3\}, B={7,8,9}B = \{7, 8, 9\} and the relation {(1,7),(2,7),(3,9)}\{(1, 7), (2, 7), (3, 9)\}. Its arrows are

1→7,2→7,3→9.1 \to 7, \qquad 2 \to 7, \qquad 3 \to 9.

Each input has exactly one arrow, so this is a function. The output 77 receives two arrows and 88 receives none, and both are allowed. Adding the pair (3,8)(3, 8) would give 33 a second arrow, and the relation would no longer be a function.

Vertical line test

Definition A set GG of points in the coordinate plane is the graph of a function of xx exactly when every vertical line meets GG in at most one point. In that case the domain of the function is the set of all numbers cc for which the vertical line x=cx = c meets GG. The reason is that the points of GG on the line x=cx = c are exactly the pairs in GG with first coordinate cc.

In plain words Slide a vertical line across the graph. If it ever hits the graph twice, some input has two outputs, and the graph does not belong to a function.

Example On the circle x2+y2=25x^2 + y^2 = 25, the vertical line x=3x = 3 meets the points (3,4)(3, 4) and (3,−4)(3, -4), since 9+16=259 + 16 = 25. So the circle is not the graph of a function of xx. On the parabola y=x2y = x^2, the line x=cx = c meets only the point (c,c2)(c, c^2), so the parabola passes. The upper half of the circle, given by

y=25−x2,y = \sqrt{25 - x^2},

also passes, and its domain is [−5,5][-5, 5]. A sketch only shows part of a graph, so for a graph given by an equation, check the test with algebra as done here.

Many-to-one versus one-to-many

Definition A relation is many-to-one when at least two different first coordinates share the same second coordinate. It is one-to-many when at least one first coordinate is paired with two or more different second coordinates. A function may be many-to-one, but a function is never one-to-many, since that would give an input two outputs. A function in which different inputs always have different outputs is called one-to-one.

In plain words Many inputs sharing one output is fine for a function. One input with many outputs is not.

Example The function y=x2y = x^2 is many-to-one, because the inputs −2-2 and 22 both give the output 44. The relation y2=xy^2 = x is one-to-many, because the input x=4x = 4 is paired with both y=2y = 2 and y=−2y = -2. So y2=xy^2 = x does not define yy as a function of xx. Read the other way, with yy as the input, the same equation x=y2x = y^2 does define xx as a function of yy.

Check yourself

  1. Is {(2,3),(4,3),(6,5)}\{(2, 3), (4, 3), (6, 5)\} a function? Give its domain and say whether it is many-to-one, one-to-many or neither.
Show the answer

Yes. Each of 22, 44 and 66 appears exactly once as a first coordinate, so it is a function with domain {2,4,6}\{2, 4, 6\}. It is many-to-one, since the inputs 22 and 44 share the output 33.

  1. Does the equation y2=x+1y^2 = x + 1 define yy as a function of xx?
Show the answer

No. For x=3x = 3 the equation becomes y2=4y^2 = 4, so both y=2y = 2 and y=−2y = -2 work. The vertical line x=3x = 3 meets the graph at (3,2)(3, 2) and (3,−2)(3, -2).

  1. For which real numbers kk is {(1,2),(3,5),(k,7)}\{(1, 2), (3, 5), (k, 7)\} a function?
Show the answer

For every real kk except 11 and 33. If k=1k = 1, the input 11 has the two outputs 22 and 77. If k=3k = 3, the input 33 has the two outputs 55 and 77. Any other kk is a new input with a single output.

How this lesson connects