8.1  Real Functions and Their Graphs

Part II of this volume (Chapters 4–7) ended with polynomials as formal objects and with what their values can and cannot do. Part III (Chapters 8–10) turns to functions of a real variable, the objects that analysis adds, composes, inverts and bounds. This section fixes what a real function is, how two of them combine, how a graph moves when the formula changes, and how a function splits into an even and an odd part. Everything is proved from Sets and Functions, the complete ordered field R and the polynomials of Chapters 6 and 7; no limit appears.

8.1.1. A formula is not yet a function

Let f(x)=x2/x. What is f(0)?

The tempting answer cancels: x2/x=x, so f(0)=0. But the formula x2/x asks us to divide by 0 at 0, and no field rule allows that. Another reader says f(0) is undefined. Both readers have a function in mind, and they have different ones. In Sets and Functions, a function is given by a graph, in which every input of its domain has exactly one value, together with a codomain (Sets and Functions, Definition 2.1.1). A formula supplies the values but not the domain. Until the domain is named, the question has no answer.

Here is a small case. Take the inputs D={1,2,3} and send each input to its square. The values are 1, 4 and 9, and the function is recorded by the three pairs (1,1), (2,4), (3,9). With the inputs {−1,1} and the same rule, the pairs are (−1,1) and (1,1): a different function.

A real function is a set of inputs together with one real value for each of them. The inputs are part of the function, and every input gets exactly one real number.

Definition 8.1.1 (Real Function, Graph)

Let D⊆R. A real function on D is a function f:D→R (Sets and Functions, Definition 2.1.1). Its graph is graphf:={(x,f(x)):x∈D}⊆R2, where R2:=R×R (Sets and Functions, Definition 1.4.2). The set D is always stated; there is no “natural domain” convention.

The graph is exactly the relation G in the definition of a function (Sets and Functions, Definition 2.1.1), since each element of G is the pair (x,f(x)). The codomain of a real function is always R. So the test for equal functions in Sets and Functions (Sets and Functions, Proposition 2.1.1) reads: two real functions are equal if and only if they have the same domain and the same value at every point of it. With D=R∖{0}, the function of the opening question is x↦x2/x on R∖{0}, and 0 is not an input.

Example (First Real Functions)

Each of the following is a real function; check that each input has exactly one value.

Solution. (a), (b) One formula, defined everywhere; |x| is given by two cases that cover R and do not overlap. (c) 1/x exists exactly when x≠0. (d) For x≥0, x is the unique b≥0 with b2=x. It exists because R is a complete ordered field. (e) A restriction keeps the old values on the smaller domain. (f) Enlarging the codomain changes no value. (g) The two pieces are disjoint and cover R, so they glue to one function, as in Sets and Functions, Example (Piecewise definitions are gluings).

Uses: Number Systems: From N to R, Theorem 5.5.2 (R is a complete ordered field); Number Systems: From N to R, Proposition 6.1.4 (square roots exist).

The figure shows, from left to right, the graphs of |x|, 1/x, x and 1[0,∞); an open dot marks a point that is not on the graph.

Diagram. Labels: |x| on mathbb R, 1/x on mathbb R setminus \0\, sqrt x on [0, infty ), mathbf 1_[0,infty ) on mathbb R

Which subsets of the plane are graphs? Reading the definition of a function (Sets and Functions, Definition 2.1.1) as a statement about vertical lines answers this.

Take D={1,2}. The set {(1,5),(2,5)} is a graph over D: above 1 and above 2 it has one point each. The set {(1,5),(1,6),(2,5)} is not, since it has two points above 1. Nor is {(1,5),(2,5),(3,5)}, since it has a point above 3, and 3∉D.

Proposition 8.1.1 (Vertical Line Test)

Let D⊆R and G⊆R2. Then G is the graph of a real function on D if and only if

  • (i) for every a∈D there is exactly one y∈R with (a,y)∈G, and
  • (ii) every (a,y)∈G has a∈D.

