# Hardy’s Course of Pure Mathematics

A while ago I bought a copy of Hardy’s “A Course of Pure Mathematics” for a fiver. I think I must’ve got it from Westwood Books ((Westwood Books has a really good collection of maths books – one of the owners is an ex-mathematician, and he finds his way to be in just the right place when departments clear out their libraries. I found a book by the only other mathematising Perfect I know of at Westwood. Great place!)) in Sedbergh.

Anyway, my imagination has completely run dry for the moment, so I’ve decided to do some exercises from the book to pass some time. Maybe this could become a series of posts?

Hardy says in the preface,

This book has been designed primarily for the use of first year students at the Universities whose abilities reach or approach something like what is usually described as scholarship standard’.

I regard the book as being really elementary.

Nothing taxing, then. It occurs that I’m opening myself up to accusations of sloppy thinking and gross inaptitude at mathematics, but I suppose I’m better off knowing if that’s the case.

So here we go, Chapter 1, Exercise 1:

1. If $$r$$ and $$s$$ are rational numbers, then $$r+s$$, $$r-s$$, $$rs$$, and $$\frac{r}{s}$$ are rational numbers, unless in the last case $$s = 0$$ (when $$\frac{r}{s}$$ is of course meaningless)

As $$r$$ and $$s$$ are rational, let $$r = \frac{a}{b}$$, and $$s = \frac{c}{d}$$, $$a,b,c,d \in \mathbb{N}$$, $$b,d \gt 0$$. Then,

$r + s = \frac{a}{b} + \frac{c}{d} = \frac{ad}{bd} + \frac{cb}{bd} = \frac{ad+cb}{bd}.$

$$ad+cb$$ and $$bd$$ are integers, so $$r+s$$ is rational. Same idea for $$r-s$$.

$rs = \frac{a}{b} \cdot \frac{c}{d} = \frac{a}{b} \times c \div d = \frac{ac}{bd}.$

$$ac$$ and $$bd$$ are integers, so $$rs$$ is rational.

Now assume $$c \gt 0$$.

$\frac{r}{s} = r \div s = \frac{a}{b} \div \frac{c}{d} = \frac{a}{b} \div c \times d = \frac{ad}{bc}.$

$$ad$$ and $$bc$$ are integers so $$\frac{r}{s}$$ is rational.

2. If $$\lambda$$, $$m$$ and $$n$$ are positive rational numbers, and $$m \gt n$$, then $$\lambda(m^2-n^2)$$, $$2\lambda m n$$, and $$\lambda(m^2+n^2)$$ are positive rational numbers. Hence show how to determine any number of right-angled triangles the lengths of all of whose sides are rational.

Using the facts from part 1, $$m^2$$ and $$n^2$$ are rational numbers, hence $$m^2+n^2$$ and $$m^2-n^2$$ are rational numbers, hence $$\lambda(m^2-n^2)$$, $$2\lambda m n$$, and $$\lambda(m^2+n^2)$$ are rational numbers. So I just need to show that they’re positive.

$$m^2+n^2$$ is positive plus positive, so positive. Hence, $$\lambda(m^2+n^2)$$ is positive times positive, so positive.

$$\lambda m n$$ is all positives multiplied together, so positive.

As $$m \gt n$$, $$m^2 \gt n^2$$. So $$m^2 -n^2$$ is positive, and hence $$\lambda(m^2+n^2)$$ is positive.

Now for the triangles. For any rational numbers $$\lambda$$, $$m$$ and $$n$$, construct a triangle with hypotenuse $$\lambda(m^2+n^2)$$ and one of the other sides $$\lambda(m^2-n^2)$$. I’ve just shown these are both rational. Now, the length $$l$$ of the other side is given by

\begin{align} l^2 = \left( \lambda(m^2+n^2) \right)^2 – \left( \lambda(m^2-n^2) \right)^2 &= \lambda^2(m^4+2m^2n^2+n^4) – \lambda^2(m^4 – 2m^2n^2 +n^4) \\ &= 4\lambda^2m^2n^2 = (2\lambda m n)^2. \end{align}

So $$l = 2\lambda m n$$, which I showed before to be a rational number.

I’m not sure why Hardy felt the need to include $$\lambda$$ here. I suppose to get across that you can scale the triangle by a rational factor and it’ll still have all sides rational.

3. Any terminated decimal represents a rational number whose denominator contains no factors other than $$2$$ or $$5$$. Conversely, any such rational number can be expressed, and in one way only, as a terminated decimal.

Just for kicks, let’s do an induction.

Inductive hypothesis: Let $$x$$ be a terminated decimal. If $$x$$ has a terminated decimal representation with $$n$$ digits after the point, $$10^nx$$ is an integer.

