Analytic method for determining if a function is one-to-one In algebra, we learn that if a function $ f(x) $ has a one-to-one mapping, then we can find the inverse function $ f^{-1}(x) $. The method that I have seen taught is the "horizontal line test": if any horizontal line touches the graph of the function more than once, then it must not be one-to-one. This method is not exactly rigorous, since any function with a non-finite range can not be completely viewed on a graph. 
Is there an analytic method to determine if a function is one-to-one? Is this possible in elementary algebra or calculus?
 A: A function is invertible if and only if it is bijective, that is surjective (onto) and injective (one-to-one), so your statement is not correct.
If you want to determine that if a function is injective, you assume $f(x) = f(y)$ and derive $x = y$, alternatively you can assume $x \neq y$ and show that $f(x) \neq f(y)$.
Now, if you have a linear function $f$, then we see that we need to show that if $f(x) = f(y)$ we have that $f(x - y) = 0$, so in other words we need to show that $f(x) = 0$ implies $x = 0$. This is usually easier.
In the case you want to show a function is bijective (and hence invertible) you first show that it is injective and then that if $f: X \to Y$ that for every $y \in Y$ you can find an $x \in X$ such that $f(x) = y$.
A: First, let me answer your question; but please keep reading, because there's lots more to say.
Yes: there is an analytic way to see if a function is one-to-one. For this, you need the "analytic definition" of being one-to-one. The definition is:
$$f\text{ is one-to-one if and only if for all }a,b\text{ if }a\neq b\text{ then } f(a)\neq f(b).$$
Logically, this is equivalent to:
$$f\text{ is one-to-one if and only if for all }a,b\text{ if }f(a)=f(b)\text{ then }a=b.$$
So this provides a way to check if the function is one-to-one: if you can find $a\neq b$ such that $f(a)=f(b)$, then $f$ is not one-to-one; and this is essentially the best way of doing it: exhibit a pair of distinct numbers that map to the same thing. To prove that $\sin(x)$ is not one-to-one, all I need to do is say: "Look, $0$ and $\pi$ are different, but $\sin(0)=\sin(\pi)$."
To prove that a function is one-to-one, you can do it in any of two (equivalent) ways: show that if $a$ and $b$ are any numbers with the property that $f(a)=f(b)$, then it must be the case that $a=b$; or show that if $a\neq b$, then $f(a)$ must be different from $f(b)$.
For instance, to show that $f(x)=x^3$ is one to one, we can note that if $f(a)=f(b)$, then $a^3=b^3$, and taking cubic roots we conclude that $a=\sqrt[3]{a^3} = \sqrt[3]{b^3} = b$. So if $f(a)=f(b)$, then $a=b$. QED. 
Or we can argue that if $a\neq b$, then either $a\lt b$ or $a\gt b$. If $a\lt b$, then $a^3\lt b^3$ (you can prove this easily using the properties of real numbers and inequalities), so $f(a)\neq f(b)$. If $a\gt b$, then $f(a)=a^3\gt b^3=f(b)$, hence $f(a)\neq f(b)$. Either way, $a\neq b$ implies $f(a)\neq f(b)$, so $f$ is one-to-one.
This is the standard way of showing, analytically, that a function is one-to-one. How one establishes the implication will depend on the function.
That said, there are some things you may want to remember:
First: to specify a function, we usually need to specify at least two things: the domain of the function, and the value of the function at any point in the domain. 
More often, we are interested in functions between two specific sets. In that case, we actually need to specify three things: the domain, the set in which the images will lie, and the value of the functions at any point of the domain.
So, if we say that we have a function $f\colon X\to Y$ between two sets, then we mean that:


*

*For every $x\in X$, there is an element of $y\in Y$ such that $f(x)=y$; and

