Chapter II · Functions of real variables

The idea of a function

§20 25 min

What it means for yy to be a function of xx, and which familiar features of functions are not part of the idea at all.

Why this matters

Chapter I built the real numbers. Chapter II asks what it means for one real quantity to depend on another. Hardy calls functional dependence perhaps the most important notion in higher mathematics, and every later chapter (limits of functions, continuity, derivatives, integrals) is about functions. The point of §20 is to strip the idea down to its essentials, so that you do not mistake the features of your favourite examples for part of the definition.

The idea

Picture two number lines. A point PP moves on the first, at distance xx from a fixed origin; a point QQ moves on the second, at distance yy. Suppose that the position of PP settles the position of QQ: once you know xx, you know yy. Then yy is a function of xx.

The functions you met at school, such as y=2xy = 2x or y=x2+1y = x^2 + 1, have three features in common:

  1. yy is given for every value of xx. You can square any real number.
  2. Each xx gives one and only one yy.
  3. There is a formula: substitute the value of xx and calculate.

Hardy’s observation is that none of these is essential. All that matters is that there is a rule connecting xx and yy under which at least some values of xx have values of yy attached. A rule may leave many xx without a value, may attach several values of yy to one xx, and may have no formula at all.

Explore Probe some rules

Try this. Choose a rule, then probe it at each offered value of xx and read how many values of yy the rule gives there. Then answer Hardy’s three questions and press Check. Start with y2=xy^2 = x, then try the largest prime factor and the denominator of xx.

y=x2+1y = x^2 + 1Hardy: Examples X, 1
xy
  • graph of the rule
  • values at the chosen x
Probe at x =
At x = ½ the rule gives one value, y = 1.25.
Which of Hardy's characteristics does this rule have?
(1) a value for every x?
(2) only one value for each x?
(3) given by a formula?
What to notice

Probing at single values is exactly how (1) and (2) are decided: (1) fails as soon as one xx gets no value, and (2) fails as soon as one xx gets two. The rule y2=xy^2 = x fails both, yet it plainly connects xx and yy. The prime-factor rule only works for positive integers, and the denominator rule only for rational numbers, and neither has a formula. All of them are functions in Hardy’s sense.

The gallery collects Hardy’s Examples X and a few later ones. Two of them come from physics. A gas in a cylinder obeys Boyle’s law pv=apv = a at moderate pressures and van der Waals’ law

(p+αv2)(v−β)=γ\Bigl(p + \frac{\alpha}{v^2}\Bigr)(v - \beta) = \gamma

at high pressures. Nothing stops us from declaring that the first law holds exactly for v≥Vv \ge V and the second for v<Vv < V. That defines pp as a function of vv by two formulas on two ranges, and only for positive vv, since a negative volume means nothing. The bouncing ball is similar: its depth below its starting point is h=12g(2nτ−t)2h = \tfrac12 g(2n\tau - t)^2 when (2n−1)τ≤t≤(2n+1)τ(2n-1)\tau \le t \le (2n+1)\tau, a different formula for each bounce.

Precise statements

Definition Function Hardy: §20

Let xx and yy be real variables. We say that yy is a function of xx if there is a relation between them such that to some values of xx, at any rate, there correspond one or more values of yy.

The function is one-valued (single-valued) at xx if exactly one yy corresponds to xx, and many-valued there if several do. The set of xx for which some yy corresponds is where the function is defined.

Hardy’s three characteristics can now be stated as properties that a particular function may or may not have: (1) it is defined for every real xx; (2) it is one-valued wherever it is defined; (3) it is given by an analytical formula. Characteristics (1) and (2) are precise. Characteristic (3) is not: “formula” is never defined, and the gallery shows rules such as [x][x] where the answer depends on what you are willing to call a formula. That vagueness is one more reason Hardy refuses to build it into the definition.

Two everyday words get precise meanings here.

  • A constant is a function that attaches the same yy to every xx, such as y=0y = 0 or y=2y = \sqrt2 (Examples X, 2). It is a function even though yy does not “vary”.
  • When the rule is one-valued, we write y=f(x)y = f(x) and call xx the independent and yy the dependent variable (this is the start of §21).

Proofs