Base case: If $$n = 0$$, $$x$$ is already an integer.

Inductive step: Assume IH true for $$n=k$$. Now suppose we have an $$x = a + 0.x_1x_2x_3 \dots x_{k+1}$$, $$a$$ an integer. Then $$10x = 10a + x_1.x_2x_3 \dots x_{k+1}$$. Let $$d = 10x – 10a$$, so just the fractional part. $$d$$ has $$k$$ digits after the decimal place, so $$10^kd$$ is an integer by the IH.

Hence,

$10^{k+1}x = (10x) \cdot 10^k = (10a + d) \cdot 10^k = 10^{k+1}a +10^kd,$

which is an integer plus an integer, so an integer. So the induction holds for all $$n \geq 0$$.

So, if $$x$$ is a terminated decimal with $$n$$ digits after the decimal place, $$x = \frac{10^nx}{10^n}$$, where the numerator and denominator of the fraction are both integers, so $$x$$ is a rational number. The denominator is $$10^n = (2 \times 5)^n$$, so has no factors other than $$2$$ or $$5$$.

For the conversely…’ part, suppose we have a number $$y = \frac{m}{2^a5^b}$$, $$a,b \geq 0$$. Cancel twos and fives until the numerator doesn’t have two or five as a factor, to get $$y = \frac{n}{2^c5^d}$$, with $$c,d \geq 0$$.

If $$c \gt d$$, multiply top and bottom by $$5^{c-d}$$ to get $$y = \frac{5^{c-d}n}{2^c5^c} = \frac{5^{c-d}n}{10^c}$$. Get a decimal representation of $$y$$ by writing down $$5^{c-d}n$$ and shifting the decimal point $$c$$ places left.

Vice versa for $$d \gt c$$.

Can’t be bothered to think of some formatting for a lemma about the uniqueness of decimal representations, so: suppose two decimal representations of a number $$x$$ differ in the digit $$k$$ places to the right of the decimal point, and call those digits $$x_k$$ and $$x_k’$$. So $$x = x + (x_k’) \cdot 10^{-k} – x_k \cdot 10^{-k}$$.

So $$(x_k’) \cdot 10^{-k} – x_k \cdot 10^{-k} = 0$$, hence $$x_k = x_k’$$, a contradiction.

So a number has a unique decimal representation ((strictly I’ve only proven at most one, but I don’t care about proving every number has at least one decimal representation)).

4. The positive rational numbers may be arranged in the form of a simple series as follows:

$\frac{1}{2}, \frac{2}{1}, \frac{1}{2}, \frac{3}{1}, \frac{2}{2}, \frac{1}{3}, \frac{4}{1}, \frac{3}{2}, \frac{2}{3}, \frac{1}{4}, \dots$

Show that $$\frac{p}{q}$$ is the $$\left[ \frac{1}{2}(p+q-1)(p+q-2)+q \right]$$ th term of the series.

This series is obtained by laying out the fractions $$\frac{p}{q}$$ in a table, with $$p$$ increasing rightwards and $$q$$ increasing downwards, and reading off the top-right-to-bottom-left diagonals. Note that on the diagonals, $$p+q$$ is constant, because by moving left you decrease $$p$$ by 1, but moving down increases $$q$$ by 1. There are $$p+q-1$$ fractions in each diagonal.

So if we’ve got a fraction $$\frac{p}{q}$$, consider the square whose diagonal is the one containing our $$\frac{p}{q}$$. Its sides have length $$p+q-1$$, so its area is $$(p+q-1)^2$$.

Now take away the fractions lying on the diagonal, leaving $$(p+q-1)^2 – (p+q-1) = (p+q-1)(p+q-2)$$ fractions inside the square. The fractions in the top-left half appear in the series before $$\frac{p}{q}$$, and the ones in the bottom-right half appear after it. The top-left half contains $$\frac{1}{2}(p+q-1)(p+q-2)$$ fractions.

Finally, $$\frac{p}{q}$$ is the $$q$$th fraction encountered in its diagonal, because that diagonal starts at $$\frac{p+q-1}{1}$$, so in total $$\frac{p}{q}$$ is the $$\left[ \frac{1}{2}(p+q-1)(p+q-2) + q \right]$$th term in the series.

Something’s wrong! Are you a professor or a mere student? 10k+1x=(10x)k=(10a+d)k=10k+1a+dk. That equation doesn’t make the point clear. y=5c−dn2c5d=5c−dn10c. That transformation is posing some problems to you, I think. It needs some modification or specification. Or your work’ll be a piece of shit! What the hell! Know math? Don’t even bother yourself to read this shit, bro!

Steady on! It just seems there were a couple of transcription errors, so thanks for pointing them out.
What were you hoping to achieve with such an aggressive tone?