Proof. Let G=graphf for f:D→R. Then (i) is the condition in the definition of a function. And (ii) holds because every element of G is a pair (x,f(x)) with x∈D.

Conversely, (ii) gives G⊆D×R. With (i), the pair f:=(G,R) is then a function D→R. Each (a,y)∈G has y=f(a) by the definition of the value, and each (x,f(x)) with x∈D lies in G by the same definition, so G=graphf.

Uses: Sets and Functions, Definition 2.1.1 (one value for each input; the value f(a)).

In words: the vertical line through a meets G exactly once when a∈D, and not at all when a∉D.

Warning. No natural domain. The function x↦x2/x on R∖{0} is the restriction of the identity of R to R∖{0}; it is not the identity, because the domains differ. And not every curve is a graph: the circle {(x,y)∈R2:x2+y2=1} contains (0,1) and (0,−1). Every point must lie above D, by (ii), so 0∈D. But then there are two points above 0, and (i) fails at 0, whatever D is.

Quick check. Is each set a graph, and over which D? (1) {(x,y):y=x2}; (2) {(x,y):x=y2}; (3) {(x,y):y≥0, x=y2}.

Solution.

  1. Yes, over R. (2) No: (1,1) and (1,−1) both lie in it. Every point lies above D, by (ii), so 1∈D, and there are two points above 1, so (i) fails. (3) Yes, over [0,∞): every element has x=y2≥0, and for a≥0 the only y≥0 with y2=a is a. It is the graph of ⋅.

8.1.2. Combining real functions

Two real functions with different domains can still be added; the sum lives where both are defined. Composition needs more care, because g(f(x)) needs f(x) to be an input of g.

Here is a small case. Let f(x)=1/x on R∖{0} and g(x)=1/(x−1) on R∖{1}. Their sum 1/x+1/(x−1) makes sense where both do, on R∖{0,1}; at x=2 it is 12+1=32. The composite g(f(x))=1/(1/x−1) needs x≠0 and 1/x≠1, so it is defined on R∖{0,1} too. At x=2 it is 1/(12−1)=−2.

Definition 8.1.2 (Operations on Real Functions)

Let f:Df→R and g:Dg→R be real functions and c∈R. On Df∩Dg define, for each x, (f+g)(x):=f(x)+g(x),(fg)(x):=f(x)g(x), and max(f,g)(x):=max(f(x),g(x)), likewise min(f,g); here max(a,b) is b if a≤b and a otherwise, and min(a,b) is a if a≤b and b otherwise. On Df define (cf)(x):=cf(x), −f:=(−1)f and |f|(x):=|f(x)|; and f−g:=f+(−g) on Df∩Dg. The quotient f/g, x↦f(x)/g(x), has domain {x∈Df∩Dg:g(x)≠0}. The composite g∘f, x↦g(f(x)), has domain {x∈Df:f(x)∈Dg}.

For instance, |f|=max(f,−f) on Df. Fix x∈Df. If f(x)≥0, then −f(x)≤f(x), so max(f(x),−f(x))=f(x)=|f(x)|. If f(x)<0, then f(x)<−f(x), so the maximum is −f(x)=|f(x)|.

This composite is the composite of Sets and Functions (Sets and Functions, Definition 2.1.2), applied to a restriction of f. Write E for its domain. Every value of f|E lies in Dg, so f|E may be regarded as a function E→Dg, and g after it is a composite in that sense, with values g(f(x)). Composition stays associative. The functions h∘(g∘f) and (h∘g)∘f have the same domain and the same values h(g(f(x))), so they are equal. This is associativity of composition (Sets and Functions, Proposition 2.1.3) for the restricted maps.

Second readingThe two domains of a triple composite

Let h:Dh→R as well. The domain of h∘(g∘f) is the set of x in the domain of g∘f with g(f(x))∈Dh, that is, {x∈Df:f(x)∈Dg, g(f(x))∈Dh}. The domain of h∘g is {y∈Dg:g(y)∈Dh}, so the domain of (h∘g)∘f is the set of x∈Df with f(x) in it, which is the same set. On it both sides take the value h(g(f(x))), and Sets and Functions, Proposition 2.1.1 gives equality.

