Class 12 Maths, Worked in Full Past papersGet updates
Chapter 1 · Relations and Functions

Miscellaneous · Q5: Are x2−xx^2-x and 2∣x−12∣−12\left|x-\tfrac12\right|-1 equal?

Miscellaneous ExerciseEqual functions · Miscellaneous Exercise
The question

Let A={−1,0,1,2}A = \{-1, 0, 1, 2\}⁠, B={−4,−2,0,2}B = \{-4, -2, 0, 2\} and f,g:A→Bf, g : A \to B be functions defined by f(x)=x2−xf(x) = x^2 - x⁠, x∈Ax \in A and

g(x)=2∣x−12∣−1,x∈A.g(x) = 2\left|x - \frac12\right| - 1, \qquad x \in A.

Are ff and gg equal? Justify your answer. (Hint: One may note that two functions f:A→Bf : A \to B and g:A→Bg : A \to B such that f(a)=g(a)f(a) = g(a) ∀ a∈A\forall\, a \in A⁠, are called equal functions).

Exam answer

Both ff and gg have domain AA and codomain BB⁠.

f(−1)=(−1)2−(−1)=2f(0)=0−0=0f(1)=1−1=0f(2)=4−2=2\begin{aligned} f(-1) &= (-1)^2 - (-1) = 2 \\ f(0) &= 0 - 0 = 0 \\ f(1) &= 1 - 1 = 0 \\ f(2) &= 4 - 2 = 2 \end{aligned} g(−1)=2∣−32∣−1=2g(0)=2∣−12∣−1=0g(1)=2∣12∣−1=0g(2)=2∣32∣−1=2\begin{aligned} g(-1) &= 2\left|-\tfrac32\right| - 1 = 2 \\ g(0) &= 2\left|-\tfrac12\right| - 1 = 0 \\ g(1) &= 2\left|\tfrac12\right| - 1 = 0 \\ g(2) &= 2\left|\tfrac32\right| - 1 = 2 \end{aligned}

So f(a)=g(a)f(a) = g(a) for every a∈Aa \in A⁠.

Yes, ff and gg are equal.

Want the reason behind every step, the basics and the checks?

The one idea this problem is built on

A function is not its formula: it is the assignment of outputs to the inputs in its domain. Two functions with the same domain and codomain are equal when they give the same output at every input, however differently their formulas look. The domain here has only four elements, so the question is settled by computing four values of each function and comparing them.

Given, to find, and the plan
Given
Domain A={−1,0,1,2}A = \{-1, 0, 1, 2\}⁠, codomain B={−4,−2,0,2}B = \{-4, -2, 0, 2\}⁠, f(x)=x2−xf(x) = x^2 - x and g(x)=2∣x−12∣−1g(x) = 2\left|x - \frac12\right| - 1⁠.
To find
Whether f(a)=g(a)f(a) = g(a) for every a∈Aa \in A⁠.
Plan
(1) State exactly what "equal functions" requires. (2) Compute ff at each of the four points. (3) Compute gg at each point, handling the absolute value carefully. (4) Compare all four. (5) Look beyond AA to see why the answer depends on the domain.

Basics you need

1Equal functions

f:A→Bf : A \to B and g:A→Bg : A \to B are equal when f(a)=g(a)f(a) = g(a) for every a∈Aa \in A (the hint in the question). Only the values on the domain matter, not the shape of the formulas. Basics: what a function is

2Absolute value

∣t∣=t|t| = t if t≥0t \ge 0 and ∣t∣=−t|t| = -t if t<0t < 0⁠. So ∣t∣|t| is the distance of tt from 0, and ∣x−12∣\left|x - \frac12\right| is the distance of xx from 12\frac12⁠. For example ∣−32∣=32\left|-\frac32\right| = \frac32⁠.

3Order of operations

In 2∣x−12∣−12\left|x - \frac12\right| - 1⁠: first the subtraction inside the bars, then the absolute value, then multiply by 2, and subtract 1 last. In x2−xx^2 - x⁠: square first, then subtract.

4"For all" on a finite set

When the domain is finite, "for every a∈Aa \in A" can be proved by checking each element. That is a complete proof, not just an example, because nothing else is in AA⁠. Basics: proving and disproving

