Counting injective functions with certain restrictions

combinatoricsdiscrete mathematicssolution-verification

I have an exam tomorrow in a course that unfortunately I hadn't been able to attend the classes for. A worksheet for preparation was uploaded but the TAs said no solutions would be available so I don't know if my solution is right. The problem is as follows:

Let $X=\{a,b,c\}$ and $Y=[7]$. How many injective function $f:X\rightarrow Y$ are there such that $$f(a)\neq1,\space f(a)\neq2,\space f(b)\neq2\space, f(c)\neq3$$

At first I thought maybe I should use the Inclusion-Exclusion principle but it got a bit messy. I tried to use cases and it was just as annoying. I then thought of a way to reduce the problem but I'm not sure if I'm losing the the generality of the question. This is the attempt:

We first note that $$f(a)\in\{3,4,5,6,7\}$$ this is a set of $5$ elements. Then $$f(b)\in\{1,3,4,5,6,7\}-\{f(a)\}$$ which is again a set of $5$ elements. Then we count the options for $f(c)$ without restrictions, we see $$f(c)\in[7]-\{f(a),f(b)\}$$ which is again a set of $5$ elements. So without restricting $f(c)$ the number of surjective functions are $5^3=120$. We now count the number of functions such that $f(c )=3$: If we already determined $f(c )$ then $f(a),f(b)$ have each $4$ options so there are $4^2=16$ such functions, we deduce the number of injective functions $f:X\rightarrow Y$ is $120-16=104$.

Is this solution right? is it valid? It kind of feels wrong so I'd really appreciate seeing other solutions and approaches. Thank you!

Best Answer

The answer (as originally written) was $0$. Since $X$ has only three elements, while $Y$ has $7,$ no surjection $X\to Y$ exists.

Your solution instead seems to be counting the injective functions $X\to Y,$ and does so well!

Related Question