The domain of a composite can be empty. The square root after x↦−x2−1 has domain {x:−x2−1≥0}=∅, because x2≥0 gives −x2−1≤−1<0: the composite is the empty function of Sets and Functions, Proposition 2.1.2, legal and useless.

Quick check. What is the domain of x+1/x? Of the composite of ⋅ after x↦x−1?

Solution. [0,∞)∩(R∖{0})=(0,∞). The composite has domain {x∈R:x−1∈[0,∞)}=[1,∞).

8.1.3. Polynomial and rational functions

Chapter 6 defined, for a polynomial p∈R[x], its polynomial function c↦p(c) on R (Definition 6.4.1). In this chapter the letter x usually names a real number, so we write this function as x↦p(x); the polynomial x∈R[x] has the identity as its function.

For a first instance, the polynomial x2−1 restricted to D={0,1,2} has the values −1, 0, 3; and (x+1)/(x−1) is defined at every real number except 1, with value 3 at 2.

Definition 8.1.3 (Polynomial Function, Rational Function)

Let D⊆R. A polynomial function on D is the restriction to D of the polynomial function x↦p(x) of some p∈R[x]. For p,q∈R[x] with q≠0, the rational function p/q is x↦p(x)/q(x) on {x∈R:q(x)≠0}.

Chapters 6 and 7 proved what these functions need. Since R is a field, the following three facts hold here.

  • Operations match. The polynomial function of p+q is the sum of those of p and q, and likewise for pq. This is Proposition 6.4.4 (b), and restricting to D keeps it.
  • The function determines the polynomial on an infinite set. Let D be infinite, with p(x)=q(x) for every x∈D. Then p=q. To see this, put n:=max(deg⁡p,deg⁡q,0). An infinite set contains n+1 distinct points, as shown inside the proof of Theorem 7.4.2. Choosing n+1 distinct points of D, part (a) of that theorem gives p=q. So on an interval with more than one point, the degree and leading coefficient of a polynomial function are well defined.
  • Few roots. A non-zero q has at most deg⁡q roots (Theorem 7.4.1), so a rational function is defined at every real number except at most deg⁡q of them.

On a finite set the second fact fails: on D={0,1}, the polynomials x2 and x have the same function.

Quick check. Is |x| on [0,∞) a polynomial function? Are the rational function (x2−1)/(x−1) and the polynomial function x+1 on R the same function?

Solution. Yes: on [0,∞), |x|=x, so it is the restriction of the identity, the function of the polynomial x. No: their domains are R∖{1} and R, although they agree at every point of R∖{1}.

8.1.4. Moving a graph

Replacing f(x) by f(x−1) moves a graph; the question is which way. Guessing from the sign gets it wrong half the time. A graph is a set of pairs, so the safe way is to test membership of a pair.

Example (Method: reading a graph as a set of pairs)

How it goes. To prove that graphg is graphf moved by a bijection M:R2→R2, fix (x,y)∈R2 and prove (x,y)∈graphg⟺M−1(x,y)∈graphf, by unwinding “(x,y)∈graphg” into “x∈Dg and y=g(x)”. Since M is a bijection, the right side says exactly that (x,y)∈M(graphf).

When to use it. Shifts, reflections and stretches of graphs; symmetry of a graph; the graph of an inverse function in the next section.

Common mistakes. The usual mistake is to move the graph the wrong way. The formula for g contains M−1, while the picture moves by M.

For a set S⊆R2 and (a,b)∈R2, write S+(a,b):={(u+a,v+b):(u,v)∈S}; for D⊆R, write D+a:={u+a:u∈D}, and −D, cD as in Sets and Functions, Example (Reflections, scalings and sums as images).

A small case first. Let f(x)=x2 on D={0,1,2}, with graph {(0,0),(1,1),(2,4)}. The function x↦f(x−1)+2 has domain D+1={1,2,3}. Its values are f(0)+2=2, f(1)+2=3 and f(2)+2=6. So its graph is {(1,2),(2,3),(3,6)}, which is graphf+(1,2): the graph moved one to the right and two up.

