Do injective, yet not bijective, functions have an inverse? The formal definition I was given was that in order for a function $f(x)$ to have an inverse, $f(x)$ is required to be bijective. Nevertheless, further on, I was introduced to the inverse of trigonometric functions, such as the inverse of $\sin(x)$. But $\sin(x)$ is not bijective, but only injective (when restricting its domain).
As you can see the topics I'm studying are probably very basic, so excuse me if my question is silly, but ultimately does a function need to be bijective in order to have an inverse? If this is the case, how can we talk about the inverse of trigonometric functions such as $\sin$ and $\cos$?
 A: A function $f:X\to Y$ has an inverse if and only if it is bijective.
If a function is $f:X\to Y$ is injective and not necessarily surjective then we "create" the function $g:X\to f(X)$ prescribed by $x\mapsto f(x)$.
This function $g$ (closely related to $f$ and carrying the same prescription) is bijective so it has an inverse $g^{-1}:f(X)\to X$.
A: A function $f:A\to B$ that is injective may still not have an inverse $f^{-1}:B\to A$. This is because $f^{-1}$ may not be able to take input values from $B$ if it is not also surjective: $f$ had no output to some points in $B$, so $f^{-1}$ cannot take inputs from these points in $B$.
However, if you restrict the codomain of $f$ to some $B'\subset B$ such that $f:A\to B'$ is bijective, then you can define an inverse $f^{-1}:B'\to A$, since $f^{-1}$ can take inputs from every point in $B'$.
To define an inverse sine (or cosine) function, we must also restrict the domain $A$ to $A'$ such that $\sin:A'\to B'$ is also injective. Such an interval is $[-\pi/2,\pi/2]$. Then we may define the inverse sine function $\sin^{-1}:[-1,1]\to[-\pi/2,\pi/2]$, since the sine function is bijective when the domain and codomain are restricted.
A: Formally, to have an inverse you have to be both injective and surjective.
However, sometimes papers speaks about inverses of injective functions that are not necessarily surjective on the natural domain. The point is that the authors implicitly uses the fact that every function is surjective on its image.
Let $f:X\rightarrow Y$ be an injective map. Then you can consider the same map, with the range $Y':=\text{range}(f)$. Then $f:X\rightarrow Y'$ is now a bijective and therefore it has an inverse.
If for instance you consider the functions $\sin(x) : [0,\pi) \rightarrow \mathbb{R}$ then it is injective but not surjective. However the image is $[-1,1]$ and therefore it is surjective on its image. In other words the map $\sin(x):[0,\pi)\rightarrow [-1,1]$ is now a bijection and therefore it has an inverse.
So this is how you can define the $\arcsin$ for instance (though for $\arcsin$ you may want the domain to be $[-\frac{\pi}{2},\frac{\pi}{2})$ instead I believe)
A: This is a reasonable thing to be confused about since the terminology reveals an inconsistency between the way computer-scientists talk about functions, pure mathematicians talk about functions,  and engineers talk about functions. 
First, as you say, there's no way the normal $\sin$ function
$$
\sin: \mathbb{R} \to \mathbb{R}
$$
whose graph is the wave could ever have an inverse. It's not injective and so there would be no logical way to define the inverse; should $\sin^{-1}(0) = 0$ or $2\pi$? 
Second, as you note, the restriction function
$$
\sin|_{\big[-\frac{\pi}{2}, \frac{\pi}{2}\big]}: \big[-\frac{\pi}{2}, \frac{\pi}{2}\big] \to \mathbb{R}
$$
is injective. So that logical problem goes away. But there's still the problem that it fails to be surjective, e.g. even after we restrict, it doesn't make sense to ask what the inverse value is at $17$ since no value of the domain maps to $17$. 
So we can calculate the range of the sine function, namely the interval $[-1, 1]$, and then define a third function:
$$
\sin^*: \big[-\frac{\pi}{2}, \frac{\pi}{2}\big] \to [-1, 1].
$$
Now this function is bijective and can be inverted. The inverse is conventionally called $\arcsin$. Some people call the inverse $\sin^{-1}$, but this convention is confusing and should be dropped (both because it falsely implies the usual sine function is invertible and because of the inconsistency with the notation $\sin^2(x)$).
Notice that at each step, we gave the function a new name, $\sin|_{\big[-\frac{\pi}{2}, \frac{\pi}{2}\big]}$ and then $\sin^*$ (the former convention is standard in math and the latter was made up for this exposition). This is something that, if we were being extremely literal (for example, maybe if we were writing code that tried to compare two different functions), we would always do. It emphasizes the way we think about functions: the "domain" and "codomain" of a function are part of the data of the function, so a restriction is a different function because we've changed the domain (and dually, if we calculate that the range of the function is smaller than the given codomain, it means we can define a new function with the smaller set as its codomain, and that new function won't literally be the same as our old function even though its values are the same). 
This is the kind of thing that engineers don't do for the most part (because the distinction rarely matters and it's confusing to have to introduce a ton of symbols to describe what is, from a calculation standpoint, the same thing), logicians/computer scientists do frequently (because these distinctions always matter in those fields) and most mathematicians do only when there is cause for confusion (so we did it above, since we were clarifying exactly this point -- but in casual usage we would not speak of this $\sin^*$ function, most likely).