There is no theorem in §20, but one fact is used constantly in the rest of the chapter: you can see whether a rule is one-valued by looking at its graph. (Graphs are made official in §21: the graph is the set of all points (x,y)(x, y) with yy a value attached to xx.)

Theorem The vertical line test

A rule is one-valued wherever it is defined if and only if every vertical line x=ax = a meets its graph in at most one point. It is defined at aa exactly when the line x=ax = a meets the graph at all.

Proof The vertical line test
Strategy

Translate “values of yy attached to x=ax = a” into “points of the graph on the line x=ax = a”. The two statements are then the same statement in different words.

Points on the line x=ax = a are values at aa

A point (a,b)(a, b) lies on the graph exactly when bb is one of the values the rule attaches to aa. So the points of the graph on the line x=ax = a are the points (a,b)(a, b), one for each value bb at aa, and different values give different points.

Count them

The number of points where the line x=ax = a meets the graph therefore equals the number of values of yy at x=ax = a: none, one, or several.

Read off both claims

“At most one point on every vertical line” says “at most one value at every aa”, which is one-valuedness. “At least one point on the line x=ax = a” says “some value at aa”, which is being defined at aa.

The dashed probe line in the gallery is this test in action. For y2=xy^2 = x the line x=4x = 4 meets the graph twice, at (4,2)(4, 2) and (4,−2)(4, -2); the line x=−1x = -1 misses it.

Worked examples and exercises

Exercise ●○○ Hardy: Examples X, 3

Describe exactly for which xx the relation y2=xy^2 = x gives no value, one value, and two values of yy, and decide which of Hardy’s characteristics it has.

Hint
A square is never negative. Which number is its own negative?

Solution

If x<0x < 0, no real yy has y2=x<0y^2 = x < 0, so there is no value. If x=0x = 0, then y2=0y^2 = 0 forces y=0y = 0: one value. If x>0x > 0, both y=xy = \sqrt{x} and y=−xy = -\sqrt{x} work, and they are different, while any yy with y2=xy^2 = x must be one of them (since y2−x=(y−x)(y+x)y^2 - x = (y - \sqrt x)(y + \sqrt x)). So there are exactly two values. The function lacks (1) and (2), but it is given by a formula, so it has (3).

Exercise Joining two gas laws ●○○ Hardy: Examples X, 4

Suppose Boyle’s law pv=apv = a holds for v≥Vv \ge V and van der Waals’ law (p+α/v2)(v−β)=γ(p + \alpha/v^2)(v - \beta) = \gamma for v<Vv < V, where V>βV > \beta. What must γ\gamma be if the two laws are to give the same pressure at v=Vv = V? Check that the gallery’s numbers (a=1a = 1, V=1V = 1, α=β=0.2\alpha = \beta = 0.2, γ=0.96\gamma = 0.96) satisfy your condition.

Hint
Boyle gives p=a/Vp = a/V at v=Vv = V. Put that pressure into van der Waals’ law.

Solution

At v=Vv = V Boyle’s law gives p=a/Vp = a/V. Van der Waals’ law gives the same pressure exactly when (a/V+α/V2)(V−β)=γ(a/V + \alpha/V^2)(V - \beta) = \gamma. With the gallery’s numbers, (1+0.2)(1−0.2)=1.2×0.8=0.96(1 + 0.2)(1 - 0.2) = 1.2 \times 0.8 = 0.96. Note that the function is perfectly well defined whether or not this condition holds; without it, the pressure simply jumps at v=Vv = V. A function need not be “smooth” either.

Exercise ●●○ Hardy: Examples X, 5

A perfectly elastic ball is dropped from rest and falls a height 12gτ2\tfrac12 g\tau^2 to a horizontal floor, rebounding forever. Let hh be its depth below the starting point at time tt. Show that h=12g(2nτ−t)2h = \tfrac12 g(2n\tau - t)^2 when (2n−1)τ≤t≤(2n+1)τ(2n-1)\tau \le t \le (2n+1)\tau, for n=0,1,2,…n = 0, 1, 2, \dots (with t≥0t \ge 0).

Hint
The first fall is h=12gt2h = \tfrac12 g t^2 and takes time τ\tau. A perfectly elastic bounce sends the ball back up with the same speed, so the rise is the fall played backwards.
Hint
The motion repeats with period 2τ2\tau, and the top of the nnth bounce is at t=2nτt = 2n\tau.