Solution

  1. What we must check

    ff and gg have the same domain AA and the same codomain BB⁠. By the hint, they are equal exactly when

    f(−1)=g(−1),f(0)=g(0),f(1)=g(1),f(2)=g(2).\begin{aligned} f(-1) &= g(-1), & f(0) &= g(0),\\ f(1) &= g(1), & f(2) &= g(2). \end{aligned}

    If even one of these failed, ff and gg would not be equal.

    "Equal functions" is a "for all a∈Aa \in A" statement. Because AA has exactly four elements, four comparisons cover every case (Basic 4).
    A function A→BA \to B is determined by its value at each element of AA⁠. Basics: what a function is
  2. Compute f(x)=x2−xf(x) = x^2 - x on AA

    f(−1)=(−1)2−(−1)=1+1=2,f(0)=02−0=0,f(1)=12−1=0,f(2)=22−2=4−2=2.\begin{aligned} f(-1) &= (-1)^2 - (-1) = 1 + 1 = 2,\\ f(0) &= 0^2 - 0 = 0,\\ f(1) &= 1^2 - 1 = 0,\\ f(2) &= 2^2 - 2 = 4 - 2 = 2. \end{aligned}
    Substitute each element of AA in turn. Brackets around −1-1 matter: (−1)2=1(-1)^2 = 1⁠, and subtracting −1-1 means adding 1. All four values, 2, 0, 0, 2, lie in BB⁠, so ff really is a function from AA to BB⁠.
    (−a)2=a2(-a)^2 = a^2 and −(−a)=a-(-a) = a⁠.
  3. Compute g(x)=2∣x−12∣−1g(x) = 2\left|x - \frac12\right| - 1 on AA

    First the distances from 12\frac12⁠:

    ∣−1−12∣=∣−32∣=32,∣0−12∣=∣−12∣=12,∣1−12∣=12,∣2−12∣=32.\begin{aligned} \left|-1 - \tfrac12\right| &= \left|-\tfrac32\right| = \tfrac32,\\ \left|0 - \tfrac12\right| &= \left|-\tfrac12\right| = \tfrac12,\\ \left|1 - \tfrac12\right| &= \tfrac12,\\ \left|2 - \tfrac12\right| &= \tfrac32. \end{aligned}

    Then double and subtract 1:

    g(−1)=2⋅32−1=3−1=2,g(0)=2⋅12−1=1−1=0,g(1)=2⋅12−1=1−1=0,g(2)=2⋅32−1=3−1=2.\begin{aligned} g(-1) &= 2\cdot\tfrac32 - 1 = 3 - 1 = 2,\\ g(0) &= 2\cdot\tfrac12 - 1 = 1 - 1 = 0,\\ g(1) &= 2\cdot\tfrac12 - 1 = 1 - 1 = 0,\\ g(2) &= 2\cdot\tfrac32 - 1 = 3 - 1 = 2. \end{aligned}
    Working out the absolute values first, separately, avoids the usual slip of dropping the bars and getting 2(−32)−1=−42(-\frac32) - 1 = -4 for g(−1)g(-1)⁠. The four values 2, 0, 0, 2 again lie in BB⁠, so gg is also a genuine function from AA to BB⁠.
    ∣t∣=−t|t| = -t when t<0t < 0⁠, so ∣−32∣=32\left|-\frac32\right| = \frac32 and ∣−12∣=12\left|-\frac12\right| = \frac12 (Basic 2).
  4. Compare, value by value

    aa−1-1001122
    f(a)=a2−af(a) = a^2 - a2002
    ∣a−12∣\left|a - \frac12\right|32\frac3212\frac1212\frac1232\frac32
    g(a)g(a)2002
    equal?yesyesyesyes

    f(a)=g(a)f(a) = g(a) for every a∈Aa \in A⁠. Since ff and gg also share the domain AA and codomain BB⁠, f=gf = g.

    All four required equalities from Step 1 hold, and AA has no other elements, so the definition of equal functions is satisfied completely.
    Equal functions: same domain, same codomain, same value at every point (Basic 1).
  5. Why the answer depends on the domain

    The two formulas are not the same on the whole real line. At x=12x = \frac12 (not in AA⁠), x2−x=−14x^2 - x = -\frac14 but 2∣x−12∣−1=−12\left|x-\frac12\right| - 1 = -1⁠. So where do the formulas agree? Solve x2−x=2∣x−12∣−1x^2 - x = 2\left|x - \frac12\right| - 1 over R\R⁠, splitting on the sign inside the bars:

    If x≥12x \ge \frac12⁠: ∣x−12∣=x−12\left|x-\frac12\right| = x - \frac12⁠, so the right side is 2x−22x - 2⁠, and

    x2−x=2x−2  ⟺   x2−3x+2=0  ⟺   (x−1)(x−2)=0  ⟺   x=1 or x=2.\begin{aligned} & x^2 - x = 2x - 2\\ \iff\ & x^2 - 3x + 2 = 0\\ \iff\ & (x-1)(x-2) = 0\\ \iff\ & x = 1 \text{ or } x = 2. \end{aligned}

    If x<12x < \frac12⁠: ∣x−12∣=12−x\left|x-\frac12\right| = \frac12 - x⁠, so the right side is −2x-2x⁠, and

    x2−x=−2x  ⟺   x2+x=0  ⟺   x(x+1)=0  ⟺   x=0 or x=−1.\begin{aligned} & x^2 - x = -2x\\ \iff\ & x^2 + x = 0\\ \iff\ & x(x+1) = 0\\ \iff\ & x = 0 \text{ or } x = -1. \end{aligned}

    All four roots lie in the case they were found in (1,2≥121, 2 \ge \frac12 and 0,−1<120, -1 < \frac12⁠). So the formulas agree at exactly the four real numbers −1,0,1,2-1, 0, 1, 2⁠, which is precisely the set AA⁠.

    −1012−1123x at x = 1/2: f gives −1/4, g gives −1 (−1, 2)(2, 2)(0, 0)(1, 0) blue: y = x² − xgold, dashed: y = 2|x − 1/2| − 1green: where f and g agree
    The parabola y=x2−xy = x^2 - x (blue) and the V-shaped graph y=2∣x−12∣−1y = 2\left|x - \frac12\right| - 1 (gold, dashed) over −1.5≤x≤2.5-1.5 \le x \le 2.5⁠. They cross at exactly four points, x=−1,0,1,2x = -1, 0, 1, 2⁠, the elements of AA⁠. Between those points they differ (at x=12x = \frac12⁠, by 34\frac34⁠). Restricted to AA⁠, only the four green points count, and there the two functions coincide.
    This explains the question: AA was chosen as exactly the set where the formulas agree. If the domain were R\R⁠, or even {−1,0,12,1,2}\{-1, 0, \frac12, 1, 2\} (with a codomain such as R\R large enough to hold the new values), the functions would not be equal. Equality of functions is always relative to the domain.
    Absolute value split: ∣t∣=t|t| = t for t≥0t \ge 0 and −t-t for t<0t < 0⁠; a product is zero exactly when a factor is zero.
