Does a 15-puzzle always have a solution 
For those that are not familiar with (this type of) sliding puzzles, basically you have a number of tiles on a board equal to (n * m) - 1 (possibly more holes if you want). The goal is to re-arrange the tiles in such a way that solves the puzzle.
The puzzle could be anything, from number games to images.
While writing a small app for this, I found that if I were to initialize the puzzle by randomly shuffle all of the pieces, I could end up in a situation where there is no solution if my puzzle was 2x2.
So the problem I have is: given a sliding puzzle with n-by-m dimensions, is there always a solution if there are a sufficient number of tiles (eg: a 3x3 board)? How would I even begin to prove this, or simply convince myself that it is the case?
If it is possible that a random shuffle could result in no-solution, then I'd have to figure out how to verify that there exists a solution, which is a completely different beast.
 A: Martin Gardner had a very good writeup on the 14-15 puzzle in one of his Mathematical Games books.
Sam Loyd invented the puzzle.  He periodically posted rewards for solutions to certain starting configurations.  None of those rewards were claimed.
Much analysis was expended, and it was finally determined, through a parity argument (as mentioned in the comment above), that half of the possible starting configurations were unsolvable.  Interestingly, ALL of Loyd's reward configurations were unsolvable.
SO: No, every possible configuration is not solvable.  If you START with a solved puzzle, and apply only legal transformations (moves) to it, you always wind up at a solvable configuration.
For the GENERAL nxm question, you'd probably have to expand the parity argument.
A: Just a hint. Once I had to show with basic algebra (permutation groups) that a standard $15$ puzzle had no solution. The idea there was the following:
to rearrange the puzzle, you have to perform a permutation of the $15$ tiles.
Now, notice that once you write any permutation allowed, it is written as a product of an even number of $2$-cycles (you always move the "empty" tile, it starts in the corner and it has to be still there at the end of your moves). Hence permutation with sign $-1$ are not allowed.
In my case it was enough to conclude the puzzle had no solution (I had to perform an exchange between two tiles, so it had sign $-1$). Maybe it can help you to exclude some configurations.
A: The solvability of an n puzzle can be tested after shuffling by computing the permutations of the puzzle. "While odd permutations of the puzzle are impossible to solve, all even permutations are solvable."
For the math behind this, please see http://mathworld.wolfram.com/15Puzzle.html
A: Yes, it will always have a solution as long as you start with a good solution and then make legal moves to randomize the tiles.
BUT if you, for example, pop two pieces out and switch them, then you can get an insolvable puzzle. ;) As you discovered.
A: Here, we consider the following problem:
For a given position on the board to say whether there is a sequence of moves leading to a decision or not.
Let there be given a position on the board:
+------------------+.  
| 11 | 15 | 2 | 13 |.  
|----|----|---|----|.  
| 14 | 1  | 8 | 3  |.  
|----|----|---|----|.  
| 7  | 6  | 0 | 10 |.  
|----|----|---|----|.  
| 4  | 12 | 9 | 5  |.  
+------------------+.

wherein one of the elements is zero and indicates an empty cell.
Consider the numbers in the matrix serially (rowwise):  
11 12 2 13 14 1 8 3 7 6 0 10 4 12 9 5

Denote N - the number of inversions in the permutation (i.e. the number of such elements a[i] and a[j] that i < j but a[i] > a[j]).
Next, let K- line number in which there is an empty element (i.e. in our notation K = 3).
Then, a solution exists if and only if N + K is even.
