So the answer in the back of the book is for all n 2(n-1) possible functions. so when n is 1 according to the equation their are zero solutions which I agree with it is just when n>1 I can't account for the extra possible functions.

suppose n=4

I know that I have n-1 possible options (1,2,3) in this case can be assigned to 1 because 4=n and 1 can be only assigned to less than n. where I get lost is when 1 is assigned 1 the rest have to be zero, and when 2 is assigned 1 the rest have to be zero, and finally when 3 is assigned 1 the rest have to be zero. in the end I end up with 3 possible functions when the back of the book says 2(n-1).

according to another source other than my book the reasoning is

IF 1 is assigned to only one element in

A, then 0 has to be assigned to all the remaining n-2 elements in the case less than n.

whereas in the case of n , there will be n functions from A to B.

so in total there will be (n-2)+ n =2n-2 functions( I don't follow this reasoning if this is correct can someone explain this)