Composition follows one function with another. Inversion reverses a one-to-one relationship. Both operations depend on which inputs and outputs are actually allowed, not just on the simplified appearance of a formula.

This lesson develops domain-sensitive compositions, rational inverses, restricted square-root branches and inverse transformations in reverse order. The introductory Composite Functions and Inverse Functions pages remain the starting points.

On this page

Determine a composite domain before simplifying

For f∘gf\circ g, an input must first belong to the domain of gg, and its output under gg must belong to the domain of ff:

dom(f∘g)={x∈domg:g(x)∈domf}.\operatorname{dom}(f\circ g)=\{x\in\operatorname{dom}g:g(x)\in\operatorname{dom}f\}.

This is a two-stage condition, not simply the intersection of the two original input domains. The second function receives g(x)g(x), not xx.

Let

f(x)=x−1,g(x)=x+3x−2.f(x)=\sqrt{x-1},\qquad g(x)=\frac{x+3}{x-2}.

For f∘gf\circ g, first require x≠2x\ne2. Then require g(x)≥1g(x)\ge1. Since

g(x)−1=5x−2,g(x)-1=\frac5{x-2},

the square-root condition holds exactly when x>2x>2. Hence

(f∘g)(x)=5x−2,x>2.(f\circ g)(x)=\sqrt{\frac5{x-2}},\qquad x>2.

The endpoint 2 is excluded by the inner denominator. There is no allowed point at which the numerator 5 becomes zero.

Reverse the order and obtain a different domain

For g∘fg\circ f, first require x≥1x\ge1. Then the input supplied to gg must not equal 2:

x−1≠2⇔x≠5.\sqrt{x-1}\ne2\quad\Longleftrightarrow\quad x\ne5.

Thus

(g∘f)(x)=x−1+3x−1−2,x∈[1,5)∪(5,∞).(g\circ f)(x)=\frac{\sqrt{x-1}+3}{\sqrt{x-1}-2},\qquad x\in[1,5)\cup(5,\infty).

The two composites differ in both formula and domain. A valid calculation of f∘gf\circ g cannot be relabelled as g∘fg\circ f. The OpenStax composition treatment states the underlying two-stage domain rule.

Retain a hole concealed by reciprocal cancellation

Take h(x)=1/xh(x)=1/x and k(x)=1/(x−2)k(x)=1/(x-2). The inner function kk requires x≠2x\ne2, and its value is never zero, so it always belongs to the domain of hh once that restriction is met.

Algebra gives

(h∘k)(x)=11/(x−2)=x−2,x≠2.(h\circ k)(x)=\frac{1}{1/(x-2)}=x-2,\qquad x\ne2.

The final formula is a line with the point (2,0)(2,0) removed. Its range is ℝ\{0}\mathbb R\setminus\{0\}, not all real numbers. The inverse of this restricted function is y↦y+2y\mapsto y+2 with domain y≠0y\ne0.

An identity obtained after cancellation can conceal a lost input or output. Evaluate the original function stages before declaring that a composite is the unrestricted identity or an unrestricted polynomial.

Find a rational inverse and prove its range

Let

F(x)=2x+3x−1,x≠1.F(x)=\frac{2x+3}{x-1},\qquad x\ne1.

Set y=F(x)y=F(x) and solve for the original input:

yx−y=2x+3,x(y−2)=y+3,yx-y=2x+3,\qquad x(y-2)=y+3,
x=y+3y−2,y≠2.x=\frac{y+3}{y-2},\qquad y\ne2.

The output 2 is impossible: 2x+3=2(x−1)2x+3=2(x-1) would give 3=−23=-2. Conversely, for every y≠2y\ne2, the proposed input (y+3)/(y−2)(y+3)/(y-2) is defined and is not 1; equality to 1 would again require 3=−23=-2. Substitution returns yy.

Therefore the range of FF is exactly ℝ\{2}\mathbb R\setminus\{2\}, and

F−1(x)=x+3x−2,x≠2.F^{-1}(x)=\frac{x+3}{x-2},\qquad x\ne2.

Its range is ℝ\{1}\mathbb R\setminus\{1\}. Checking both compositions yields F−1(F(x))=xF^{-1}(F(x))=x for x≠1x\ne1 and F(F−1(x))=xF(F^{-1}(x))=x for x≠2x\ne2.

Exchange coordinates and swap the actual domain and range

An inverse graph reflects across the diagonalThe rational function (2x+3)/(x-1) and its inverse (x+3)/(x-2) are reflected across y=x on equal-unit axes. Points (0,-3) and (-3,0) exchange coordinates.F(x) = (2x + 3)/(x − 1)F⁻¹(x) = (x + 3)/(x − 2)-4-20246-4-20246yx(0, −3)(−3, 0)y = x
Both axes use exactly the same unit scale. Curves are split at their respective poles and clipped at the plot boundary.
Diagram explanation and exact data

F has domain excluding 1 and range excluding 2. Its inverse has domain excluding 2 and range excluding 1. The point (0,-3) on F corresponds to (-3,0) on the inverse.

Exchange coordinates and swap the actual domain and range: exact reference data
Point on F Reflected point on inverse
(0,−3)(0,-3) (−3,0)(-3,0)
(−3/2,0)(-3/2,0) (0,−3/2)(0,-3/2)
(3,9/2)(3,9/2) (9/2,3)(9/2,3)

