# Prove irrational number, Rudin's first example in Principles of Mathematical Analysis

I have started reading Rudin's Principles of Mathematical Analysis and got stuck at the first example...

How does Rudin get $q=p-\frac{p^2-2}{p+2}$, how does he get the second step later? I really don't understand this second part of the example and I don't want to go through the book by just memorizing, but with understanding. Can you prove this way also for other irrational numbers?

• His proof ends with "Hence (1) is impossible for rational $p$". The next part looks to me like commentary as you could for example say the same sort of thing comparing $p^2$ with $4$ and having $q=p-\frac{p^2-4}{p+4}$; the only difference is that there would now be a rational $p=\sqrt{4}$ neither in $A$ nor in $B$, which there was not when comparing $p^2$ with $2$ (and would not be comparing $p^2$ with $3,5,$ etc. – Henry Jul 29 '18 at 20:37
• So do you think that I should memorize this formula and use it if a similar problem needs to be proved? – Bili Debili Jul 29 '18 at 20:43
• I would not: I would remember that a formula for approaching $\sqrt{2}$ on the rationals exists but not memorise the precise formula. The key point here is the first part, and it is worth being able to reproduce that part of the proof and to be able to apply it to other non-squares – Henry Jul 29 '18 at 20:52
• Similar topic math.stackexchange.com/questions/2069310/… ... – rtybase Jul 29 '18 at 21:09

What Rudin is after is to choose $q=p+\epsilon$, such that $\epsilon >0$, $q^2<2$ and $q$ is rational. This way he will have a $q>p$ and also have $q \in A$ (similar treatment can be done for $B$). So he wants $q^2-2 <0$. This gives a quadratic inequality $\epsilon^2+2p\epsilon +(p^2-2)<0$. The quadratic equation $\epsilon^2+2p\epsilon +(p^2-2)=0$ has two roots namely, $-p+\sqrt{2}$ and $-p-\sqrt{2}$, with former being a positive root.
So Rudin's job was to pick a number $\epsilon \in (0,-p+\sqrt{2})$ range that satisfies all the requirements stated above. The biggest hurdle is to get $\epsilon$ such that $q$ is rational. So he went for a simple trick (which I believe he would have borrowed from continued fraction expansion for $\sqrt{2}$) to write this $\epsilon$ in the form of $\epsilon=(2-p^2)x$ and then choose $x$ wisely.
He went for a simple choice for $x$ in the form of $x=\frac{1}{p+k}$, where $k$ is any integer greater than or equal to $2$. And Rudin picked $k=2$!!