Simple (not for me) combinatorics question There are four balls of different colors, and four boxes of colors, same as those of the balls.What are the number of ways, in which, the balls, one each in a box, could be placed, such that a ball does not go to a box of its own color. 
I name the balls A,B,C,D.
Correspondingly, I name the boxes A,B,C,D.
(i) Now starting with ball A, I could select one of the boxes B,C,D in 3 different ways.
(ii) Let, I put ball A in box B.
(iii) Moving onto ball B, I could select one of A,C,D in 3 different ways. 
(iv) Let, I put ball B in box C.
(v) As, no ball goes into corresponding box, ball C must be put in box D, ball D must be put in box A. Number of ways to do this is 1
So, total no. of ways=3 x 3 x 1 = 9
9 is the answer given in my book (not the process, this is an exercise problem, even  no hints given).
But now, consider the following case
(i) Starting with ball A, I could select one of the boxes B,C,D in 3 different ways.
(ii) Let, I put ball A in box B.
(iii) Moving onto ball C, I could select one of A,D in 2 different ways (as ball C cannot go to box C). 
(iv) Let, I put ball C in box D.
(v) Then I select ball B; it could be put in either of the boxes A,C in 2 different    ways. Let it be C.
(vi) Lastly, ball D could be put in box A, in only 1 way.
So, total no. of ways=3 x 2 x 2 x 1 = 12
Two different answers---something (I don't know what) should be wrong in the second solution.

Your first method is not too far off, but it's not right at the moment.
There are three boxes we could put A in, and they're all equivalent. Let's say we choose B.
Now there are three boxes we can put B in, but they're not all equivalent. We can either put it in box A, or one of the others (say C). If we put B in A, there is only one possibility for the rest (C must go in D and vice versa). If we put B in C, there is again only one possibility for the rest (D must go in A, and so C must go in D).
This gives the answer as $3\times(1\times 1+2\times 1)=9$. However, the fact that we get the same number of possibilities no matter where we put B is just a fluke, and doesn't happen for larger numbers of objects.
Generalising this approach can give you the recurrence relation $D_n=(n-1)(D_{n-2}+D_{n-1})$.
