Some useful formulae

This page will be updated from time to time


Geometric series

For any number r,
Thus, if |r| < 1 then taking the limit n -> infinity,
Combining the above formulae, we obtain,


Decimal, binary, and ternary expansions

Let x be any number in [0,1], and [x]a denote the expansion of x (or the representation of x) in base a (a can be any positive integer).

  • Decimal expansion (a=10):
  • Binary expansion (a = 2):
  • Ternary expansion (a = 3): For numbers greater than 1, there would be digits to the left of the point for the positive powers of a.
    Note that some numbers may have two expansions. For example, [1/10]10 = .1 and .099(99). Also, [3/4]2=.11 and also .1011(11). Another, [7/9]3=.021 and also .02022(22) (this can be seen by adding up the infinite series using the geometric formula above).
    (Here, (ab) denotes the repeating pattern abababab..... )

    Here's the algorithm for computing the ternary expansion of a number x between 0 and 1 (there's a similar algorithm for other bases and if the number is greater than 1). Here we want to determine c1, c2, c3, . . . where each ci is either 0, 1, or 2 such that
    x = c1/3 + c2/32 + c3/33 + ... .
  • Determine c1;
    • if 0 < x < 1/3, then c1 = 0
    • if 1/3 < = x < 2/3, then c1 = 1
    • if 2/3 < = x < 1, then c1 = 2
    • let x1 = x - c1/3 (note that x1 < 1/3 )
  • Determine c2;
    • if 0 < x1 < 1/32, then c2 = 0
    • if 1/32 < = x < 2/32, then c2 = 1
    • if 2/32 < = x < 1/3, then c2 = 2
    • let x2 = x1 - c2/32 (note that x2 < 1/32)
  • Determine c3;
    • if 0 < x2 < 1/33, then c3 = 0
    • if 1/33 < = x2 < 2/33, then c3 = 1
    • if 2/33 < = x2 < 1/32, then c3 = 2
    • let x3 = x2 - c3/33 (note that x3 < 1/33)
  • etc.