Let $f$ and $g$ be two functions from $R$ into $R$, defined by $f(x)=|x|+x$ and $g(x)=|x|-x$ for all $x \in R$. Find f o $g$ and g o $f$.
Let $f$ and $g$ be two functions from $R$ into $R$, defined by $f(x)=|x|+x$ and $g(x)=|x|-x$ for all $x \in R$. Find f o $g$ and g o $f$.

Solution:

$\begin{array}{ll}
\mathrm{f}(\mathrm{x})=|\mathrm{x}|+\mathrm{x} \quad & \text { (given }) \\
\mathrm{g}(\mathrm{x})=|\mathrm{x}|-\mathrm{x} \quad & \text { (given) }
\end{array}$
It is known that
$\begin{array}{l}
\operatorname{fog}(x)=f(g(x)) \\
\quad=f(|x|-x) \\
\quad=\| x|-x|+|x|-x \quad[\because f(x)=|x|+x]
\end{array}$
Case $1:$ When $x \geq 0$
Suppose $\mathrm{x}=2$
$\begin{array}{l}
\operatorname{fog}(2)=\| 2|-2|+|2|-2 \\
=0
\end{array}$
Suppose $\mathrm{x}=7$
$\begin{array}{l}
\operatorname{fog}(7)=\| 7|-7|+|7|-7 \\
=0 \\
\Rightarrow \text { When } x \geq 0, \operatorname{fog}(x)=0
\end{array}$
Case $2:$ When $x<0$
Suppose $\mathrm{x}=-\mathrm{x}$
$\begin{array}{l}
\operatorname{fog}(-\mathrm{x})=||-\mathrm{x}|-(-\mathrm{x})|+|-\mathrm{x}|-(-\mathrm{x}) \\
\quad=|\mathrm{x}+\mathrm{x}|+\mathrm{x}+\mathrm{x} \\
\quad=4 \mathrm{x}
\end{array}$
$\Rightarrow$ When $x<0, \operatorname{fog}(x)=4 x$
It is known that
$\begin{array}{l}
\operatorname{gof}(\mathrm{x})=\mathrm{g}(\mathrm{f}(\mathrm{x})) \\
\quad=\mathrm{g}(|\mathrm{x}|+\mathrm{x}) \\
\quad=\| \mathrm{x}|+\mathrm{x}|-|\mathrm{x}|-\mathrm{x} \quad[\because \mathrm{g}(\mathrm{x})=|\mathrm{x}|-\mathrm{x}]
\end{array}$
Case $1:$ When $x \geq 0$
Suppose $x=2$
$\begin{array}{l}
\operatorname{fog}(2)=\| 2|+2|-|2|-2 \\
=0
\end{array}$
Suppose $\mathrm{x}=7$
$\begin{array}{l}
\operatorname{fog}(7)=\| 7|+7|-|7|-7 \\
=0
\end{array}$
$\Rightarrow$ When $x \geq 0, \operatorname{gof}(x)=0$
Case $2:$ When $x<0$
Suppose $x=-x$
$\operatorname{gof}(-x)=||-x|+(-x)|-|-x|-(-x)$
$=|x-x|-x+x$
$=0$
$\Rightarrow$ When $x<0, \operatorname{gof}(x)=0$