TITLE: number of functions >$g:\{1,2,3\}\rightarrow \{1,2,3\}$ such that $f(x)=g(x)$ least one $x\in\{1,2,3\}$
QUESTION [5 upvotes]: Let $f:\left\{1,2,3\right\}\rightarrow \left\{1,2,3\right\}$ be a function. Then the number of functions
$g:\{1,2,3\}\rightarrow \{1,2,3\}$ such that $f(x)=g(x)$ for at least one $x\in\{1,2,3\}$.

$\bf{Options}::$ $(a)\;\;\; 11\;\;\;\;\; (b)\;\;\; 19\;\;\;\;\; (c)\;\;\; 23\;\;\;\;\; (d)\;\; 27$
$\bf{My\; Try::}$ If $f:A=\{1,2,3\}\rightarrow B= \{1,2,3\}\;,$
Then Total number of function from $A$ to $B $ is $ = 3^3 = 27.$
Now I did not understand How can I proceed further
Help Required, Thanks

REPLY [3 votes]: As you said,the total number of functions $g:A \rightarrow B$ is 27. Count the funtions that do not satisfy your requirements,that is count how many $g:A \rightarrow B$ such that $g(x) \neq f(x) \forall x \in A$. It is easy to see that you have for every $i \in \{1,2,3\}$ 2 choices for $g(i)$: the two numbers that are different from $f(i)$. Then you have $2^3$ functions g not satisfying the condition and $27-8=19$ correct functions.