Result

Yes, ff and gg are equal. Both have domain AA and codomain BB⁠, and f(−1)=g(−1)=2f(-1) = g(-1) = 2⁠, f(0)=g(0)=0f(0) = g(0) = 0⁠, f(1)=g(1)=0f(1) = g(1) = 0⁠, f(2)=g(2)=2f(2) = g(2) = 2⁠, so f(a)=g(a)f(a) = g(a) for every a∈Aa \in A⁠. (Textbook answer: Yes.) The formulas themselves differ on R\R⁠; they agree exactly on {−1,0,1,2}=A\{-1, 0, 1, 2\} = A⁠.

Check it with numbers

Off the domain the two formulas really do differ: at x=3x = 3⁠, x2−x=6x^2 - x = 6 but 2∣3−12∣−1=2⋅52−1=42\left|3 - \frac12\right| - 1 = 2\cdot\frac52 - 1 = 4⁠. And at x=12x = \frac12 the values are −14-\frac14 and −1-1⁠. The site's verification script recomputes all eight values on AA exactly with fractions, confirms they lie in BB⁠, and solves x2−x=2∣x−12∣−1x^2 - x = 2|x - \frac12| - 1 over R\R with a computer algebra system, getting exactly {−1,0,1,2}\{-1, 0, 1, 2\}⁠.

Common mistakes
  1. Comparing formulas instead of values. x2−xx^2 - x and 2∣x−12∣−12|x - \frac12| - 1 are different expressions, but that does not make the functions on AA different.
  2. Dropping the absolute value bars, for example g(−1)=2(−32)−1=−4g(-1) = 2(-\frac32) - 1 = -4⁠. That value happens to be in BB⁠, so the error is not caught by the codomain; it must be avoided by evaluating ∣⋅∣|\cdot| first.
  3. Checking only some points. All four elements of AA must be checked.
  4. Claiming the functions are equal on R\R⁠. They are equal only as functions on AA⁠.
What to take away
  1. A function is its domain, its codomain and its values; two different formulas can define the same function.
  2. On a finite domain, checking every element is a complete proof.
  3. Equality of functions depends on the domain: change the domain and the answer can change.

Every fact used, and where it comes from

FactUsed inSource
Equal functions: f(a)=g(a) ∀a∈Af(a) = g(a)\ \forall a \in ASteps 1, 4Hint in Miscellaneous Exercise Q5 (Lesson: types of functions)
A function, its domain and codomainSteps 1–4Class XI, Relations and Functions; Section 1.3 (Basics: what a function is)
Absolute value: ∣t∣=t|t| = t for t≥0t \ge 0⁠, −t-t for t<0t < 0Steps 3, 5Definition of absolute value (modulus function, Class XI)
x2−3x+2=(x−1)(x−2)x^2 - 3x + 2 = (x-1)(x-2)⁠, x2+x=x(x+1)x^2 + x = x(x+1)Step 5Factorisation
All values, and the solution set {−1,0,1,2}\{-1,0,1,2\} over R\RSteps 2–5, CheckRecomputed exactly (fractions, sympy) in the site's verification script
Found an error, or want more?

Tell us if something on this page is wrong or unclear, or if you would like a fuller explanation, another method or a new feature. Send feedback on this problem →