I am reading about functions in the textbook "Discrete Mathematical Structures" by Kolman et.al. They have given in an example that \begin{equation} A=\{1,2,3\} \quad\text{and}\quad B=\{x,y,z\} \end{equation}
Then $R=\{(1,x),(2,x)\}$ is a function.
But a google search revealed that this is not a function since 3 is not involved.
Whether the book is wrong or I got something wrong
At least in the third edition of Kolman et al., function is defined as follows:
This obviously depends on some prior definitions and conventions relating to relations. They define a relation $R$ from $A$ to $B$ in the usual way, as a subset of $A\times B$, and immediately introduce the notation $a\,R\,b$. The domain of $R$ is then defined (in words) to be $$\operatorname{Dom}(R)=\left\{a\in A:\exists b\in B\big(a\,R\,b\big)\right\}\;,$$ and examples make it clear that $\operatorname{Dom}(R)$ need not be all of $A$. Finally, for $a\in A$ they define $R(a)=\{b\in B:a\,R\,b\}$.
If $A=\{1,2,3\}$, $B=\{x,y,z\}$, and $R=\{\langle 1,x\rangle,\langle 2,x\rangle\}$, then certainly $R\subseteq A\times B$, so $R$ is a relation from $A$ to $B$. $\operatorname{Dom}(R)=\{1,2\}$, $R(1)=\{x\}$, and $R(2)=\{x\}$, so it’s true that $f(a)$ contains just one element of $B$ for each $a\in\operatorname{Dom}(R)$. Thus, $R$ does indeed satisfy their definition of function from $A$ to $B$.
However, what they call a function from $A$ to $B$ is more commonly called a partial function from $A$ to $B$, i.e., a function from a subset of $A$ to $B$. Many people reserve the term function from $A$ to $B$ for total functions from $A$ to $B$, i.e., functions whose domain is all of $A$.