Q and least-upper boundary.

Hi guys. I'm apprently stuck on the basics of the analysis. On the proof that Q lacks least upper boundary property to be precise.
The example I have uses a set A (p in Q | p > 0, p^2 < 2)
then q is defined as [tex]p - \frac{p^{2} - 2}{p + 2}[/tex] . Then they show that if p is in A then q is in A too and p < q and so on. All very simple.
What I can't understand is where the expression for q comes from - logically: why p2 - 2 and over p + 2. I see it works, but I need to know why :)

Hidden in the question: What you have is a sequence that converges monotonically to your desired limit point (square root of 2). When trying to find these things, defined recursively by

xn+1 = f(xn) where f is a continuous function

The key point is to notice that if x is your limit point, then it must be x=f(x). So you just start playing around with expressions that are fixed in the correct place until you find one that works. The equation that you're given was probably found in a similar manner, as opposed to someone deriving it from first principles as a sequence that would work