Choosing a permutation of 10 digits 0,1,....9 in which Choosing a permutation of 10 digits 0,1,....9 in which 5 is not in the first position amd 9 is not in the last position? 
Soln:  What I wrote as an answer was: $$(9)(9)(8!)$$
but the answer in the back of the book says: $$[(1)(9)(8!) + (8)(8)(8!)]$$
I have no idea how could this come about.  If a 5 cannot be in the first position there are still 9 other choices,  same with the last position.  So why the difference?  what did i fail to consider? 
 A: They broke it up into cases.
Case (i): $9$ is in the first position. Then the rest can be arranged in $9!$ ways.
Case (ii): Something else is in the first position. It can be any of $8$. anything but $5$ or $9$. Then the last position can be filled in $8$ ways, for we must avoid $9$, and the rest filled in $8!$ ways.
Another way: We do the counting in another way that however does not answer your question. There are $10!$ permutations. We count and subtract the bad ones, where there is a $5$ at the beginning, or a $9$ at the end, or both. There are $9!$ with $5$ at the beginning, and the same number with $9$ at the end. But $9!+9!$ double counts the $8!$ permutations that have $5$ at the beginning and $9$ at the end. Thus there are $2\cdot 9!-8!$ bad permutations, and therefore $10!-2\cdot 9!+8!$ good ones.
A: There are 9 choices for the first place.  1 of those is 9.  8 of them are not 9.  If it is 9 there are are nine possible choices choices for the last place.  That's 1*9 possible ways to get the first position and the last position if the first position is 9.
If the first term is not 9 there are 8 possible choices for the last place (anything that isn't a 9 and isn't what the first position was).  The 9*8 ways to get the first position and the last position if the first position is not 9.
So in total there are [1*9 + 9*8] possible ways to get the first and last positions. (9 where the first position is "9"; 9*8 where it is not).
Then there are 8! for the remaining 8 positions.
In total there are  [1*9 + 9*8]8! possibilities.