Oh, are you the writer? I’m sorry for my tone because I have a predilection for aggression when something I spends my time patiently on becomes a travesty of value. If you’re the one who posted the work, I suggest you should make some corrections so that all the explanations seem clearer. Why don’t you correct right now?
I don’t quite understand Eg. 4. Someone help!

Which bit of question 4 don’t you understand?

I’ve tried to approach the problem by your idea, but I still don’t get it. I don’t understand especially 2nd, 3rd and 4th paragraph of the solution to Eg. 4. Can you make it clear? Hey, are you a graduate student? I haven’t attended a college. i’ve just finished my high school.
I’ve also bought Hardy’s book, but can’t find the solution he provided.
I’ve tried to solve it by myself. In the formula described in eg.4, I think +q ( of the last part of the formula) determines in which direction the series goes; if q is replaced by p, then the direction is reversed. I know p+q-1 represents the diagonal, but don’t know why it’s multiplied by p+q-2 then divided by 2. Can you help me?

Your description of the series via diagonals and rectangles is correct, but you mistyped in the series itself. It should be $\frac{1}{1}, \frac{2}{1}, \frac{1}{2}, \frac{3}{1}, \frac{2}{2}, \frac{1}{3}, \frac{4}{1}, \frac{3}{2}, \frac{2}{3}, \frac{1}{4}, \dots$

Anyway, when laid out in a grid like you suggested, it looks like this, so indeed, your description works.

$\begin{array}{cccccc} \frac{1}{1} & \frac{2}{1} & \frac{3}{1} & \frac{4}{1} & \frac{5}{1} & \dots \\ \frac{1}{2} & \frac{2}{2} & \frac{3}{2} & \frac{4}{2} & \frac{5}{2} & \dots \\ \frac{1}{3} & \frac{2}{3} & \frac{3}{3} & \frac{4}{3} & \frac{5}{3} & \dots \\ \frac{1}{4} & \frac{2}{4} & \frac{3}{4} & \frac{4}{4} & \frac{5}{4} & \dots \\ \frac{1}{5} & \frac{2}{5} & \frac{3}{5} & \frac{4}{5} & \frac{5}{5} & \dots \\ \vdots & \vdots & \vdots & \vdots & \vdots & \ddots \end{array}$

I would also recommend amending the phrase, “Now take away the diagonal” to something like –Now take away the fractions that lie on the diagonal–. I kept thinking that the diagonal was merely an imaginary line of sorts (i.e., that one could take away the diagonal while leaving behind the numbers that lie thereon), so for awhile, I didn’t realize you actually meant to take away those numbers too while leaving behind only the numbers above and below the diagonal.

Once I realized what you meant, everything made sense.

All I can say is that I hope you quickly return to this labor and do keep up on this work. I’ve recently bought the book myself. I’m looking forward to the chapter on complex numbers.

@Robert
To get what he means in the next to last paragraph, consider a square in the grid I drew above, say the 4X4 square containing only the terms shown below. Also, let’s say, just for example, that $\frac{2}{3}$ is our rational number $\frac{p}{q}$ of interest.

$\begin{array}{cccccc} \frac{1}{1} & \frac{2}{1} & \frac{3}{1} & \frac{4}{1} \\ \frac{1}{2} & \frac{2}{2} & \frac{3}{2} & \frac{4}{2} \\ \frac{1}{3} & \frac{2}{3} & \frac{3}{3} & \frac{4}{3} \\ \frac{1}{4} & \frac{2}{4} & \frac{3}{4} & \frac{4}{4} \end{array}$
(for example, $p=2, q=3$)

Alright, let’s take away that diagonal and the fractions it contains:

$\begin{array}{cccccc} \frac{1}{1} & \frac{2}{1} & \frac{3}{1} & \\ \frac{1}{2} & \frac{2}{2} & & \frac{4}{2} \\ \frac{1}{3} & & \frac{3}{3} & \frac{4}{3} \\ & \frac{2}{4} & \frac{3}{4} & \frac{4}{4} \end{array}$

So, the squared part, $(p+q-1)^2$, represents all of the fractions in the square before the fractions on the diagonal are removed, and $(p+q-1)$ represents the number of fractions on the diagonal itself. Thus, the number of fractions in the diagram above is $(p+q-1)^2 – (p+q-1)$, which when worked out, simplified and factored (I guess, I didn’t do it myself) yields

$(p+q-1)(p+q-2) =$ (in this example, $\frac{p}{q} = \frac{2}{3}$) $= 4 \times 3 = 12$

The reason we are dividing this result by two is because we only want to count the fractions on the upper left half of the diagram, which is

$\left( \frac{1}{2} \right)(p+q-1)(p+q-2) = 6$

