The formula y=f(x)=√x−2 definitely defines a function (for each x, you get one output f(x) that is the positive square root of x−2...the graph passes the vertical line test). Its domain is the set of all x such that x≥2 and its range is the set of all y such that y≥0.
Moreover, the function passes the horizontal line test and you can solve for x in the equation y=f(x)=√x−2 to find the inverse function: y=√x−2⇒y2=x−2⇒x=y2+2.
It is technically find to write the inverse function as x=f−1(y)=y2+2. However, for the purposes of graphing both functions in the same picture and seeing the reflection property across the line y=x, you can now swap the variables and write y=f−1(x)=x2+2. (If the variables represent specific real-life quantities, you should not do this swapping).
You should only graph y=f−1(x)=x2+2 for x≥0 (restrict the domain) since the set of all non-negative real numbers was the range of the original function. The range of the inverse function is the set of all y such that y≥2.
This half-parabola is definitely a function and definitely passes the vertical line test (on the restricted domain) because the original function passed the horizontal line test.
Also note that:
(f∘f−1)(x)=f(f−1(x))=f(x2+2)=√x2+2−2=√x2=|x|=x for x≥0 and
(f−1∘f)(x)=f−1(f(x))=f−1(√x−2)=(√x−2)2+2=x−2+2=x for all x≥2.