Proposition 8.1.2 (Moving a Graph)

Let f:D→R, a,b∈R and c>0.

  • (a) The function x↦f(x−a)+b on D+a has graph graphf+(a,b).
  • (b) The function x↦f(−x) on −D has graph {(−u,v):(u,v)∈graphf}, the reflection in the y-axis.
  • (c) The function −f on D has graph {(u,−v):(u,v)∈graphf}, the reflection in the x-axis.
  • (d) The function cf on D has graph {(u,cv):(u,v)∈graphf}, and x↦f(x/c) on cD has graph {(cu,v):(u,v)∈graphf}.

Idea (Scratch work). We plan (a). Write g(x):=f(x−a)+b on D+a.

We know We want
f:D→R; g(x)=f(x−a)+b on D+a (x,y)∈graphg⟺(x−a,y−b)∈graphf
(x,y)∈graphg: x∈D+a, y=f(x−a)+b x−a∈D and y−b=f(x−a)

A naive guess first: “f(x−a) has a minus sign, so the graph moves left by a”. Test it at f=|⋅|, a=1, b=0. The vertex of |x−1| is where x−1=0, at x=1: the graph moved right. The table shows why. The move is M(u,v)=(u+a,v+b), and the formula evaluates f at the first coordinate of M−1(x,y)=(x−a,y−b). The only gap left is x∈D+a⟺x−a∈D, which holds by the definition of D+a.

Proof.

  • (a) Let g be the function in (a) and (x,y)∈R2. By the definition of D+a, x∈D+a if and only if x−a∈D. So (x,y)∈graphg if and only if x−a∈D and y−b=f(x−a), that is, (x−a,y−b)∈graphf. Two pairs are equal exactly when their coordinates are equal. So (x,y)=(u+a,v+b) holds exactly when (u,v)=(x−a,y−b), and the last condition says (x,y)∈graphf+(a,b). This proves (a).

  • (b) (x,y) is on the graph if and only if −x∈D and y=f(−x), that is, (−x,y)∈graphf.

  • (c) (x,y)∈graph(−f) if and only if x∈D and −y=f(x), that is, (x,−y)∈graphf.

  • (d) Since c≠0: (x,y)∈graph(cf) if and only if (x,y/c)∈graphf; and (x,y) is on the graph of x↦f(x/c) if and only if x/c∈D and y=f(x/c), that is, (x/c,y)∈graphf.

Uses: Sets and Functions, Definition 1.4.1 (equal pairs have equal coordinates).

The figure shows |x| (dashed) and |x−1|−2 on R: by (a) with a=1, b=−2, the vertex moves from (0,0) to (1,−2), and the zeros are at −1 and 3.

Diagram. Labels: x, y, (1,-2), -1, 3

Quick check. Which function on R has graph (graph|⋅|)+(−1,2)?

Solution. By (a) with a=−1 and b=2, it is x↦|x+1|+2 on R+(−1)=R. Its vertex is (−1,2).

8.1.5. Even and odd functions

Two symmetries of a graph are common enough to have names. A set D⊆R is symmetric if −x∈D for every x∈D; then −D=D.

For example, take D={−2,−1,0,1,2}. On −2,−1,0,1,2 the function x2 takes the values 4,1,0,1,4: the value at −x equals the value at x. The function x3 takes the values −8,−1,0,1,8: the value at −x is minus the value at x.

Definition 8.1.4 (Even and Odd Functions)

Let D⊆R be symmetric and f:D→R. Then f is even if f(−x)=f(x) for every x∈D, and odd if f(−x)=−f(x) for every x∈D.

By Proposition 8.1.2 (b), f is even exactly when its graph equals its reflection in the y-axis. Indeed, both f and x↦f(−x) have domain −D=D, so they are equal exactly when their graphs are.

