Skip to main content
Mathematics LibreTexts

7.2: Inverse function

  • Page ID
    48990
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)

    ( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\id}{\mathrm{id}}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\kernel}{\mathrm{null}\,}\)

    \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\)

    \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\)

    \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    \( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

    \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

    \( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vectorC}[1]{\textbf{#1}} \)

    \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

    \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

    \( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    A function is one-to-one, when each output is determined by exactly one input. Therefore we can construct a new function, called the inverse function, where we reverse the roles of inputs and outputs. For example, when \(y=x^3\), each \(y_0\) comes from exactly one \(x_0\) as shown in the picture below:

    clipboard_ec46a8beab12f4f4c204762d3d441c71f.png

    The inverse function assigns to the input \(y_0\) the output \(x_0\).

    Definition: Inverse of a Function

    Let \(f\) be a function with domain \(D_f\) and range \(R_f\), and assume that \(f\) is one-to-one. The inverse of \(f\) is a function \(f^{-1}\) so that \[f(x)=y \quad \text{ means precisely that } \quad f^{-1}(y)=x \nonumber \]

    clipboard_e045732b5d4c85350163089a9f816db5d.png

    Here the outputs of \(f\) are the inputs of \(f^{-1}\), and the inputs of \(f\) are the outputs of \(f^{-1}\). Therefore, the inverse function \(f^{-1}\) has a domain equal to the range of \(f\), \(D_{f^{-1}}=R_f\), and \(f^{-1}\) has a range equal to the domain of \(f\), \(R_{f^{-1}}=D_f\). In short, when \(f\) is a function \(f:D_f\to R_f\), then the inverse function \(f^{-1}\) is a function \(f^{-1}:R_f\to D_f\).

    The inverse function reverses the roles of inputs and outputs.

    Example \(\PageIndex{1}\)

    Find the inverse of the following function via algebra.

    1. \(f(x)=2x-7\)
    2. \(g(x)=\sqrt{x+2}\)
    3. \(h(x)=\dfrac{1}{x+4}\)
    4. \(j(x)=\dfrac{x+1}{x+2}\)
    5. \(k(x)=(x-2)^2+3\) for \(x\geq 2\)

    Solution

    1. First, reverse the role of input and output in \(y=2x-7\) by exchanging the variables \(x\) and \(y\). That is, we write \(x=2y-7\). We need to solve this for \(y\): \[\stackrel{\text{(add $7$)}}\implies\quad x+7 = 2y \implies\quad y=\dfrac{x+7}{2} \nonumber \] Therefore, we obtain that the inverse of \(f\) is \(f^{-1}(x)=\dfrac{x+7} 2\).

    For the other parts, we always exchange \(x\) and \(y\) and solve for \(y\):

    1. Write \(y=\sqrt{x+2}\) and exchange \(x\) and \(y\): \[\begin{aligned} x=\sqrt{y+2} &\implies & x^2 =y+2 \quad \implies y= x^2-2\\ &\implies & g^{-1}(x)=x^2-2\end{aligned} \nonumber \]
    2. Write \(y=\dfrac{1}{x+4}\) and exchange \(x\) and \(y\): \[\begin{aligned} x=\dfrac{1}{y+4}& \implies & y+4 =\dfrac 1 x \quad\implies y= \dfrac 1 x -4\\ &\implies& h^{-1}(x)=\dfrac 1 x -4\end{aligned} \nonumber \]
    3. Write \(y=\dfrac{x+1}{x+2}\) and exchange \(x\) and \(y\): \[\begin{aligned} x=\dfrac{y+1}{y+2} & \stackrel{\times (y+2)}\implies & x(y+2) =y+1 \quad \implies xy+2x= y+1\\ &\implies & xy-y=1-2x \quad \implies y(x-1)=1-2x \\ &\implies & y= \dfrac{1-2x}{x-1} \quad \implies j^{-1}(x)=\dfrac{1-2x}{x-1},\end{aligned} \nonumber \]
    4. Write \(y=(x-2)^2+3\) and exchange \(x\) and \(y\): \[\begin{aligned} x=(y-2)^2+3 & \implies & x-3 =(y-2)^2 \quad \implies \sqrt{x-3}=y-2\\ &\implies & y=2+\sqrt{x-3} \quad\implies k^{-1}(x)=2+\sqrt{x-3}\end{aligned} \nonumber \]

    The function in the last example is not one-to-one when allowing \(x\) to be any real number. This is why we had to restrict the example to the inputs \(x\geq 2\). We exemplify the situation in the following example.

    Example \(\PageIndex{2}\)

    Note, that the function \(y=x^2\) can be restricted to a one-to-one function by choosing the domain to be all non-negative numbers \([0,\infty)\) or by choosing the domain to be all non-positive numbers \((-\infty,0]\).

    clipboard_e591d3b72b14ea6d0406d54c6d2ba00b7.png

    Solution

    Let \(f:[0,\infty)\to [0,\infty)\) be the function \(f(x)=x^2\), so that \(f\) has a domain of all non-negative numbers. Then, the inverse is the function \(f^{-1}(x)=\sqrt{x}\).

    On the other hand, we can take \(g(x)=x^2\) whose domain consists of all non-positive numbers \((-\infty,0]\), that is \(g:(-\infty,0]\to [0,\infty)\). Then, the inverse function \(g^{-1}\) must reverse domain and range, that is \(g^{-1}: [0,\infty)\to (-\infty,0]\). The inverse is obtained by exchanging \(x\) and \(y\) in \(y=x^2\) as follows:

    \[x=y^2 \quad \implies y=\pm \sqrt{x}\quad \implies g^{-1}(x)=-\sqrt{x} \nonumber \]

    Example \(\PageIndex{3}\)

    Restrict the function to a one-to-one function. Find the inverse function, if possible.

    1. \(f(x)=(x+3)^2+1\)
    2. \(g(x)=\dfrac{1}{(x-2)^2}\)
    3. \(h(x)=x^3-3x^2\)

    Solution

    1. The graph of \(f\) is displayed below.

    clipboard_e0ae6d682e150c8c3005779f3e73dae13.png

    The graph shows that \(f\) is one-to-one when restricted to all numbers \(x\geq -3\), which is the choice we make to find an inverse function. Next, we replace \(x\) and \(y\) in \(y=(x+3)^2+1\) to give \(x=(y+3)^2+1\). When solving this for \(y\), we must now remember that our choice of \(x\geq -3\) becomes \(y\geq -3\) after replacing \(x\) with \(y\). We now solve for \(y\).

    \[\begin{aligned} x=(y+3)^2+1 & \implies & x-1=(y+3)^2 \quad \implies y+3=\pm \sqrt{x-1} \\ & \implies & y=-3\pm \sqrt{x-1}\end{aligned} \nonumber \]

    Since we have chosen the restriction of \(y\geq -3\), we use the expression with the positive sign, \(y=-3+\sqrt{x-1}\), so that the inverse function is \(f^{-1}(x)=-3+\sqrt{x-1}\).

    1. The graph of \(g\) is displayed below.

    clipboard_ece069cc1fe115dd83f3e13853909a132.png

    For the function \(g\), the graph shows that we can restrict \(g\) to \(x> 2\) to obtain a one-to-one function. The inverse for this choice is given as follows. Replacing \(x\) and \(y\) in \(y=\dfrac{1}{(x-2)^2}\) gives \(x=\dfrac{1}{(y-2)^2}\), which we solve this for \(y\) under the condition \(y>2\).

    \[\begin{aligned} x=\dfrac{1}{(y-2)^2} & \implies & (y-2)^2=\dfrac{1}{x} \quad \implies y-2=\pm \dfrac 1 {\sqrt{x}} \\ & \implies & y=2\pm \dfrac 1 {\sqrt{x}} \quad \implies g^{-1}(x)=2+\dfrac{1}{\sqrt{x}}\end{aligned} \nonumber \]

    1. Finally, \(h(x)=x^3-3x^2\) can be graphed with the calculator as follows:

    clipboard_ead1dc36eac3235e6b7f2e5d6b4e28fae.png

    The picture on the right shows that the approximation of the local minimum is (approximately) at \(x=2\). Therefore, if we restrict \(h\) to all \(x\geq 2\), we obtain a one-to-one function. We replace \(x\) and \(y\) in \(y=x^3-3x^2\), so that the inverse function is obtained by solving the equation \(x=y^3-3y^2\) for \(y\). However, this equation is quite complicated and solving it is beyond our capabilities at this time. Therefore we simply say that \(h^{-1}(x)\) is that \(y\geq 2\) for which \(y^3-3y^2=x\), and leave the example with this.

    Let \(f\) be a one-to-one function. If \(f\) maps \(x_0\) to \(y_0=f(x_0)\), then \(f^{-1}\) maps \(y_0\) to \(x_0\). In other words, the inverse function is precisely the function for which

    \[\boxed{f^{-1}(f(x_0))=f^{-1}(y_0)=x_0} \quad \text{ and } \quad \boxed{f(f^{-1}(y_0))=f(x_0)=y_0} \nonumber \]

    clipboard_e7ea6ad1d0b628cbf79245a8294068407.png

    Observation: Inverses

    Let \(f\) and \(g\) be two one-to-one functions. Then \(f\) and \(g\) are inverses of each other exactly when

    \[\boxed{f(g(x))=x}\quad \text{ and } \quad \boxed{g(f(x))=x}\quad \text{ for all }x \nonumber \]

    In this case we write that \(g=f^{-1}\) and \(f=g^{-1}\).

    Example \(\PageIndex{4}\)

    Are the following functions inverse to each other?

    1. \(f(x)=5x+7, \quad g(x)=\dfrac{x-7}{5}\)
    2. \(f(x)=\dfrac{3}{x-6}, \quad g(x)=\dfrac{3}{x}+6\)
    3. \(f(x)=\sqrt{x}-3, \quad g(x)=x^2+3\)

    Solution

    We calculate the compositions \(f(g(x))\) and \(g(f(x))\).

    1. \(\begin{aligned}f(g(x)) &= f\left (\dfrac{x-7}{5}\right ) = 5\cdot\dfrac{x-7}{5}+7 = (x-7)+7 =x,\\ g(f(x)) &= g(5x+7)=\dfrac{(5x+7)-7}{5}=\dfrac{5x}{5}=x \nonumber \end{aligned}\)
    2. \(\begin{aligned}f(g(x)) &= f\left(\dfrac3 x +6 \right )=\dfrac{3}{(\frac{3}{x}+6)-6}=\dfrac{3}{\frac{3}{x}}=3\cdot \dfrac{x}{3}=x, \\ g(f(x)) &= \left(\dfrac{3}{x-6}\right)=\dfrac{3}{\frac{3}{x-6}}+6=3\cdot \dfrac{x-6}{3}+6=(x-6)+6=x\end{aligned} \)

    Using the Observation Inverses, we see that in both part (a) and (b), the functions are inverse to each other. For part (c), we calculate for a general \(x\) in the domain of \(g\):

    \[f(g(x))=\sqrt{x^2+3}-3\neq x \nonumber \]

    It is enough to show that for one composition \((f\circ g)(x)\) does not equal \(x\) to conclude that \(f\) and \(g\) are not inverses. (It is not necessary to also calculate the other composition \(g(f(x))\).)

    Warning

    It is true that when we have one relation \(f(g(x))=x\), then we also have the other relation \(g(f(x))=x\). Nevertheless, we recommend to always check both equations. The reason is that it is easy to mistake one of the relations, when not being careful about the domain and range.

    For example, let \(f(x)=x^2\) and \(g(x)=-\sqrt{x}\). Then, naively, we would calculate \(f(g(x))=(-\sqrt{x})^2=x\) and \(g(f(x))=-\sqrt{x^2}=-|x|\), so that the first equation would say \(f\) and \(g\) are inverses, whereas the second equation says they are not inverses.

    We can resolve the apparent contradiction by restricting \(f\) to a one-to-one function. For example, if we take the domain of \(f\) to be all positive numbers or zero, \(D_f=[0,\infty)\), then \(f(g(x))=f(-\sqrt{x})\) which is undefined, since \(f\) only takes non-negative inputs. Also, it is \(g(f(x))=-\sqrt{x^2}=-x\). Therefore, the functions \(f\) and \(g\) are not inverse to each other!

    On the other hand, if we restrict the function \(f(x)=x^2\) to all negative numbers and zero, \(D_f=(-\infty,0]\), then \(f(g(x))=(-\sqrt{x})^2=x\), since now \(f\) is defined for the negative input \(-\sqrt{x}\). Also, for a negative number \(x<0\), it is \(g(f(x))=-\sqrt{x^2}=-|x|=x\). So, in this case, \(f\) and \(g\) are inverse to each other!

    Our last observation concerns the graph of inverse functions. If \(f(x_0)=y_0\) then \(f^{-1}(y_0)=x_0\), and the point \(P(x_0,y_0)\) is on the graph of \(f\), whereas the point \(Q(y_0,x_0)\) is on the graph of \(f^{-1}\).

    clipboard_e75a3b1cf468aa83519742e685e46ae74.png

    We see that \(Q\) is the reflection of \(P\) along the diagonal \(y=x\). Since this is true for any point on the graph of \(f\) and \(f^{-1}\), we have the following general observation.

    Observation

    The graph of \(f^{-1}\) is the graph of \(f\) reflected along the diagonal.

    clipboard_e3ab90233e5b286f91aa852310f94f82c.png

    Example \(\PageIndex{5}\)

    Find the graph of the inverse function of the function given below.

    1. clipboard_e754637314373a0f0896e15abe5eff249.png
    2. \(f(x)=(x+1)^{3}\)

    Solution

    Carefully reflecting the graphs given in part (a) and (b) gives the following solution. The function \(f(x)=(x+1)^3\) in part (b) can be graphed with a calculator first.

    1. clipboard_ef8701212573bfec522af3b6e02fa77d9.png
    2. clipboard_eab6310124c181b7336fd82ea0fd7e087.png

    This page titled 7.2: Inverse function is shared under a CC BY-NC-SA 4.0 license and was authored, remixed, and/or curated by Thomas Tradler and Holly Carley (New York City College of Technology at CUNY Academic Works) via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.