Composition of Functions

RS Aggarwal Class 12 Maths Solutions Exercise 2B — Functions

RS Aggarwal, Class 12 Mathematics — Functions, Exercise 2B. All 12 questions solved.

Independent solutions by Shiwam’s Classes. Not affiliated with or endorsed by the author or publisher of the book.

Exercise 2B is about composition. Questions 1 and 2 compose functions given as sets of ordered pairs, so you simply follow each input through two arrows. Questions 3 to 8, 10 and 12 compose functions given by formulae. Questions 9 and 11 ask you to build an inverse-like function and to evaluate a composite at given points.

Key insight. $(g\circ f)(x) = g(f(x))$: apply $f$ first, then $g$. Compose from the inside out, and never assume $g\circ f = f\circ g$; the order matters.

Question 1

Take $A = \{1,2,3,4\}$ and two maps $f, g: A \to A$ given by $f = \{(1,4),(2,1),(3,3),(4,2)\}$ and $g = \{(1,3),(2,1),(3,2),(4,4)\}$. Find (i) $g\circ f$, (ii) $f\circ g$, (iii) $f\circ f$.

Solution. For each input, follow it through the first map and then the second.

(i) $g\circ f$: $1\xrightarrow{f}4\xrightarrow{g}4$, $2\xrightarrow{f}1\xrightarrow{g}3$, $3\xrightarrow{f}3\xrightarrow{g}2$, $4\xrightarrow{f}2\xrightarrow{g}1$.

(ii) $f\circ g$: $1\xrightarrow{g}3\xrightarrow{f}3$, $2\xrightarrow{g}1\xrightarrow{f}4$, $3\xrightarrow{g}2\xrightarrow{f}1$, $4\xrightarrow{g}4\xrightarrow{f}2$.

(iii) $f\circ f$: $1\to4\to2$, $2\to1\to4$, $3\to3\to3$, $4\to2\to1$.

(i) $g\circ f = \{(1,4),(2,3),(3,2),(4,1)\}$; (ii) $f\circ g = \{(1,3),(2,4),(3,1),(4,2)\}$; (iii) $f\circ f = \{(1,2),(2,4),(3,3),(4,1)\}$.

Question 2

Let $f:\{3,9,12\}\to\{1,3,4\}$ be $f=\{(3,1),(9,3),(12,4)\}$ and $g:\{1,3,4,5\}\to\{3,9\}$ be $g=\{(1,3),(3,3),(4,9),(5,9)\}$. Find (i) $g\circ f$ and (ii) $f\circ g$.

Solution. (i) The range of $f$ lies inside the domain of $g$, so $g\circ f$ is defined on $\{3,9,12\}$: $3\to1\to3$, $9\to3\to3$, $12\to4\to9$.

(ii) The range of $g$ is $\{3,9\}$, which lies inside the domain $\{3,9,12\}$ of $f$, so $f\circ g$ is defined on $\{1,3,4,5\}$: $1\to3\to1$, $3\to3\to1$, $4\to9\to3$, $5\to9\to3$.

(i) $g\circ f=\{(3,3),(9,3),(12,9)\}$; (ii) $f\circ g=\{(1,1),(3,1),(4,3),(5,3)\}$.

Question 3

Take $f(x)=x^2$ and $g(x)=x+1$, both from $\mathbb{R}$ to $\mathbb{R}$. Show that $g\circ f$ and $f\circ g$ are not the same function.

Solution. Compose each way:

$$(g\circ f)(x)=g(x^2)=x^2+1,\qquad (f\circ g)(x)=f(x+1)=(x+1)^2.$$

These differ at once: at $x=1$ the first gives $2$ and the second gives $4$. Since they disagree at one point, the functions are not equal.

$(g\circ f)(x)=x^2+1\ne (x+1)^2=(f\circ g)(x)$, e.g. at $x=1$: $2\ne4$.

Question 4

For $f(x)=2x+1$ and $g(x)=x^2-2$ on $\mathbb{R}$, write the formulae for (i) $g\circ f$, (ii) $f\circ g$, (iii) $f\circ f$, (iv) $g\circ g$.

