My question is: Given sets $A$ = {$a_1, a_2$} and B = {$b_1$}, let the function $f$ from $A$ to $B$ be given by the following set of ordered pairs, $f$ = { ($a_1, b_1$), ($a_2, b_1$) }. If $f$ has an inverse function, call it $g$, and write $g$ as a set of ordered pairs. If $f$ does not have an inverse function, explain why it doesn’t.
I was thinking that there cannot be an inverse function because the domain of the inverse function, $g$ = {($b_1, a_1$), ($b_1, a_2$)}, is $b_1$, which is the same and is pointing to different ranges. For a function to exist the domain has to be unique correct?
Your reasoning is basically correct (you need to assume $a_1\neq a_2$ though!)
Your wording is a little bit off though, I believe. The range is the set of all possible values a function has. A single value (like $a_1$ or $a_2$) is just called, well, a value. For example, the range of $f$ is $B$. The domain of a function is again a set: the set of all possible "inputs". In your case, the domain of $f$ is $A$. Calling $g$ an inverse function is a bit troublesome, since it is of course not a function. You can call $g$ the inverse relation of $f$. The convention "Function = Graph" makes every function surjective (onto) by default. So eventually, you want to define functions in the following way: $$f = (A, \{ (a_1,b_1),(a_2,b_1) \}, B)$$ or similarly. Here $f$ is surjective so it does not actually make a difference, but if you had $B = \{b_1,b_2\}$ with $b_1\neq b_2$ it would matter.
Here is a more common way to prove your statement:
If $f$ has an inverse, then $f$ is bijective, hence injective (one-to-one), but $f(a_1)=f(a_2)$ even though $a_1\neq a_2$ (Contradiction).