TITLE: Books that develop ideas through tough problems?
QUESTION [5 upvotes]: I want examples of books that advance by first posting a hard problem, one that would be very difficult without a given idea and then proves this idea and the power of the idea by solving the problem. I would be very interested in reading a book like this because it makes the power of ideas very evident and it gives the reader a sense of empowerment as he learn these techniques.
I'm currently in need for a book on combinatorics like this, but any area would be appreciated.

REPLY [4 votes]: A beautiful number-theoretical example is David Cox's book Primes of the form $x^2 + n y^2.$ Below is an excerpt from the introduction.

Most first courses in number theory or abstract algebra prove a theorem of 
Fermat which states that for an odd prime p, 
$$ p = x^2 + y^2,\ x,y \in \Bbb Z \iff  p \equiv 1 \pmod 4.$$
This is only the first of many related results that appear in Fermat's works. 
For example, Fermat also states that if p is an odd prime, then 
$$\begin{eqnarray} p = x^2 + 2y^2,\ x,y \in \Bbb Z &\iff& p \equiv  1,3 \pmod 8 \\
\\
p = x^2 + 3y^2,\ x,y \in \Bbb Z &\iff&  p \equiv 3\ \ {\rm or}\ \ p \equiv 1 \pmod 3.\end{eqnarray} $$
These facts are lovely in their own right, but they also make one curious 
to know what happens for primes of the form $x^2 + 5y^2,\ x^2 + 6y^2,$ etc. This 
leads to the basic question of the whole book, which we formulate as  follows: 
Basic Question 0.1. $\ $ Given a positive integer $n,$ which primes $p$ can be expressed in the form 
$$ p = x^2 + n y^2 $$
where $x$ and $y$ are integers? 
We will answer this question completely, and along the way we will  encounter some remarkably rich areas of number theory. The first steps will 
be easy, involving only quadratic reciprocity and the elementary theory of 
quadratic forms in two variables over $\Bbb Z.$ These methods work nicely in the 
special cases considered above by Fermat. Using genus theory and cubic 
and biquadratic reciprocity, we can treat some more cases, but elementary 
methods fail to solve the problem in general. To proceed further, we need 
class field theory. This provides an abstract solution to the problem, but 
doesn't give explicit criteria for a particular choice of $n$ in $x^2 + n y^2.$
The final step uses modular functions and complex multiplication to show that 
for a given n, there is an algorithm for answering our question of when 
$ p = x^2 + n y^2.$