I am hanging ten paintings in a nice straight line. I don't want the Van Gogh to hang next to the DaVinci. I don't want the DaVinci to hang next to the Warhol. In how many ways can I hang my paintings?
I am thinking 10! ways to hang the paintings. 9! ways Van Gogh next to DaVinvi. 9! ways to hang the Davinci next to the Warhol.
So I'm thinking 10!-9!-9!, but what do I need to add to account for the duplicates I subtracted?
There are actually $2\times 9!$ ways you can hang the Van Gogh by the DaVinci and $2\times9!$ ways to hang the DaVinci by the Warhol, so your starting point is $10!-4\cdot9!$. But this double-counts the $2\times8!$ ways you can have the DaVinci between the Van Gogh and the Warhol. So the proper count is $10!-4\cdot9!+2\cdot8!$.
(Note, blf gave essentially the same answer in a comment while I was composing this.)