The odd case uses the method of reading a graph as a set of pairs (Example (Method: reading a graph as a set of pairs)), with M(u,v)=(−u,−v), which is its own inverse. For (x,y)∈R2, the pair M(x,y)=(−x,−y) lies on the graph if and only if −x∈D and −y=f(−x). If f is odd, this says x∈D and y=f(x), so the graph is unchanged by M. Conversely, let the graph be unchanged by M. Then for x∈D the point (−x,−f(x)) lies on it, so f(−x)=−f(x).

Some examples:

  • x2, |x| and the constants on R are even;
  • x and x3 on R, and 1/x on R∖{0}, are odd;
  • x+1 on R is neither, since its value 0 at −1 is neither its value 2 at 1 nor −2;
  • the zero function is both.

An odd f with 0∈D has f(0)=−f(0), so f(0)=0.

Every function on a symmetric set splits into an even and an odd part, and only one way. For example, take f(x)=(x+1)2=x2+2x+1 on R. The terms x2 and 1 do not change when x is replaced by −x, and 2x changes sign. So f is the even function x2+1 plus the odd function 2x.

Proposition 8.1.3 (Even and Odd Parts)

Let D⊆R be symmetric and f:D→R. There is exactly one pair of functions e,o:D→R with e even, o odd and f=e+o, namely e(x)=f(x)+f(−x)2,o(x)=f(x)−f(−x)2.

Proof. Existence. Replacing x by −x swaps f(x) and f(−x), so e(−x)=e(x) and o(−x)=−o(x); and e(x)+o(x)=f(x).

Uniqueness. Let f=e+o=e′+o′ with e,e′ even and o,o′ odd, and put h:=e−e′=o′−o. As a difference of even functions h is even, and as a difference of odd functions it is odd. So h(x)=h(−x)=−h(x), hence 2h(x)=0. Since 2≠0, h(x)=0 for every x∈D. Thus e=e′ and o=o′.

For a polynomial function on R, the even part keeps the even powers, since (−x)k=xk for even k and −xk for odd k. For (x+1)2=x2+2x+1, the formulas give the even part x2+1 and the odd part 2x, as found above.

8.1.6. Exercises

A. Check your understanding

Exercise (A1)

Is each set a graph of a real function, and if so over which D?

  • (a) {(x,y)∈R2:x+y2=0}.
  • (b) {(x,y)∈R2:y=|x|}.
  • (c) {(x,y)∈R2:x=2}.
  • (d) {(x,y)∈R2:xy=1}.

Solution. We use Proposition 8.1.1. (a) No: (−1,1) and (−1,−1) lie in the set, so −1∈D by (ii). There are two points above −1, so (i) fails. (b) Yes, over R: it is graph|⋅|. (c) No: (2,0) and (2,1) lie in it, so 2∈D by (ii), and then there are two points above 2, so (i) fails, whatever D is. (d) Yes, over R∖{0}: no pair has first coordinate 0, since 0⋅y=0≠1, and for a≠0 the only y with ay=1 is 1/a. It is the graph of 1/x.

Exercise (A2: Is this legal? Is it useful?)

Let f(x)=x−1 on R and g(y)=1/y on R∖{0}.

  • (a) Find the domains of g∘f and f∘g. Are the two composites equal?
  • (b) Is the composite of g after the constant function 0 on R legal? Is it useful?

Solution.

  • (a) By Definition 8.1.2, g∘f has domain {x∈R:x−1≠0}=R∖{1} and f∘g has domain {y∈R∖{0}:1/y∈R}=R∖{0}. They are not equal: the domains differ, and the values differ too, since g(f(2))=1 while f(g(2))=−12.

  • (b) Legal: its domain is {x∈R:0∈R∖{0}}=∅, so it is the empty function (Sets and Functions, Proposition 2.1.2). It is useless: it has no values.

B. Practice

Exercise (B1)

Let f,g:D→R. Prove that max(f,g)=12(f+g+|f−g|) and min(f,g)=12(f+g−|f−g|).

