# Fractions and Rational Numbers

Definition. A rational number is a real number which can be written as , where a and b are integers and . A real number which is not rational is irrational.

Example. Prove that if p is prime, then is irrational.

To prove this, suppose to the contrary that is rational. Write , where a and b are integers and . I may assume that --- if not, divide out any common factors.

Now

Since and p is prime, . Write . Then

Now , so . Thus, p is a common factor of a and b contradicting my assumption that .

It follows that is irrational.

More generally, suppose , ..., are integers and

Then the roots are either integers or irrational.

If b is an integer such that , and a is a positive integer, then for some I can write a uniquely in the form

This is called the base b expansion of a.

Note that

The notation is , with the subscript b denoting the base. We omit the subscript for number given in base-10.

Thus, the value of a is obtained by plugging into the polynomial

The standard way to do this by hand is to use synthetic division.

Example. Convert to base-10. Use synthetic division:

Thus, .

To convert from base-10 to base-b, we just have to undo the process above. I divide the number by the base, noting the quotient and the remainder. Then I divide the quotient by the base, and so on. The successive remainders give the base-b digits (backwards).

Example. Convert 3915 to base-8. Divide 3915 by 8. The quotient is 489 and the remainder is 3:

Divide 489 by 8. The quotient is 61 and the remainder is 1:

Divide 61 by 8. The quotient is 7 and the remainder is 5:

Since 7 is less than 8, I can stop here. The answer is .

Note that if you want to convert between base-b and base-c, you could just do

What about a positive number which is not an integer? I can write any positive real number as a sum of a positive integer and a real number between 0 and 1. I already know how to convert positive integers to base-b.

So suppose b is an integer such that , and a is a real number between 0 and 1 (inclusive). Then a can be written uniquely in the form

Rather than proving this fact, I'll merely recall the standard algorithm for computing such an expansion: Subtract from a as many 's as possible, subtract as many 's from what's left, and so on.

Here is a recursive procedure which generates base b expansions:

To see why this corresponds to the standard algorithm, note that at the first stage I'm trying to find such that

These equations are equivalent to

Equivalently,

That is, , and a corresponds to .

It's convenient to arrange the computations in a table, as shown below.

Example. Find 0.4 in base 7.

I fill in the rows from left to right. Starting with an x, multiply by to fill in the third column. Take the greatest integer of the result to fill in the a-column of the next row. Subtract the a-value from the last -value to get the next x, and continue. You can check that this is the algorithm described above.

The expansion clearly repeats after this, since I'm getting 0.4 for x again. Thus,

Definition. The decimal expansion terminates if there is a number such that for .

In this case,

Hence, x is rational.

In fact, rational numbers in with terminating decimal are exactly the rational numbers of the form for and .

Suppose a rational number has the form for and . To see this, multiply the top and bottom by a power of 2 or a power of 5 to get a power of 10 on the bottom. Then , which is represented by a terminating decimal with q being the "decimal part". For example,

Going the other way, note that

For instance,

Thus, a terminating decimal has the form for and .

A decimal expansion is periodic with period k if there is a positive integer N such that for all .

Proposition. A periodic decimal expansion represents a rational number.

Proof. (Sketch) First consider the simplest case of a periodic decimal

This is a geometric series with first term and ratio .

a and r are both rational The sum of such a geometric series is , which is also a rational number.

Suppose there is a pre-period --- an initial segment before the repeating part:

This is a sum of two rational numbers: The rational number corresponding to the terminating decimal and the rational number corresponding to the periodic part , shifted by j places. Explicitly, if and , then

Once again, this is rational.

Example. Express as a rational number in lowest terms.

Since the number has period 3, I multiply both sides by :

Next, subtract the first equation from the second:

Example. Express as a rational number in lowest terms.

Since the number has period 3, I multiply both sides by :

Next, subtract the first equation from the second:

Example. Express as a base-10 rational number in lowest terms.

Since the number has period 3, I multiply both sides by :

Next, subtract the first equation from the second, being careful about the bases: I have base-10 on the left, but base-8on the right.

In the next two problems, I'll use the formula for the sum of a geometric series:

Example. Suppose b is an integer and . Express the following as a rational function of b:

Using the formula for the sum of a geometric series, I have

Example. Suppose b is an integer and . Express the following as a rational function of b:

Using the formula for the sum of a geometric series, I have

Proposition. A rational number can be represented by either a terminating decimal, or a periodic decimal.

Proof. (Sketch) Suppose is a rational number in lowest terms, so , and .

I've already shown that ca be represented by a terminating decimal if and only if for some .

I'll consider the case where , so q is not divisible by 2 or by 5. By Euler's theorem,

Since some positive power of 10 is equal to 1 mod q, there must be a smallest positive power n such that . (This is called the order of 10 mod q.) Thus,

I have

On the other hand, I have the decimal expansion

Here x represents the remainder of the decimal expansion, so

Note that

Hence, .

So multiplying the equation for by , I get

Comparing the two equations for , I have

I have an integer on either side, namely and . I also have on either side numbers in the range , namely and . This is only possible if . This means that at the place the decimal being constructed is the decimal for the original . Hence, the decimal must repeat after that point.

I'll omit the case where , where . In this case, the decimal has a pre-preriod before it begins to repeat.

For example, consider the rational fraction . I have , and checking powers I find that , and this is the smallest positive power of 10 equal to 1 mod 21. Thus, I expect the decimal to have period 6. In fact,

Contact information