Solution

For 0≤t≤τ0 \le t \le \tau the ball falls freely from rest: h=12gt2h = \tfrac12 gt^2, which is the formula with n=0n = 0. It reaches the floor (depth 12gτ2\tfrac12 g\tau^2) at t=τt = \tau with speed gτg\tau. A perfectly elastic bounce sends it up with speed gτg\tau, so the rise is the fall run backwards: it is back at the start, momentarily at rest, at t=2τt = 2\tau, and then falls again, reaching the floor at t=3τt = 3\tau. Between t=τt = \tau and t=3τt = 3\tau the ball is therefore at depth 12gs2\tfrac12 g s^2, where s=∣t−2τ∣s = |t - 2\tau| is the time since (or until) it was at the top. That is h=12g(2τ−t)2h = \tfrac12 g(2\tau - t)^2, the formula with n=1n = 1. The motion repeats every 2τ2\tau, with tops at t=2nτt = 2n\tau, so in general h=12g(2nτ−t)2h = \tfrac12 g(2n\tau - t)^2 on [(2n−1)τ,(2n+1)τ][(2n-1)\tau, (2n+1)\tau]. At a join t=(2n+1)τt = (2n + 1)\tau both neighbouring formulas give 12gτ2\tfrac12 g\tau^2, so they agree. The function is defined only for t≥0t \ge 0 and needs a different formula on each interval.

Exercise ●○○ Hardy: Examples X, 6–7

Let f(x)f(x) be the largest prime factor of xx and g(x)g(x) the denominator of xx in lowest terms. Find f(91)f(91), f(64)f(64), g(−22/14)g(-22/14) and g(0.375)g(0.375). Why is g(2)g(\sqrt 2) meaningless?

Hint
Reduce fractions to lowest terms before reading off the denominator. A terminating decimal is a fraction with denominator a power of 1010.

Solution

91=7⋅1391 = 7 \cdot 13, so f(91)=13f(91) = 13. 64=2664 = 2^6, so f(64)=2f(64) = 2. −22/14=−11/7-22/14 = -11/7 in lowest terms, so g(−22/14)=7g(-22/14) = 7 (not 1414: the rule is about the number, not the way it is written). 0.375=375/1000=3/80.375 = 375/1000 = 3/8, so g(0.375)=8g(0.375) = 8. Finally 2\sqrt2 is irrational (Chapter I), so it is not p/qp/q for any integers, and “its denominator” refers to nothing.

Check yourself

Check yourself True or false?

In Hardy’s sense, y2=xy^2 = x defines yy as a function of xx.

Why

True. Hardy only asks that some values of xx have one or more values of yy. Most modern books would instead say that y2=xy^2 = x defines two functions, x\sqrt{x} and −x-\sqrt{x}, on x≥0x \ge 0; see the note on Hardy’s language below.

Check yourself Choose one

Which characteristic does “the largest prime factor of xx” have?

Why

It is defined only for positive integers, so (1) fails; there is no formula, so (3) fails; but each integer has exactly one largest prime factor, so (2) holds. And even a rule with none of the three properties would still be a function, as long as some xx has a value.

Check yourself Enter a number

Let yy be the denominator of xx in lowest terms (with a positive denominator). What is yy when x=42/(−12)x = 42/(-12)?

Why

42/(−12)=−7/242/(-12) = -7/2, so y=2y = 2. The answer 1212 reads the denominator off the way the number happens to be written; the rule is about the number itself, which is why Hardy insists on lowest terms.

Check yourself True or false?

A function must be given by a formula; otherwise we cannot know its values.

Why

False. The largest prime factor and the denominator of xx have no formula, yet their values are perfectly definite. Hardy’s definition asks for a relation, not a formula.

Hardy’s language

All that is essential is that there should be some relation between x and y such that to some values of x at any rate correspond values of y.

— G. H. Hardy, §20

Summary

Summary
  • yy is a function of xx when a rule attaches values of yy to (some) values of xx.
  • Being defined for all xx, being one-valued and having a formula are features of familiar examples, not of the definition.
  • A rule is one-valued exactly when every vertical line meets its graph at most once, and it is defined at aa exactly when the line x=ax = a meets the graph.
  • Modern usage keeps one-valuedness and a stated domain; Hardy’s many-valued functions are split into branches.