Solution. Both sides have domain D; fix x∈D. If f(x)≥g(x), then |f(x)−g(x)|=f(x)−g(x) by Number Systems: From N to R, Definition 4.1.1, so the right sides are 12⋅2f(x)=f(x)=max(f(x),g(x)) and 12⋅2g(x)=g(x)=min(f(x),g(x)). If f(x)<g(x), then |f(x)−g(x)|=g(x)−f(x), and the right sides are g(x) and f(x), again the max and the min. The values agree at every x, so the functions are equal.

Exercise (B2)

Obtain the graph of x↦2|x−1|−3 on R from that of |⋅| by Proposition 8.1.2, and find its vertex and its zeros.

Solution. By (d) with c=2, 2|x| has graph {(u,2v)}: stretch vertically by 2. By (a) with a=1, b=−3, applied to 2|⋅|, the function 2|x−1|−3 has that graph moved right by 1 and down by 3. The vertex (0,0) goes to (0,0) and then to (1,−3). The zeros solve |x−1|=32, so x=−12 or x=52.

Exercise (B3)

Find the even and odd parts of f(x)=1/(1−x) on D=R∖{−1,1}. Why is −1 removed from D?

Solution. For x∈D, the formulas of Proposition 8.1.3 give e(x)=12(11−x+11+x)=12⋅21−x2=11−x2,o(x)=12(11−x−11+x)=12⋅2x1−x2=x1−x2. The formula 1/(1−x) makes sense at −1. But even and odd functions need a symmetric domain: with 1 removed, −1 must go too.

Uses: Definition 8.1.4 (symmetric domain).

Exercise (B4: Prove or disprove)

Prove each true statement and refute each false one with a counterexample.

  • (a) The product of two odd functions on a symmetric D is even.
  • (b) A function on a symmetric D that is both even and odd is the zero function.
  • (c) The composite of two odd functions R→R is odd.
  • (d) The sum of an even and an odd function on R is never even.

Solution.

  • (a) True: (fg)(−x)=(−f(x))(−g(x))=f(x)g(x).

  • (b) True: f(x)=f(−x)=−f(x), so 2f(x)=0, as in the uniqueness part of Proposition 8.1.3.

  • (c) True: f(g(−x))=f(−g(x))=−f(g(x)).

  • (d) False: x2 is even, the zero function is odd, and their sum x2 is even.

C. Going deeper

Exercise (C1: Additive functions, used later)

Let f:R→R satisfy f(x+y)=f(x)+f(y) for all x,y∈R, and let c:=f(1). Prove:

  • (a) f(0)=0, and f is odd;
  • (b) f(nx)=nf(x) for every n∈Z and x∈R;
  • (c) f(q)=cq for every q∈Q.

Solution (Hint 1). Choose x and y so that the equation speaks about f(0) alone.

Solution (Hint 2). For (c), write q=m/n with m∈Z, n∈Z>0, and compute nf(q) in two ways.

Solution.

  • (a) With x=y=0, f(0)=2f(0), so f(0)=0. With y=−x, f(x)+f(−x)=f(0)=0, so f(−x)=−f(x).

  • (b) For n∈N we use induction (Logic and Proof, Axiom 4.2.1). For n=0, f(0)=0=0⋅f(x) by (a). If f(nx)=nf(x), then f((n+1)x)=f(nx)+f(x)=(n+1)f(x). For n<0, −n∈N, and by (a), f(nx)=−f((−n)x)=−(−n)f(x)=nf(x).

  • (c) Let q=m/n with m∈Z and n∈Z>0. By (b), applied twice, nf(q)=f(nq)=f(m⋅1)=mf(1)=mc. Dividing by n≠0 gives f(q)=(m/n)c=cq.

What a complete answer needs. (10 points) - 2: obtains f(0)=0 and oddness from suitable substitutions. - 3: proves (b) for n≥0 by induction, with the step from the equation. - 2: extends (b) to negative n by oddness. - 3: computes nf(q) two ways and divides by n≠0. Slips that lose the step: using f(qx)=qf(x) for rational q before proving it; assuming f is a polynomial or monotone.