Given the two functions $f(x)=x^2+3x+5$ and $g(x)=\sqrt{2-|x-4|}$ work out $g^{-1}$ (Sweden 1961) Given the two functions $f(x)=x^2+3x+5$ and $g(x)=\sqrt{2-|x-4|}$ work out $g^{-1}$ for some subdomain.
I have managed to prove that $g^{-1}$ exists in the following way:
$g(x)=\sqrt{6-x}$ with $x\in[4,6]$ we have that g is 1-1 in $[4,6]$ and hence $g^{-1}$ exists.
This is where I got stuck and couldn't continue. Could you please explain how to work out $g^{-1}$ and explain every step of your thought process as well as intuitively, how you though of each step?
 A: As you have highlighted, an inverse exists, and I shall find it for the subdomain $[4,6]$.
In this subdomain, $|x-4| = x-4$, since $x > 4$. The equation then becomes
$$y = \sqrt{2-x+4} = \sqrt{6-x}$$
square both sides to obtain
$$y^2 = 6-x \implies x = 6-y^2$$
Therefore, the inverse function for the subdomain $[4,6]$ is $f^{-1}: [0,\sqrt{2}] \rightarrow [4,6], f^{-1}(x) = 6-x^2$. Here's a graph showing the given function and it's inverse (both of them are mirror images of each other about $y=x$.

A: Why did you restrict to the domain $[4,6]$?  It is not the complete domain of $g$.
the domain is all $x$ where $|x-4| \le 2$ so $0\le x-4 \le 2$ or $-2 \le x-4 \le 0$ so $4\le x \le 6$ or $2\le x \le 4$. So the domain is $[2,6]$
And we can easily see that $g$ is not one to one because for any $x \in (4,6]$ where $g(x) = \sqrt {2-|x-4|} =K$ we can have an $x' = 8-x\in [2,4)$ where $g(x') = \sqrt{2 -|(8-x)-4|}=\sqrt{2-|4-x|}=\sqrt{2-|x-4|}=K$.  For example $g(5) =\sqrt{2-|5-4|} = \sqrt{2-|3-4|} = g(3)$ and $g(4.1)=\sqrt{2-|4.1-4|} = \sqrt{2-|4-3.9|}=g(3.9)$ etc.
So no inverse will exist.
To find the inverse (if it exists)
Let $y=g^{-1}(x)$ so $x = g(g^{-1}(x)) = g(y) = \sqrt{2-|y-4|}$ so we solve for $y$.
$x = \sqrt{2-|y-4|}$ so
$x^2 = 2-|y-4|$
If $y \ge 4$ then $x^2 = 2-(y-4)=6-y$ and $y= 6-x^2$.
If $y < 4$ then $x^2 = 2-(4-y)=y-2$ and $y=x^2+2$
But that is not a well defined function.  If $6-x^2 > 4 > x^2 + 2$, that is to say if $x^2 < 2$ then we have no we to pick which value $y=g^{-1}(x)$ should be.
so the inverse does not exist and the function is not one to one.
