Question about chromatic polynomial of certain graphs. I don't know how to draw graphs here, but my question is about rather simple graphs. First of all, consider the triangle graph, i.e the graph with 3 vertices and 3 edges that form a triangle. Now, vertex $a$ can be colored in $\lambda$ different ways (we have $\lambda$ different colors), but vertex $b$ in $\lambda -1$ different ways. The last vertex, $c$, can then be colored in $\lambda-2$ different ways. Hence the chromatic polynomial is $P=\lambda(\lambda-1)(\lambda-2)$. So far, so good.
However, now consider the square, i.e the graph $4$ vertices and $4$ edges that form a square. Vertex $a$ has $\lambda$ different colorings, $b$ has $\lambda-1$, vertex $c$ has also $\lambda-1$ but the last vertex, connected to both vertex $a$ and $c$ must have $\lambda-2$ different colorings. Hence, the chromatic polynomial $P=\lambda(\lambda-1)^2(\lambda-2)$. According to my book, the chromatic polynomial is $P=\lambda^4 -4\lambda^3+6\lambda^2-3\lambda$, and I simply can't see what mistake I have done, where is the fault in my reasoning?
 A: Let the vertices of the 4-cycle be $(a,b,c,d)$ adjacent in the natural way. You correctly assumed that $a$ can be colored with $\lambda$ colors and there are $\lambda-1$ choices to color $a$ and $b$. But now you have to consider two cases. If $b$ and $c$ are colored with the same color there are actually $\lambda-1$ colors to color $d$. Can you take it from there?
A: In Example 3.5 (1) of Deletion-contraction and chromatic polynomials, Steven Sam explains this nicely:

If we want to properly k-color G, then 1
  can be colored anything, so there are k choices for it. Now the color on 2 and 4 have
  to be different from the color assigned to 1, so there are k−1 choices for each. There
  are two cases to consider: if the colors of 2 and 4 are the same, then the color for 3
  has k − 1 choices. If they’re not the same, then the color for 3 has k − 2 choices. So
  the total number of colorings is: $k(k−1)^2 + k(k−1)(k−2)^2$.
  (The first term counts the number of colorings where 2 and 4 have the same color and the second counts the number of colorings where 2 and 4 have different colors.) We can simplify it to get
  $\chi_G(k) = k(k − 1)(k^2 − 3k + 3)$

Note that $λ^4 − 4λ^3 + 6λ^2 − 3λ = λ(λ − 1)(λ^2 − 3λ + 3)$
