MatheramaMatherama
← Relations and Functions
Relations and Functions·Section 10·19 min read

Algebra of Functions

Equality of Functions§

Two functions f(x)f(x) and g(x)g(x) are said to be equal if:

  1. They have the same domain.
  2. For every xx in the domain, f(x)=g(x)f(x) = g(x).

This means the two functions produce the same outputs for all inputs in their domain, even if their expressions appear different.

Example: ∣x∣|x| and (x2)(\sqrt{x^2})

  1. Definition of ∣x∣|x|:

    ∣x∣={xx≥0,−xx<0.|x| = \begin{cases} x & x \geq 0, \\ -x & x < 0. \end{cases}
  2. Definition of (x2)(\sqrt{x^2}):

    (x2)={xx≥0,−xx<0.(\sqrt{x^2}) = \begin{cases} x & x \geq 0, \\ -x & x < 0. \end{cases}

From these definitions, it is clear that:

∣x∣=(x2)for all x∈R.|x| = (\sqrt{x^2}) \quad \text{for all } x \in \mathbb{R}.

Thus, ∣x∣|x| and (x2)(\sqrt{x^2}) are equal functions, as they produce the same output for all xx in their domain.

Algebra of Functions§

Let ff and gg be two functions with domains DfD_f and DgD_g, respectively. The algebra of functions involves combining ff and gg using operations such as addition, subtraction, multiplication, and division. These operations are performed pointwise, meaning they are applied to each input xx where both f(x)f(x) and g(x)g(x) are defined.

1. Addition of Functions

The sum of two functions, ff and gg, is defined as:

(f+g)(x)=f(x)+g(x).(f + g)(x) = f(x) + g(x).

This is referred to as pointwise addition because the values of ff and gg are added for the same input xx.

  • Domain: The domain of f+gf + g is the intersection of the domains of ff and gg:

    Domain of (f+g)=Df∩Dg.\text{Domain of } (f + g) = D_f \cap D_g.

Graphically, the graph of f+gf + g is obtained by adding the yy-coordinates of f(x)f(x) and g(x)g(x) for each xx in the common domain.

addition of two functions graphically

2. Subtraction of Functions

The difference of two functions, ff and gg, is defined as:

(f−g)(x)=f(x)−g(x).(f - g)(x) = f(x) - g(x).

Similar to addition, this is also performed pointwise.

  • Domain: The domain of f−gf - g is the same as for addition:

    Domain of (f−g)=Df∩Dg.\text{Domain of } (f - g) = D_f \cap D_g.

3. Multiplication of Functions

The product of two functions, ff and gg, is defined as:

(f⋅g)(x)=f(x)⋅g(x).(f \cdot g)(x) = f(x) \cdot g(x).

This is referred to as pointwise multiplication since the values of ff and gg are multiplied for each input xx.

  • Domain: The domain of f⋅gf \cdot g is the intersection of the domains of ff and gg:

    Domain of (f⋅g)=Df∩Dg.\text{Domain of } (f \cdot g) = D_f \cap D_g.

4. Division of Functions

The quotient of two functions, ff and gg, is defined as:

(fg)(x)=f(x)g(x),for g(x)≠0.\left(\frac{f}{g}\right)(x) = \frac{f(x)}{g(x)}, \quad \text{for } g(x) \neq 0.

This is called pointwise division.

  • Domain: The domain of fg\frac{f}{g} is the intersection of the domains of ff and gg, excluding points where g(x)=0g(x) = 0:

    Domain of (fg)=Df∩Dg∖{x:g(x)=0}.\text{Domain of } \left(\frac{f}{g}\right) = D_f \cap D_g \setminus \{x : g(x) = 0\}.

Key Insights

  1. All operations (addition, subtraction, multiplication, and division) are performed pointwise, meaning the operation is applied to f(x)f(x) and g(x)g(x) at the same xx.
  2. The domain of the resulting function is always the intersection of the domains of ff and gg, with additional restrictions for division to exclude zeros of g(x)g(x).

By combining functions algebraically, we can create new functions that inherit properties from ff and gg, while their domains depend on the overlap of DfD_f and DgD_g. Graphical representations show how these operations affect the shape of the resulting function.

Illustrative Example

Let f(x)=x2−1f(x) = x^2 - 1 and g(x)=x+2g(x) = x + 2. The domains of f(x)f(x) and g(x)g(x) are (−∞,∞)(-\infty, \infty).

  1. Addition:

    (f+g)(x)=(x2−1)+(x+2)=x2+x+1.(f + g)(x) = (x^2 - 1) + (x + 2) = x^2 + x + 1.

    Domain: (−∞,∞)(-\infty, \infty).

  2. Subtraction:

    (f−g)(x)=(x2−1)−(x+2)=x2−x−3.(f - g)(x) = (x^2 - 1) - (x + 2) = x^2 - x - 3.

    Domain: (−∞,∞)(-\infty, \infty).

  3. Multiplication:

    (f⋅g)(x)=(x2−1)(x+2)=x3+2x2−x−2.(f \cdot g)(x) = (x^2 - 1)(x + 2) = x^3 + 2x^2 - x - 2.

    Domain: (−∞,∞)(-\infty, \infty).

  4. Division:

    (fg)(x)=x2−1x+2.\left(\frac{f}{g}\right)(x) = \frac{x^2 - 1}{x + 2}.

    Domain: (−∞,∞)∖{−2}(-\infty, \infty) \setminus \{-2\}, since g(x)=0g(x) = 0 at x=−2x = -2.

Performing Algebra on Piecewise-Defined Functions§

To perform algebraic operations on piecewise-defined functions such as addition, subtraction, multiplication, or division, the process involves a structured approach to ensure correctness. The steps are outlined below.

1. Analyze and Unify Intervals

First, examine the intervals over which each function is defined. If the intervals differ between the two functions, divide the domain into unified intervals that include all boundaries where either function's expression changes. This ensures that the operations are performed consistently across all intervals.

2. Rewrite Functions on Unified Intervals

Once the intervals are unified, rewrite each function on these intervals. For each interval, determine the expression of the function and ensure it is well-defined over the new domain. This step aligns the functions for direct algebraic manipulation.

3. Perform the Desired Operation

Within each unified interval, apply the desired algebraic operation:

  • Addition: (f+g)(x)=f(x)+g(x)(f + g)(x) = f(x) + g(x),
  • Subtraction: (f−g)(x)=f(x)−g(x)(f - g)(x) = f(x) - g(x),
  • Multiplication: (f⋅g)(x)=f(x)⋅g(x)(f \cdot g)(x) = f(x) \cdot g(x),
  • Division: (fg)(x)=f(x)g(x)\left(\frac{f}{g}\right)(x) = \frac{f(x)}{g(x)}, provided g(x)≠0g(x) \neq 0.

4. Combine Results into a New Piecewise Function

The results for each interval are combined to form the new piecewise function. Explicitly define the expression for each interval and specify whether boundaries are included (closed) or excluded (open) to avoid ambiguity.

Composition of Functions§

Let f:A→Bf: A \to B and g:C→Dg: C \to D be two functions. The composition of ff and gg is a function, and its concept can be illustrated using the following figures:

fog

gof

The input xx is first passed into the function ff, which produces an output f(x)f(x). This output f(x)f(x) then becomes the input of the function gg. The final output is g(f(x))g(f(x)), which is written in shorthand as g∘f(x)g \circ f(x). This process is considered to occur through a single function g∘fg \circ f, known as the composition of ff and gg.

If the input instead first goes through gg and then through ff, the resulting composition is denoted by f∘g(x)f \circ g(x).

alt text

Now consider the composition g∘fg \circ f. The domain of ff is AA, but not all inputs from AA can necessarily be used in g∘fg \circ f. Why? Because the output of ff might not lie within the domain of gg, which is CC.

This leads to the following condition for the allowed inputs:

Only those inputs from AA are allowed for which the output of ff lies in the domain of gg.

Thus, the domain of g∘fg \circ f is not necessarily the same as the domain of ff.

The domain of g∘fg \circ f is:

Domain of (g∘f)={x∈A:f(x)∈Domain of g}.\text{Domain of } (g \circ f) = \{x \in A : f(x) \in \text{Domain of } g\}.

Similarly, for the composition f∘gf \circ g, the domain is:

Domain of (f∘g)={x∈C:g(x)∈Domain of f}.\text{Domain of } (f \circ g) = \{x \in C : g(x) \in \text{Domain of } f\}.

Definition

Let f:A→Bf: A \to B and g:C→Dg: C \to D be two functions. The composition of functions creates a new function by applying one function to the result of another. The composition g∘fg \circ f is defined more rigoruously as follows:

g∘f={(x,y):x∈A,f(x)∈C, and y=g(f(x))}.g \circ f = \{(x, y) : x \in A, f(x) \in C, \text{ and } y = g(f(x))\}.

Similarly, the composition f∘gf \circ g is defined as:

f∘g={(x,z):x∈C,g(x)∈B, and z=f(g(x))}.f \circ g = \{(x, z) : x \in C, g(x) \in B, \text{ and } z = f(g(x))\}.

Meaning of the Definition

The definition describes the requirements for composing two functions:

  1. For g∘fg \circ f:

    • The input xx must belong to the domain of ff, which is AA.
    • The output of f(x)f(x) must lie within the domain of gg, which is CC.
    • The final output of the composition g∘fg \circ f is given by g(f(x))g(f(x)).
  2. For f∘gf \circ g:

    • The input xx must belong to the domain of gg, which is CC.
    • The output of g(x)g(x) must lie within the domain of ff, which is BB.
    • The final output of the composition f∘gf \circ g is given by f(g(x))f(g(x)).

Finding Mathematical Expressions for Compositions

When functions f(x)f(x) and g(x)g(x) are defined explicitly using mathematical expressions, the composition f∘g(x)f \circ g(x) or g∘f(x)g \circ f(x) is determined by substituting the expression of one function into the other. Here’s how to calculate the composition and its exhaustive domain step by step:

Composition is Not Commutative§

Let f(x)=x+1f(x) = x + 1 and g(x)=1−2xg(x) = 1 - 2x. We will compute f∘g(x)f \circ g(x) and g∘f(x)g \circ f(x) to demonstrate that composition is not commutative.

f∘g(x)f \circ g(x)

g∘f(x)g \circ f(x)

From the above calculations:

f∘g(x)=2−2x,g∘f(x)=−1−2x.f \circ g(x) = 2 - 2x, \quad g \circ f(x) = -1 - 2x.

Clearly:

f∘g(x)≠g∘f(x).f \circ g(x) \neq g \circ f(x).

This example demonstrates that composition is not commutative. The order in which functions are applied affects the resulting expression, making f∘gf \circ g generally different from g∘fg \circ f.

Composition of Functions is Associative§

Let f:A→Bf: A \to B, g:B→Cg: B \to C, and h:C→Dh: C \to D. The composition of functions satisfies the associative property:

h∘(g∘f)=(h∘g)∘f.h \circ (g \circ f) = (h \circ g) \circ f.

Proof:

Composition with the Identity Function§

Let f:A→Bf: A \to B be a function. The composition of ff with the identity function satisfies the following properties:

  1. Composition with the identity function on BB:

    IB∘f=f,I_B \circ f = f,

    where IB:B→BI_B: B \to B is the identity function on BB defined by IB(y)=yI_B(y) = y for all y∈By \in B.

  2. Composition with the identity function on AA:

    f∘IA=f,f \circ I_A = f,

    where IA:A→AI_A: A \to A is the identity function on AA defined by IA(x)=xI_A(x) = x for all x∈Ax \in A.

Proof:

Part 1: IB∘f=fI_B \circ f = f

The composition IB∘fI_B \circ f is defined as:

(IB∘f)(x)=IB(f(x)),for all x∈A.(I_B \circ f)(x) = I_B(f(x)), \quad \text{for all } x \in A.

Since IB(y)=yI_B(y) = y for all y∈By \in B, we have:

IB(f(x))=f(x),for all x∈A.I_B(f(x)) = f(x), \quad \text{for all } x \in A.

Thus:

IB∘f=f.I_B \circ f = f.

Part 2: f∘IA=ff \circ I_A = f

The composition f∘IAf \circ I_A is defined as:

(f∘IA)(x)=f(IA(x)),for all x∈A.(f \circ I_A)(x) = f(I_A(x)), \quad \text{for all } x \in A.

Since IA(x)=xI_A(x) = x for all x∈Ax \in A, we have:

f(IA(x))=f(x),for all x∈A.f(I_A(x)) = f(x), \quad \text{for all } x \in A.

Thus:

f∘IA=f.f \circ I_A = f.

■\blacksquare

Composition of piecewise-defined functions:

f(x)={x+1x≥0,1−2xx<0,g(x)={3xx<1,x+2x≥1.f(x) = \begin{cases} x+1 & x \geq 0, \\ 1-2x & x < 0, \end{cases} \quad g(x) = \begin{cases} 3x & x<1, \\ x+2 & x \geq 1. \end{cases}

Find f(g(x))f(g(x)) and g(f(x))g(f(x)).

Solution:

f(g(x))=f(g(x))f(g(x)) = f(g(x)) ={g(x)+1g(x)≥0,1−2g(x)g(x)<0.= \begin{cases} g(x)+1 & g(x) \geq 0, \\ 1-2g(x) & g(x) < 0. \end{cases}

Now since g(x)g(x) is defined in two pieces, one for x<1x < 1 and x≥1x \geq 1, we put each piece one by one. First replace g(x)g(x) by 3x3x every where in the expression, but this is true when x<1x<1. Then replace g(x)g(x) by x+2x+2 everywhere again, which is true when x≥1x\geq 1. This results in four rows.

f(g(x))={3x+13x≥0 when x<1, [ as g(x)=3x when x<1]1−2(3x)3x<0 when x<1, [ as g(x)=3x when x<1](x+2)+1x+2≥0 when x≥1, [ as g(x)=x+2 when x≥1]1−2(x+2)x+2<0 when x≥1, [ as g(x)=x+2 when x≥1]f(g(x)) = \begin{cases} 3x+1 & 3x \geq 0 \text{ when } x < 1, \, [\text{ as } g(x)=3x \text{ when } x<1] \\ 1-2(3x) & 3x < 0 \text{ when } x < 1, \, [\text{ as } g(x)=3x \text{ when } x<1] \\ (x+2)+1 & x+2 \geq 0 \text{ when } x \geq 1, \, [\text{ as } g(x)=x+2 \text{ when } x\geq 1] \\ 1-2(x+2) & x+2 < 0 \text{ when } x \geq 1, \, [\text{ as } g(x)=x+2 \text{ when } x\geq 1] \end{cases}

Simplify the inequations in each row:

f(g(x))={3x+1x≥0 when x<1,1−6xx<0 when x<1,x+3x≥1 when x+2≥0,−2x−3x≥1 when x+2<0.f(g(x)) = \begin{cases} 3x+1 & x \geq 0 \text{ when } x<1, \\ 1-6x & x<0 \text{ when } x<1, \\ x+3 & x \geq 1 \text{ when } x+2 \geq 0, \\ -2x-3 & x \geq 1 \text{ when } x+2<0. \end{cases} f(g(x))={3x+10≤x<1,1−6xx<0,x+3x≥1,−2x−3x∈∅.[ we can ignore this ]f(g(x)) = \begin{cases} 3x+1 & 0 \leq x<1, \\ 1-6x & x<0, \\ x+3 & x \geq 1, \\ -2x-3 & x \in \emptyset. \quad [\text{ we can ignore this }] \end{cases} f(g(x))={1−6xx<0,3x+10≤x<1,x+3x≥1.f(g(x)) = \begin{cases} 1-6x & x<0, \\ 3x+1 & 0 \leq x<1, \\ x+3 & x \geq 1. \end{cases}

Now let us find g(f(x))g(f(x)):

g(f(x))={3f(x)f(x)<1f(x)+2f(x)≥1g(f(x)) = \begin{cases} 3f(x) & f(x)<1 \\ f(x)+2 & f(x) \geq 1 \end{cases} ={3(x+1)x+1<1 when x≥0(x+1)+2x+1≥1 when x≥03(1−2x)1−2x<1 when x<01−2x+21−2x≥1 when x<0= \begin{cases} 3(x+1) & x+1<1 \text{ when } x \geq 0 \\ (x+1)+2 & x+1 \geq 1 \text{ when } x \geq 0 \\ 3(1-2x) & 1-2x<1 \text{ when } x<0 \\ 1-2x+2 & 1-2x \geq 1 \text{ when } x<0 \end{cases} ={3x+3x<0 when x≥0x+3x≥0 when x≥03−6xx>0 when x<03−2xx≤0 when x<0= \begin{cases} 3x+3 & x<0 \text{ when } x \geq 0 \\ x+3 & x \geq 0 \text{ when } x \geq 0 \\ 3-6x & x>0 \text{ when } x<0 \\ 3-2x & x \leq 0 \text{ when } x<0 \end{cases} ={3x+3x∈∅[ we can ignore this ]x+3x≥03−6xx∈∅[ we can ignore this ]3−2xx<0= \begin{cases} 3x+3 & x \in \emptyset [\text{ we can ignore this }]\\ x+3 & x \geq 0 \\ 3-6x & x \in \emptyset [\text{ we can ignore this }]\\ 3-2x & x<0 \end{cases} ={x+3x≥03−2xx<0= \begin{cases} x+3 & x \geq 0 \\ 3-2x & x<0 \end{cases}

■\blacksquare

Let us go through another problem:

Given:

f(x)={xx<−1x+2−1≤x<21−xx≥2f(x) = \begin{cases} x & x < -1 \\ x+2 & -1 \leq x < 2 \\ 1-x & x \geq 2 \end{cases} g(x)={3−2xx<0x−1x≥0g(x) = \begin{cases} 3-2x & x < 0 \\ x-1 & x \geq 0 \end{cases}

Find f(g(x))f(g(x))

Solution:

f(g(x))={g(x)g(x)<−1g(x)+2−1≤g(x)<21−g(x)g(x)≥2f(g(x)) = \begin{cases} g(x) & g(x) < -1 \\ g(x)+2 & -1 \leq g(x) < 2 \\ 1-g(x) & g(x) \geq 2 \end{cases} ={3−2x3−2x<−1 when x<03−2x+2−1≤3−2x<2 when x<01−(3−2x)3−2x≥2 when x<0x−1x−1<−1 when x≥0x−1+2−1≤x−1<2 when x≥01−(x−1)x−1≥2 when x≥0= \begin{cases} 3-2x & 3-2x < -1 \text{ when } x < 0 \\ 3-2x+2 & -1 \leq 3-2x < 2 \text{ when } x < 0 \\ 1-(3-2x) & 3-2x \geq 2 \text{ when } x < 0 \\ x-1 & x-1 < -1 \text{ when } x \geq 0 \\ x-1+2 & -1 \leq x-1 < 2 \text{ when } x \geq 0 \\ 1-(x-1) & x-1 \geq 2 \text{ when } x \geq 0 \end{cases} ={3−2xx>2 when x<05−2x12<x≤2 when x<02x−2x≤12 when x<0x−1x<0 when x≥0x+10≤x<3 when x≥02−xx≥3 when x≥0= \begin{cases} 3-2x & x > 2 \text{ when } x < 0 \\ 5-2x & \frac{1}{2} < x \leq 2 \text{ when } x < 0 \\ 2x-2 & x \leq \frac{1}{2} \text{ when } x < 0 \\ x-1 & x < 0 \text{ when } x \geq 0 \\ x+1 & 0 \leq x < 3 \text{ when } x \geq 0 \\ 2-x & x \geq 3 \text{ when } x \geq 0 \end{cases} ={3−2xx∈∅5−2xx∈∅2x−2x<0x−1x∈∅x+10≤x<32−xx∈∅= \begin{cases} 3-2x & x \in \emptyset \\ 5-2x & x \in \emptyset \\ 2x-2 & x < 0 \\ x-1 & x \in \emptyset \\ x+1 & 0 \leq x < 3 \\ 2-x & x \in \emptyset \end{cases}

Remove empty cases,

={2x−2x<0x+10≤x<3= \begin{cases} 2x-2 & x < 0 \\ x+1 & 0 \leq x < 3 \end{cases}

■\blacksquare

Section 10 of 18 · Relations and Functions

Mark this section complete when you have worked through its proofs.