Can a non-invertible function be inverted by returning a set of all possible solutions? Is there a concept of inverting a non-invertible function by returning a set of the possible solutions?
For example:
$g(x) = x^2$
Would it be possible to create an inverse function $f(y)$ where, for example:
$f(4) = \{-2,2\}$
(I'm pretty sure I'm going about this wrong, but I'm still learning so I don't know *how* I'm wrong)
 A: It is common to use the notation $f^{-1}(A)$, where $A$ is a subset of the value range of $f$, as a shorthand to describe the set $\{x : f(x) \in A \}$. Furthermore, if $A$ is a set with only one value $x$ it is also somewhat common to just write $f^{-1}(x)$ instead of $f^{-1}(\{x\})$. So if in your case the context is clear, it is fine to write $g^{-1}(4) = \{2, -2\}$.
Also there are functions that are multivalued by default like the complex logarithm for example.
A: This is a multivalued function (see especially the first example!), or multifunction, or set-valued function. A set-valued map, taking elements of $X$ and producing subsets of $Y$, is often denoted $f : X \rightrightarrows Y$.
It can also be denoted more literally by $f : X \to 2^Y$, as such maps can be thought of as (ordinary, single-valued) functions from $X$ to the power set of $Y$.
Finally, one could also view them simply as relations with a full domain.
A: It is possible to have a set-valued function just like your $f$. The only 'but' is that it is not a function $f: \mathbb R\to \mathbb R$ but actually $f:\mathbb R\to\mathcal P(\mathbb R)$, i.e. its target is the set of parts (or power set) of $\mathbb R$.
What you are actually describing by your $f$ is the level sets of $g$. Any more I would add is contained in @LionCoder's comment, so I invite you to continue reading his input instead of repeating what they have said.
A: To give a function is the same to give the sets where the function is constant: $c\mapsto f^{-1}(c)$. This would be a map $F:\mathbb{R}\to \text{power}(\mathbb{R})$. The function $F$ is almost injective (since $f^{-1}(c)\cap f^{-1}(c')=\emptyset$ for $c\neq c'$). It might not be injective if $f^{-1}(c)=f^{-1}(c')=\emptyset$, that is, if $c$ and $c'$ are not in the range of $f$. The result is:
$$F: \text{Image}(f)\to \text{power}(\mathbb{R})$$
is injective.
This map can never be surjective (by cardinality), so this is the best we can say. If you restrict an injective function to its image, then it becomes bijective.
