First I will say that the exact same question has been uploaded to the site already few years ago but it seems no final answer were given there. Let
$$X = \{a,b,c\}, \quad Y = \{1,2,3,4,5,6,7\}.$$
I need to count how many injective functions $f: X\to Y$ there are such that $$f(a)\ne 1,2,\quad f(b)\ne 2 ,\quad f(c) \ne 3.$$
My instictive approach to this was counting all the injective functions $X\to Y$ without restrictions which is $7 \cdot 6 \cdot 5 = 210$ and subtracting from this the amount of "illegal" functions. My issue is counting the illegal functions Intried to use inclusion exclusion since $f(a)$ and $f(b)$ share a restriction but I reached a dead end.
Is there a simpler way to approach this question?
First of all, we can interpret this problem as a rook polynomial problem. Indeed, imagine a board with $3$ columns and $7$ rows. Since $f$ is injective, their number is equal to the number of ways to put $3$ rooks on the board so that they don’t beat each other. For example, the function $$f(a)=3,\; f(b)=7, \;f(c)=1$$ corresponds to the arrangement of rooks on squares $a3,$ $b7$ and $c1.$ Four squares are forbidden: $a1,$ $a2,$ $b2,$ $c3.$ You can calculate the rook polynomial of this board with restrictions by hand or using the rook polynomial calculator.
If we put the rooks aside, here is the calculation with the inclusion-exclusion principle. There are $7\cdot6\cdot5$ injective functions without any restrictions. Indeed, we can choose any of the $7$ possible values for $f(a),$ for $f(b),$ and for $f(c).$
Let us subtract all the combinations where a forbidden value occurred. There are $6\cdot5$ functions with $f(a)=1$, since $f(b)$ is any of the $6$ values $2,3,4,5,6,7$, and $f(c)$ is any of the rest $5$ values. Same if $f(a)=2$, or $f(b)=2$, or $f(c)=3$. So currently, the answer looks like $$7\cdot6\cdot5-4\cdot(6\cdot5).$$
Now, according to the inclusion-exclusion principle, we should add the combinations where $2$ forbidden values occurred. There are $4$ pairs of forbidden values: $$f(a)=1,\; f(b)=2,$$ $$f(a)=1, \;f(c)=3,$$ $$f(a)=2,\; f(c)=3,$$ $$f(b)=2,\; f(c)=3.$$
Then there are $5$ ways to complete $f$. Hence the current answer is $$7\cdot6\cdot5-4\cdot(6\cdot5)+4\cdot5.$$
Now, there is obviously only one combination where all $3$ forbidden values occurred: $$f(a)=1,\;f(b)=2,\;f(c)=3.$$
So the final answer is $$7\cdot6\cdot5-4\cdot(6\cdot5)+4\cdot5-1=\color{red}{109}.$$