2.4 Algebra of Real Functions
Real functions can be added, subtracted, multiplied, divided and scaled point by point โ $(f+g)(x)=f(x)+g(x)$ โ as long as we keep track of the domain, which shrinks to $D_f\cap D_g$ and, for a quotient, loses the zeros of $g$.
A juice stall at a school fest sells glasses at โน60 each. Its takings for $x$ glasses are $R(x)=60x$ rupees, and its costs โ โน2000 for the stall and equipment plus โน35 of fruit per glass โ are $C(x)=2000+35x$ rupees. The profit is the difference, $P(x)=R(x)-C(x)=25x-2000$, and the stall breaks even when $P(x)=0$, at $x=80$ glasses. We have just subtracted one function from another, value by value.
New functions are built from old ones like this all the time: total cost is a sum, area is a product of two lengths, average cost is a quotient. In this section we define the sum, difference, product, quotient and scalar multiple of real functions, and โ the part students most often get wrong โ work out the domain of each.
Sum, Difference and Scalar Multiple
Let $f : D_f\to\mathbb{R}$ and $g : D_g\to\mathbb{R}$ be real functions, and let $D=D_f\cap D_g$. For every $x\in D$ define $$(f+g)(x)=f(x)+g(x),\qquad (f-g)(x)=f(x)-g(x).$$ For a real number $\alpha$, the scalar multiple $\alpha f : D_f\to\mathbb{R}$ is $(\alpha f)(x)=\alpha\,f(x)$.
The operations are carried out pointwise: to find $(f+g)(3)$ you find $f(3)$ and $g(3)$ and add the two numbers. The new function is only defined where both ingredients are defined โ hence the domain $D_f\cap D_g$, an intersection of sets exactly as in Section 1.3.
Product and Quotient
With $f$, $g$ and $D=D_f\cap D_g$ as before, the product $fg : D\to\mathbb{R}$ and the quotient $\dfrac fg$ are $$(fg)(x)=f(x)\,g(x)\quad(x\in D),$$ $$\left(\frac fg\right)(x)=\frac{f(x)}{g(x)}\quad(x\in D,\ g(x)\ne0).$$
For real functions $f$ and $g$ with domains $D_f$ and $D_g$, and any real $\alpha$:
- $f+g$, $f-g$ and $fg$ have domain $D_f\cap D_g$;
- $\alpha f$ has domain $D_f$;
- $\dfrac fg$ has domain $\big(D_f\cap D_g\big)-\{x : g(x)=0\}$.
Proof. The number $f(x)\pm g(x)$ or $f(x)g(x)$ exists exactly when both $f(x)$ and $g(x)$ exist, i.e. when $x\in D_f$ and $x\in D_g$. The number $\alpha f(x)$ needs only $f(x)$. The quotient needs both values and, in addition, a non-zero denominator, so the zeros of $g$ are removed. $\blacksquare$
1. Forgetting to intersect domains. $\sqrt{x}+\dfrac1{x-1}$ is not defined at $x=-4$ (first term) or at $x=1$ (second term).
2. Cancelling away an excluded point. Find the domain of $\dfrac fg$ from the original $g$, before simplifying (Example 4).
3. $fg$ is a product. $(fg)(x)$ means $f(x)\times g(x)$, never "$f$ applied to $g(x)$". With $f(x)=x+1$, $g(x)=x^2$: $(fg)(2)=3\times4=12$.
4. Brackets in a difference. $(f-g)(x)=f(x)-g(x)$ subtracts all of $g(x)$: $x^2-(2x+1)=x^2-2x-1$, not $x^2-2x+1$.
Composition of functions is taught and tested in school, but not in the year-end board exam; JEE Main and JEE Advanced both list it, and you will use it constantly in Class 12 (inverse functions, the chain rule).
Composition. Mistake 3 above warned that $fg$ is a product. "Apply $f$, then apply $g$ to the result" is a different way of combining two functions: the composite $g\circ f$ ("$g$ of $f$"), defined by $$(g\circ f)(x)=g\big(f(x)\big).$$ Its domain is the set of $x$ in the domain of $f$ for which $f(x)$ lies in the domain of $g$ โ the output of the first machine must be an allowed input of the second. The function written on the right acts first, and order matters: in general $g\circ f\ne f\circ g$.
Worked example 1. Let $f(x)=x+1$ and $g(x)=x^2$. Find $(g\circ f)(x)$ and $(f\circ g)(x)$, and compare them at $x=2$.
Solution. $(g\circ f)(x)=g(x+1)=(x+1)^2$, while $(f\circ g)(x)=f(x^2)=x^2+1$. At $x=2$: $(g\circ f)(2)=9$ but $(f\circ g)(2)=5$, so $g\circ f\ne f\circ g$. Both have domain $\mathbb{R}$.
Worked example 2. Let $f(x)=x+3$ and $g(x)=\sqrt x$. Find $g\circ f$ and $f\circ g$ with their domains.
Solution. $(g\circ f)(x)=\sqrt{x+3}$: we need $f(x)=x+3\ge0$, so the domain is $[-3,\infty)$. $(f\circ g)(x)=\sqrt x+3$: now $x$ itself must be $\ge0$, so the domain is $[0,\infty)$. Check $x=-2$: $g(f(-2))=g(1)=1$ is defined, but $g(-2)$ is not, so $-2$ is in the first domain only โ.
In JEE Main and JEE Advanced 2026; the CBSE year-end exam asks only for domains of simple sums, products and quotients. Both entrance exams ask for domains of expressions that combine several roots, quotients and standard functions.
Method. Treat the expression as a sum, product or quotient of simple pieces, write the domain of each piece, intersect them (Theorem 2.5), and remove every zero of every denominator.
Worked example. Find the domain of $h(x)=\sqrt{x-2}+\dfrac{1}{\sqrt{5-x}}+\dfrac{1}{x-4}$.
Solution. $\sqrt{x-2}$ needs $x\ge2$. $\dfrac1{\sqrt{5-x}}$ needs $5-x\gt0$ (strictly, as it is in a denominator), i.e. $x\lt5$. $\dfrac1{x-4}$ needs $x\ne4$. Intersecting: $[2,5)-\{4\}=[2,4)\cup(4,5)$.
Exercises
- 1 Find $(f+g)(x)$.
- 2 Find $(f-g)(2)$.
- 3 Find $(fg)(-1)$.
- 4 Find $\left(\dfrac fg\right)(x)$ and its domain.
- 5 Find $(3f-2g)(1)$.
- 6 Find $\left(\dfrac gf\right)(x)$ and its domain.
- 7 $f(x)=3x-2$ and $g(x)=-3x+5$. Show that $f+g$ is a constant function.
- 1 $f+g$, where $f(x)=\sqrt x$ and $g(x)=\sqrt{4-x}$.
- 2 $f+g$, where $f(x)=\sqrt{x-1}$ and $g(x)=\dfrac1{x-2}$.
- 3 $\dfrac fg$, where $f(x)=x$ and $g(x)=x^2-9$.
- 4 $\dfrac fg$, where $f(x)=\sqrt{x+2}$ and $g(x)=x-1$.
- 5 $fg$, where $f(x)=\dfrac1x$ and $g(x)=\dfrac1{x-1}$.
- 6 $\dfrac fg$, where $f(x)=x^2-1$ and $g(x)=x+1$. Simplify it and find its value at $x=3$.
- 7 $\dfrac fg$, where $f(x)=x+3$ and $g(x)=|x|-2$.
- 1 $f(x)=|x|$, $g(x)=x$. Write $(f-g)(x)$ without the modulus sign.
- 2 With $f$, $g$ as in part 1, find $(f-g)(-3)$ and $(f-g)(3)$.
- 3 $h(x)=x-[x]$. Find $h(2.3)$, $h(-2.3)$ and $h(5)$, and the range of $h$.
- 4 $f(x)=2x$, $g(x)=x^2$. Find $\dfrac fg$ and $\dfrac gf$ with their domains.
- 5 $f(x)=\operatorname{sgn}x$, $g(x)=|x|$. Identify the function $fg$.
- 6 $f(x)=x^2$. Describe the graphs of $2f$, $\tfrac12f$ and $(-1)f$ compared with the graph of $f$.
- 1 Business. A start-up selling notebooks has revenue $R(x)=45x$ and cost $C(x)=1500+20x$ rupees for $x$ notebooks. Find the profit function, the break-even point, and the profit on $100$ notebooks.
- 2 Area. A rectangle has sides $f(x)=x+2$ and $g(x)=x-1$ metres, where $x\gt1$. Express its area as a function and evaluate it at $x=4$.
- 3 Average cost. Printing $x$ copies of a school magazine costs $C(x)=500+10x$ rupees. Find the average cost function $A(x)=\dfrac{C(x)}{x}$, its domain in this context, and $A(50)$.
- 4 Motion. Two cars leave a toll plaza together on the same road; after $t$ hours car P has gone $d(t)=60t$ km and car Q $e(t)=45t$ km. Find the gap $(d-e)(t)$ and when it is $30$ km.
- 5 Electricity. A monthly bill is $B(x)=100+6x$ rupees for $x$ units. Flat 1 uses $x$ units and Flat 2 uses twice as many. Write the combined bill $T(x)=B(x)+B(2x)$ as a formula and evaluate it for $x=50$.
- 1 Find $(g\circ f)(x)$ and $(f\circ g)(x)$.
- 2 Find $(g\circ f)(1)$ and $(f\circ g)(1)$.
- 3 For $f(x)=\sqrt x$ and $g(x)=1-x$, find $g\circ f$ and $f\circ g$ with their domains.
- 4 For $f(x)=x^2$, find $(f\circ f)(x)$ and $(f\circ f)(-2)$.
- 5 If $f(x)=3x+2$, find a function $g$ with $(f\circ g)(x)=x$ for every real $x$, and check that $(g\circ f)(x)=x$ too.
How this is examined: Board papers give two functions and ask for $f\pm g$, $fg$, $f/g$ โ as formulas, as values at a point, and with domains (1โ3 marks). JEE combines the standard functions ($|x|$, $[x]$) and asks for values, domains and identities.
E1. Board ยท 1 mark If $f(x)=x^2$ and $g(x)=2x+1$, then $(f-g)(3)$ equals (A) $2$ (B) $16$ (C) $-2$ (D) $4$
E2. Board ยท 2 marks Let $f(x)=\sqrt{x-1}$ and $g(x)=x-3$. Find $(f+g)(x)$, $(fg)(x)$ and $\left(\dfrac fg\right)(x)$, stating the domain of each.
E3. Board ยท 3 marks Let $f(x)=x^2-9$ and $g(x)=x+3$. Find (i) $(f+g)(x)$ (ii) $(fg)(1)$ (iii) $\left(\dfrac fg\right)(x)$ in simplest form, with its domain.
E4. JEE Main If $f(x)=|x|$ and $g(x)=[x]$, then $(f-g)(-1.5)$ is (A) $3.5$ (B) $-0.5$ (C) $0.5$ (D) $2.5$
E5. JEE Main Numerical value. Find the number of integers in the domain of $h(x)=\dfrac{\sqrt{x-1}\,\sqrt{7-x}}{x-4}$.
E6. JEE Advanced One or more options correct. Let $f(x)=x+|x|$ and $g(x)=x-|x|$ for $x\in\mathbb{R}$. Then (A) $(fg)(x)=0$ for every real $x$ (B) $(f+g)(x)=2x$ for every real $x$ (C) the domain of $\dfrac fg$ is $(-\infty,0]$ (D) the range of $g$ is $(-\infty,0)$
Research question. For a real small venture โ a school-fest stall, a tuition group, a home bakery order โ what are the revenue, cost and profit functions, and how many sales are needed to break even?
Why it matters. Break-even analysis is how every business, from a street vendor to an airline, decides whether a plan is worth starting. It is nothing more than the algebra of functions: $P=R-C$, average cost $C/x$, and the point where $P$ changes sign.
What to do.
- Choose a venture and collect real prices (ask a shopkeeper, check online rates): the fixed costs, the cost per item, and a realistic selling price.
- Write $R(x)$, $C(x)$ and $P(x)=(R-C)(x)$, and state a sensible domain for $x$.
- Find the break-even point and the profit at two realistic sales levels. Tabulate the average cost $\dfrac{C(x)}{x}$ for $x=10,50,100,200$.
- Change one price (e.g. raise the selling price by โน5) and recompute the break-even point.
Tools: A spreadsheet with columns $x$, $R$, $C$, $P$, $C/x$; a phone graphing app
Hand in: The three functions, a graph of $R$ and $C$ on the same axes with the break-even point marked, and a recommendation in two sentences.
Going further. Why does the average cost $\dfrac{C(x)}{x}$ keep falling as $x$ grows, but never below the cost per item? Explain using $\dfrac{C(x)}{x}=\dfrac{\text{fixed cost}}{x}+\text{cost per item}$.
๐งช Self-check quiz
Q1. If $f(x)=x+2$ and $g(x)=3x$, then $(f+g)(1)$ is
Q2. If $f(x)=x$ and $g(x)=x-5$, the domain of $\dfrac fg$ is
Q3. If $f(x)=x^2$, then $(2f)(x)$ is
Q4. If $f(x)=\sqrt x$ and $g(x)=x+1$, the domain of $f+g$ is
Q5. If $f(x)=x-1$ and $g(x)=x+1$, then $(fg)(x)$ is