Solution. Substitute the inner function into the outer one and expand.

(i) $(g\circ f)(x)=(2x+1)^2-2=4x^2+4x+1-2=4x^2+4x-1$.

(ii) $(f\circ g)(x)=2(x^2-2)+1=2x^2-3$.

(iii) $(f\circ f)(x)=2(2x+1)+1=4x+3$.

(iv) $(g\circ g)(x)=(x^2-2)^2-2=x^4-4x^2+4-2=x^4-4x^2+2$.

(i) $4x^2+4x-1$; (ii) $2x^2-3$; (iii) $4x+3$; (iv) $x^4-4x^2+2$.

Question 5

For $f(x)=x^2+3x+1$ and $g(x)=2x-3$ on $\mathbb{R}$, write the formulae for (i) $g\circ f$, (ii) $f\circ g$, (iii) $g\circ g$.

Solution.

(i) $(g\circ f)(x)=2(x^2+3x+1)-3=2x^2+6x-1$.

(ii) $(f\circ g)(x)=(2x-3)^2+3(2x-3)+1=4x^2-12x+9+6x-9+1=4x^2-6x+1$.

(iii) $(g\circ g)(x)=2(2x-3)-3=4x-9$.

(i) $2x^2+6x-1$; (ii) $4x^2-6x+1$; (iii) $4x-9$.

Question 6

Let $f:\mathbb{R}\to\mathbb{R}$ be $f(x)=|x|$. Prove that $f\circ f=f$.

Solution. We need $(f\circ f)(x)=\big||x|\big|=|x|$ for every real $x$. The number $|x|$ is never negative, and the modulus of a non-negative number is the number itself. Explicitly: if $x\ge0$ then $|x|=x$ and $\big||x|\big|=|x|$; if $x<0$ then $|x|=-x>0$ and $\big||x|\big|=-x=|x|$. In both cases $(f\circ f)(x)=f(x)$, and both functions have the same domain $\mathbb{R}$.

$(f\circ f)(x)=\big||x|\big|=|x|=f(x)$ for all $x$, so $f\circ f=f$.

Question 7

Let $f(x)=x^2$, $g(x)=\tan x$ and $h(x)=\log x$. Find a formula for $h\circ(g\circ f)$ and show that $[h\circ(g\circ f)]\!\left(\sqrt{\tfrac{\pi}{4}}\right)=0$.

Solution. First $(g\circ f)(x)=g(x^2)=\tan x^2$. Then

$$[h\circ(g\circ f)](x)=h(\tan x^2)=\log(\tan x^2),$$

which makes sense where $\tan x^2>0$. At $x=\sqrt{\pi/4}$ we have $x^2=\pi/4$, so

$$\log\big(\tan\tfrac{\pi}{4}\big)=\log 1=0.$$

$[h\circ(g\circ f)](x)=\log(\tan x^2)$, and its value at $\sqrt{\pi/4}$ is $\log1=0$.

Question 8

Let $f(x)=2x-3$ and $g(x)=\tfrac12(x+3)$ on $\mathbb{R}$. Show that $f\circ g=I_{\mathbb{R}}=g\circ f$.

Solution. Compute both composites.

$$(f\circ g)(x)=2\cdot\tfrac12(x+3)-3=x+3-3=x,$$

$$(g\circ f)(x)=\tfrac12\big((2x-3)+3\big)=\tfrac12(2x)=x.$$

Each sends every $x$ to itself, which is exactly the identity map $I_{\mathbb{R}}$ (so $f$ and $g$ are inverses of each other).

$(f\circ g)(x)=x=(g\circ f)(x)$ for all real $x$, so $f\circ g=I_{\mathbb{R}}=g\circ f$.

Question 9

Let $f:\mathbb{Z}\to\mathbb{Z}$ be $f(x)=2x$. Find a function $g:\mathbb{Z}\to\mathbb{Z}$ with $g\circ f=I_{\mathbb{Z}}$.

