Do binary operations need to be surjective functions?
Let $\star$ be a binary operation on the set $S=[0,1]$ defined to be $$\star : [0,1] \times [0,1] \to [0,1] $$
$$\text{where } a \star b = \text{min}\left(\frac12 a , \frac12 b\right) $$
From observation we can see that the set $S$ is closed under $\star$ and that each ordered pair $(a,b)$ is mapped to only one element in $S$.
For example, $1 \star 0.3 = 0.15$
But we also don't have every element in the codomain being hit. There doesn't exist any $(a,b) \in S^2$ such that $a \star b = 0.75$, for example.
Does this cause a problem at all? Is $\star$ still considered a binary operation on $S$? In class we were told all binary operations were surjective, but the textbook for the class states no such thing. And if it is not a problem, I am wondering if there are any more complicated or "elegant" examples. I am interested to see them if they are.
Thanks for any clarification on my confusion.
Solution 1:
Binary operations do not need to be surjective. Here is a natural example:
Let $\mathbb N = \{1,2,3,\dots \}$. Then $+: \mathbb N \times \mathbb N \to \mathbb N$ is not surjective because $1$ is not in the image.
Here is another natural, more interesting example:
Let $\mathbb N' = \{2,3,\dots \}$. Then $\times: \mathbb N' \times \mathbb N' \to \mathbb N'$ is not surjective because the prime numbers are not in the image.
Solution 2:
In general binary operations are not surjective.
Note that, say, for some set $S$ and a fixed $s \in S$ the operation given by $a \times b = s$ for all $a,b \in S$ is a binary operation.
Just binary operation means really little. It's literally just a function from $S\times S$ to $S$.
However, if the binary relation has an identity element (or just a left-identity or a right-identity would also suffice), then it can be directly seen that it is surjective. This may or may not be the reason for the discrepancy you observed. It also explains why not few of the most common binary operations are in fact surjective (they have an identity), and further shows a way how to construct some somewhat natural ones that don't.
Note that in the two examples in lhf's answer they judiciously avoided to have the respective natural neutral element in the set.
Let me add some more examples:
The reals greater than $0.5$ with addition. This also works for the reals greater than $t$ for any fixed positive $t$, yet not for the positive reals.
The reals in the interval $[-0.5,0.5]$ with multiplication (works for any closed interval, even non-symmetric ones in $(-1,1)$ yet not for $(-1,1)$ itself).
The reals or also the complex numbers with absolute value greater than $2$ with multiplication (works for greater than $t$ for any fixed $t > 1$, yet not for greater than $1$).
The $n \times n$ (real) matrices with determinant greater than $2$ (works for any fixed $t>1$).
Solution 3:
I'll give a simple non-fancy example. Consider $f : \mathbb{R}^2 \to \mathbb{R}$ defined by $$f(x, y) = 0$$ think of this function as assigning the value $0$ to every point on the plane. Certainly $f$ is a binary operation, but it's as non-surjective as such a function can get.