*For each $x\in X$, there is only one $y\in Y$ with $f(x)=y$ (unique value).
So, we need every element of $X$ to have a unique image. Different elements of $X$ may have the same image, but a single element should not have multiple images. We call $X$ the domain of $f$, and we call $Y$ the codomain of $f$.
In calculus, however, we are usually a bit sloppy. We almost never mention either the domain or the codomain! Instead, we agree that if we will either specify the domain explicitly, or else we will mean "the natural domain". And we almost never mention the codomain at all.
Now, if you have a function $f\colon X\to Y$, then we say that a function $g\colon Y\to X$ "going the other way" is "the inverse of $f$" if and only if two things happen:


*

*For every $x\in X$, $g(f(x)) = x$  ($g$ "un-does" what $f$ does); and

*For every $y\in Y$, $f(g(y)) = y$  ($f$ "un-does" what $g$ does).


Now, for this to actually work, we need two things:


*

*Given an element $y\in Y$, there can be at most one $x\in X$ such that $y=f(x)$. This is the "one-to-one" condition. If you think in terms of calculus and the graph, it is precisely the "horizontal line test": for each value of $y$ (each horizontal line), there is at most one point in the domain where $f$ takes value $y$ (it cuts the graph in at most one point).


*

*Reason: If you had $x\neq x'$ but with $y=f(x)=f(x')$, then you would need $g(y)=x$ so that $x=g(y)=g(f(x))$, but you would also need $g(y)=x'$ because $x'=g(y) = g(f(x'))$. But a function cannot have two different values at the same point, so this is an impossible situation for $g$. The only way to solve this quandry is for either $g$ not to exist, or for $x$ and $x'$ not to exist. 


*Given any element $y\in Y$, there is at least one $x\in X$ such that $y=f(x)$. This is the "onto" or "surjective" part people have mentioned.


*

*Reason: Since we also want $f(g(y))=y$ for every $y\in Y$, we need there to be an element of $X$, namely $g(y)$, that maps to $y$.



So: if $f\colon X\to Y$ has an inverse, then it must be both one-to-one, and onto the set $Y$. This is necessary. In fact, it is also sufficient, and one can show that if there is an inverse, then there is one and only one inverse, so we call it $f^{-1}$ instead of $g$.
Now, here's the thing: if your function satisfies the first condition (one-to-one), but not the second, then you can "cheat": instead of thinking of $f$ as a function from $X$ to $Y$, we let $Y'=\mathrm{Image}(f)$, and then look at the function $\mathfrak{f}\colon X\to Y'$, with $\mathfrak{f}(x)=f(x)$ for every $x$; the only thing we changed is what we want the set $Y$ to be. This is not really the same as $f$: $\mathfrak{f}$ one is both one-to-one and onto, so $\mathfrak{f}$ does have an inverse, even though $f$ does not.
For instance, if you think of the function $f\colon\mathbb{R}\to \mathbb{R}$ given by $f(x)=e^x$, then $f$ is one-to-one, but is not onto ($f(x)$ does not take negative values). So this function is not invertible. However, if we tweak the function and think of it instead as $\mathfrak{f}\colon\mathbb{R}\to (0,\infty)$, given by $\mathfrak{f}(x)=e^x$, then $\mathfrak{f}$ is onto, is also one-to-one, so $\mathfrak{f}$ is invertible. The inverse is a function $f^{-1}\colon (0,\infty)\to\mathbb{R}$, so the only valid inputs are positive numbers. (You may know who $f^{-1}$ is: it's the natural logarithm). 
Now, notice that to check if a function has an inverse, you need to know both what $X$ and what $Y$ is. But in Calculus we almost never mention $Y$. So what can we do?
Well, we agree that we will take $Y$ to be "the image of $f$"; that is, the collection
$$\{ f(x) \mid x\text{ is in the domain of }f\}.$$
That means that we always "automatically" assume our functions are "onto". We say this by saying that the function is "onto its image". 
Given that agreement, in order to figure out if $f$ has an inverse, we just need to know if $f$ is one-to-one, which is why your calculus book says things like "a function has an inverse if and only if it is one to one, if and only if it passes the horizontal line test." They are referring exclusively to functions whose codomain is always taken to be the image. 