Solution. We need $g(f(x))=x$, that is $g(2x)=x$ for every integer $x$. Every even integer $y$ has the form $2x$, so $g(y)=\tfrac y2$ there, and that is an integer. Odd integers are never values of $f$, so the condition says nothing about them; but $g$ must still send them to integers, so we may give them any integer value, for example $0$. One valid choice is

$$g(y)=\begin{cases}\dfrac y2,& y\text{ even},\\[2mm] 0,& y\text{ odd}.\end{cases}$$

Check: $g(f(x))=g(2x)=\tfrac{2x}{2}=x$.

$g(y)=\dfrac y2$ for even $y$ (and, say, $g(y)=0$ for odd $y$), which gives $g\circ f=I_{\mathbb{Z}}$.

Question 10

Let $f,g,h:\mathbb{N}\to\mathbb{N}$ be $f(x)=2x$, $g(y)=3y+4$ and $h(z)=\sin z$. Show that $h\circ(g\circ f)=(h\circ g)\circ f$.

Solution. Evaluate each side at $x\in\mathbb{N}$.

Left side: $(g\circ f)(x)=3(2x)+4=6x+4$, so $[h\circ(g\circ f)](x)=\sin(6x+4)$.

Right side: $(h\circ g)(y)=\sin(3y+4)$, so $[(h\circ g)\circ f](x)=\sin\big(3\cdot2x+4\big)=\sin(6x+4)$.

The two agree for every $x$. This is the general fact that composition is associative.

Both sides equal $\sin(6x+4)$, so $h\circ(g\circ f)=(h\circ g)\circ f$.

Question 11

Let $f$ be the greatest integer function and $g$ the absolute value function. Find $(f\circ g)\!\left(-\tfrac32\right)+(g\circ f)\!\left(\tfrac43\right)$.

Solution. Here $f(x)=[x]$ and $g(x)=|x|$.

$(f\circ g)\!\left(-\tfrac32\right)=f\!\left(\left|-\tfrac32\right|\right)=\left[\tfrac32\right]=1$.

$(g\circ f)\!\left(\tfrac43\right)=g\!\left(\left[\tfrac43\right]\right)=g(1)=1$.

Adding, $1+1=2$.

$2$

Question 12

Let $f(x)=x^2+2$ and $g(x)=\dfrac{x}{x-1}$ with $x\ne1$. Find $f\circ g$ and $g\circ f$, and hence $(f\circ g)(2)$ and $(g\circ f)(-3)$.

Solution. First,

$$(f\circ g)(x)=\left(\frac{x}{x-1}\right)^2+2=\frac{x^2}{(x-1)^2}+2.$$

Next, $(g\circ f)(x)=\dfrac{x^2+2}{(x^2+2)-1}=\dfrac{x^2+2}{x^2+1}$; the denominator is never zero, so this is defined for all real $x$.

Now evaluate: $(f\circ g)(2)=\dfrac{4}{1}+2=6$, and $(g\circ f)(-3)=\dfrac{9+2}{9+1}=\dfrac{11}{10}$.

$(f\circ g)(x)=\dfrac{x^2}{(x-1)^2}+2$, $(g\circ f)(x)=\dfrac{x^2+2}{x^2+1}$; $(f\circ g)(2)=6$, $(g\circ f)(-3)=\dfrac{11}{10}$.

Common mistakes

  • Reading $g\circ f$ left to right. It means $g(f(x))$: $f$ acts first. In Questions 1 to 5 this reversal swaps the two answers.
  • Expanding $(2x+1)^2$ as $4x^2+1$ (Question 4) and losing the middle term $4x$; the same slip hits $(2x-3)^2$ in Question 5.
  • In Question 9, writing $g(y)=y/2$ for all integers, which gives non-integers at odd $y$ and so is not a map $\mathbb{Z}\to\mathbb{Z}$.
  • In Question 11, applying the greatest integer function to $-\tfrac32$ before the modulus (that would give $-2$) instead of working inside out.

Practise next

Exercise 2C continues with one-one, onto and invertible functions, which build directly on the composites practised here.

Shiwam's Classes: IIT JEEJEE Main and Advanced, worked in full

Subscribe