The two graphs reflect across y=xy=x. Equal horizontal and vertical axis units are necessary if that reflection is to be represented faithfully in a drawing.

Check when a linear-fractional formula is invertible

For F(x)=(ax+b)/(cx+d)F(x)=(ax+b)/(cx+d) with real coefficients, a nonzero determinant ad−bcad-bc is the decisive condition. Rearranging y(cx+d)=ax+by(cx+d)=ax+b gives

F−1(y)=dy−ba−cy.F^{-1}(y)=\frac{dy-b}{a-cy}.

If c≠0c\ne0, the original domain excludes −d/c-d/c and its range excludes a/ca/c. The inverse has those exclusions exchanged. Substituting the inverse expression into the original returns yy because ad−bc≠0ad-bc\ne0 prevents the denominator from vanishing on the stated inverse domain.

If c=0c=0, the nonzero determinant requires a,d≠0a,d\ne0, and the function is an ordinary invertible affine function. If ad−bc=0ad-bc=0 and c≠0c\ne0, the expression is constant, a/ca/c, wherever defined. It is not one-to-one on that full domain, so the apparent inverse formula must not be used. An identically zero denominator defines no function at all.

Choose the inverse branch from the original restriction

For H(x)=(x−2)2+1H(x)=(x-2)^2+1, the unrestricted graph is not one-to-one. Solving y=(x−2)2+1y=(x-2)^2+1 gives two algebraic possibilities:

x=2±y−1,y≥1.x=2\pm\sqrt{y-1},\qquad y\ge1.

If the original domain is [2,∞)[2,\infty), choose the plus branch. Then

H−1(x)=2+x−1,x≥1.H^{-1}(x)=2+\sqrt{x-1},\qquad x\ge1.

If the original domain is (−∞,2](-\infty,2], choose the minus branch instead. A function inverse gives one output per input; writing an unresolved “±” would describe an inverse relation, not a single inverse function.

The composition exposes the restriction:

2+(x−2)2=2+|x−2|.2+\sqrt{(x-2)^2}=2+|x-2|.

This equals xx when x≥2x\ge2, but not generally when x<2x<2. The branch condition is what turns the expression into the correct inverse, not a licence to replace every u2\sqrt{u^2} by uu.

Reverse a chain of transformations

Consider

J(x)=3+2e4x−1.J(x)=3+2e^{4x-1}.

Its domain is all real numbers, and its range is (3,∞)(3,\infty). To reverse it, subtract 3, divide by 2, take the natural logarithm, add 1, then divide by 4:

J−1(y)=1+ln((y−3)/2)4,y>3.J^{-1}(y)=\frac{1+\ln((y-3)/2)}4,\qquad y>3.

The order is the reverse of the forward construction. Taking the logarithm before subtracting 3 would invert a different function.

If the original domain is restricted to [0,1][0,1], the range becomes

[3+2/e,3+2e3].[3+2/e,\ 3+2e^3].

The same inverse formula then has this restricted interval as its domain. Inversion swaps the actual domain and range, not the largest natural domains that happen to fit the formulas.

Justify the inverse of a composite

If gg is a bijection from AA to BB and ff is a bijection from BB to CC, then

(f∘g)−1=g−1∘f−1(f\circ g)^{-1}=g^{-1}\circ f^{-1}

as a function from CC to AA. For a value z∈Cz\in C, first undo ff to recover its input in BB, then undo gg to recover the original element of AA. This proves the order rather than merely memorising it.

When functions are restricted or their full ranges do not match, choose the relevant sets and restrictions explicitly before applying this formula. A cancellation inside a symbolic composition is not enough to establish bijectivity on arbitrary domains. The OpenStax inverse-function treatment gives the one-to-one and composition foundations.

For example, x↦x2x\mapsto x^2 from [0,∞)[0,\infty) to [0,∞)[0,\infty) has inverse x\sqrt x. The same square function from all reals is not one-to-one. Changing the domain changes whether the inverse-function law applies.

Practice questions

  1. Find the real domain of (x+3)/(x−2)−1\sqrt{(x+3)/(x-2)-1}.
  2. Find the inverse of F(x)=(2x+3)/(x−1)F(x)=(2x+3)/(x-1), stating its domain and range.
  3. Find the inverse of H(x)=(x−2)2+1H(x)=(x-2)^2+1 when the original domain is x≤2x\le2.
Check your answers
  1. First exclude 2. The radicand simplifies to 5/(x−2)5/(x-2), which is nonnegative exactly when x>2x>2. Thus the domain is (2,∞)(2,\infty).
  2. Solving y(x−1)=2x+3y(x-1)=2x+3 gives F−1(x)=(x+3)/(x−2)F^{-1}(x)=(x+3)/(x-2). Its domain excludes 2 and its range excludes 1, reversing the original range and domain.
  3. The original restriction selects the lower branch: H−1(x)=2−x−1H^{-1}(x)=2-\sqrt{x-1} for x≥1x\ge1. Its range is (−∞,2](-\infty,2].

Related topics

Use Advanced Function Transformations for complete point and interval mappings. Inverse Trigonometric Functions applies branch restrictions to periodic functions; Limits in Calculus develops behaviour at the boundaries of these domains.

Sources and further reading