The function $f:\mathbb R\to\mathbb R$ given by $f(c) = 6x + 2$ is one-to-one because $$\begin{align} f(x_1) &= f(x_2) \\ \implies 6x_1 + 2 &= 6x_2 + 2 \\ \implies 6x_1 &= 6x_2 \\ \implies x_1 &= x_2. \end{align}$$
I understand that a one-to-one function is a function in which for each $y$ in the range of $f$, there is only one $x$ such that $f(x) = y$.
I understand that when you map out $f(x) = 6x + 2$, you get a linear equation when each value of $x$ corresponds to a unique $y$ value.
But this notation is really confusing me: $f(x_1) = f(x_2)$
If $f(x_1)$ and $f(x_2)$ are equal to each other then aren't they are pointing to the same $y$ value, so doesn't that contradict being one-to-one?
What exactly are they talking about when they refer to $x_1$ and $x_2$?
You understand that with a one-to-one function, for each $y$ there can be only one $x$ so that $f(x)=y.$ How do we check to see whether there really is only one $x$ so $f(x)=y$?
One way is to suppose $f(a)=y$ and $f(b)=y$ for some $a$ and $b$. If the function really is one-to-one, then $a$ must equal $b$. This is again, because only one value gets sent to $y$.
Your book is using $x_1$ and $x_2$ for variable names, instead of $a$ and $b$, but the idea is the same.