Inclusion-Exclusion PrincipleRemove cases where at least one bag is empty: $|A_1\cup A_2\cup A_3|=\sum|A_i|-\sum|A_i\cap A_j|+|A_1\cap A_2\cap A_3|=48-3+0=45$. Answer $=81-45=36$.
Partition Type (2,1,1)For 4 books in 3 bags with no empty bag, exactly one bag gets 2 books. Ways: choose 2 books ($\binom{4}{2}=6$) × assign to a bag ($3$) × distribute remaining ($2!$) $=36$.
Stirling Number Approach$S(4,3)=6$ (Stirling number of second kind = ways to partition 4 elements into 3 non-empty unlabelled groups). Multiply by $3!=6$ to label the bags: $6\times6=36$.
Why 3^4 for total?Without restriction, each of 4 books independently chooses 1 of 3 bags: $3\times3\times3\times3=81$. This counts ALL distributions including those with empty bags.