Then we simply add back in the $q$ amount ($q = 3$), which is the number of fractions down the diagonal to our number of interest $\frac{p}{q}$.

Just to finish off, in our case, by the formula, the rational number $\frac{2}{3}$ is the NINTH number in the series, so if you plug p=2 and q=3 into the formula …

$\left( \frac{1}{2} \right)(p+q-1)(p+q-2) + q = 6 + 3 = 9$

You might want to DELETE the post I just made. I realized that my third number grid did NOT typeset out right. I meant for the diagonal to remain there as empty spaces where the fractions were. Maybe I need to learn how to use that MathJax thing. Or if you can correct it yourself, that would be great. I’m talking about the third, or last, number grid shown above. Fractions 4/1, 3/2, 2/3, 1/4 were removed from the grid and should have been replaced by spaces that formed the diagonal of the square. Sorry about that.

Thanks for this! I’ve edited your post so it’s set properly, and edited mine so it makes sense.

I have a simpler solution for the last question – here we group the terms to simplify things for us:

The series is: $(\frac{1}{1}), (\frac{1}{2}, \frac{2}{1}), (\frac{3}{1}, \frac{2}{2}, \frac{1}{3}), (\frac{4}{1}, \frac{3}{2}, \frac{2}{3}, \frac{1}{4}), \dots$

Here we outright start with the observation that in each subgroup, the numerator drops from the subgroup number to $1$ while the denominator rises from $1$ to the subgroup number. Consequently, their sum remains the same.

(the subgroup in which $\frac{p}{q}$ occurs would thus have $p+q-1$ terms, just on the basis of observation (more explanation follows). We observe that the sum of the numerator and denominator remains invariant in each group and is equal to the subgroup number $-1$). In the $n^{\textrm{th}}$ group the numerator goes from $n$ to $1$ and denominator goes from $1$ to $n$, and $k^{\textrm{th}}$ subgroup has $k$ terms.

The first time $p$ appears is in the $p^{\textrm{th}}$ subgroup, but here $p$ appears in the numerator with a $1$ in the denominator. To have a $q$ in the denominator, it has to be at the $q^{\textrm{th}}$ place in its subgroup for which the numerator must have dropped down from $p+q-1$ to p. So, this is the $(p+q-1)^{\textrm{st}}$ subgroup and the term we are looking for appears at the $q^{\textrm{th}}$ place in this subgroup.

Adding the number of terms in the subgroups before the $(p+q-1)^{\textrm{th}}$ subgroup, i.e., up to the $(p+q-2)^{\textrm{nd}}$ subgroup we get: (using $\frac{n(n+1)}{2}$ for the sum of numbers, a simple arithmetic progression with a difference of $1$)) the place of this $q^{\textrm{th}}$ term in the series to be: $\frac{1}{2}(p+q-2)(p+q-1) + q$.

I just noticed that there is a typo in the formula for sum of first n consecutive natural numbers in my post, it should be (n)(n+1)/2.

OK, I’ve fixed that. I’ve also edited your comment so that the maths is typeset with LaTeX.

Yes, that’s a nice and concise explanation, thanks.

Thanks 🙂

A small errata: the second term in third subgroup is (2/2).

Fixed.

Some thoughts on your proof of uniqueness of decimal representation.
You have already invoked induction to prove “Let $x$ be a terminated decimal. If $x$ has a terminated decimal representation with n digits after the point, $10^n x$ is an integer”. Trying to prove the same thing through uniqueness of integers …

If I define the first representation of the rational number as

$x = \sum_{k=0}^n x_k/ 10^k \rightarrow 1$

whereas in another distinct representation as
$x = \sum_{k=0}^m y_k / 10^k \rightarrow 2$

where $n \geq m$.

case (i) $n \gt m$
Multiplying both sides by $10^n$ we get
$1 \Rightarrow 10^n \cdot x = x_0 x_1 x_2 \dots x_n \rightarrow 3$
$2 \Rightarrow 10^n \cdot x = y_0 y_1 y_2 \dots y_m 0 \dots 0 \rightarrow 4$

since LHS is equal for $3$ and $4$ equate RHS integers. The integers would not be equal because $n \gt m$, which destroys the equality. Hence, this case cannot exist.

case (ii) $n = m = p$ (say)
$1 \Rightarrow 10^p \cdot x = x_0 x_1 x_2 \dots x_p \rightarrow 5$
$2 \Rightarrow 10^p \cdot x = y_0 y_1 y_2 \dots y_p \rightarrow 6$

again equating RHS of $5$ and $6$, unless the $x_k$s are equal to the $y_k$s, the integers would be different, which rules out the assumption that a distinct representation exists.

What do you mean?