Saturday, December 6, 2014

Casting Out Nines

When you first learned your 9 multiplication facts, your teacher may have taught you a helpful memory trick that the digits of the first few multiples of 9 add up to 9.  For example, 9 x 2 = 18 and 1 + 8 = 9; or 9 x 5 = 45 and 4 + 5 = 9.   This even works with higher multiples of 9 if you extend the pattern of adding digits.  For example, 9 x 317 = 2853 and 2 + 8 + 5 + 3 = 18 and 1 + 8 = 9.


In fact, you can quickly find the remainder of any number divided by 9 in a similar fashion.  For example, if you divide 24 by 9, the remainder is 6, because 9 x 2 = 18 and 24 – 18 = 6; but you can find the remainder or 24 divided by 9 even faster by using our new shortcut of adding digits: 2 + 4 = 6.  Using a bigger example, if you divide 223 by 9 the remainder is 7, because 9 x 24 = 216 and 223 – 216 = 7; but using the shortcut, 223 divided by 9 is 2 + 2 + 3 = 7.

This brings us to a nearly-forgotten but quick method for checking mathematical calculations called “casting out nines”.  In “casting out nines”, you find the remainders of each number in an equation divided by 9 by adding up the digits, and seeing if those remainders work in the same formula.  For example, let’s say that you have just calculated that 127 + 714 = 841.  For 127, 1 + 2 + 7 = 10 and 1 + 0 = 1.  For 714, 7 + 1 + 4 = 12 and 1 + 2 = 3.  For 841, 8 + 4 + 1 = 13 and 1 + 3 = 4.  The remainders of each of these numbers (1, 3, and 4) also add up: 1 + 3 = 4, and as long as we’re not a multiple of 9 off on our answer, we can assume that our calculation is correct.

127
(1 + 2 + 7 = 10, 1 + 0 = 1)
1
+ 714
(7 + 1 + 4 = 12, 1 + 2 = 3)
+ 3
841
(8 + 4 + 1 = 13, 1 + 3 = 4)
4

“Casting out nines” also works for subtraction:

627
(6 + 2 + 7 = 15, 1 + 5 = 6)
6
– 129
(1 + 2 + 9 = 12, 1 + 2 = 3)
– 3
498
(4 + 9 + 8 = 21, 2 + 1 = 3)
3

and even multiplication:

372
(3 + 7 + 2 = 12, 1 + 2 = 3)
3
x 29
(2 + 9 = 11, 1 + 1 = 2)
x 2
10788
(1 + 0 + 7 + 8 + 8 = 24, 2 + 4 = 6)
6

For addition and multiplication, it is sometimes necessary to “cast out a nine” one extra time on the remainder’s total or product, like in the calculation 248 + 627 = 875.  For 248, 2 + 4 + 8 = 14 and 1 + 4 = 5.  For 627, 6 + 2 + 7 = 15 and 1 + 5 = 6.  For 875, 8 + 7 + 5 = 20 and 2 + 0 = 2.  The remainders of each of these numbers (5, 6, and 2) don’t seem to add up at first glance, but 5 + 6 = 11 and 1 + 1 = 2, so they do.

248
(2 + 4 + 8 = 14, 1 + 4 = 5)
5

+ 627
(6 + 2 + 7 = 15, 1 + 5 = 6)
+ 6

875
(8 + 7 + 5 = 20, 2 + 0 = 2)
11
(1 + 1 = 2)

For subtraction, it is sometimes necessary to add nine to the difference if it is less than or equal to zero, like in the calculation 317 – 178 = 139.  For 317, 3 + 1 + 7 = 11 and 1 + 1 = 2.  For 178, 1 + 7 + 8 = 16 and 1 + 6 = 7.  For 139, 1 + 3 + 9 = 13 and 1 + 3 = 4.  The remainders of each of these numbers (2, 7, and 4) don’t seem to subtract properly at first glance, but 2 – 7 = -5, and -5 + 9 = 4.

317
(3 + 1 + 7 = 11, 1 + 1 = 2)
2

– 178
(1 + 7 + 8 = 16, 1 + 6 = 7)
– 7

139
(1 + 3 + 9 = 13, 1 + 3 = 4)
-5
(-5 + 9 = 4)

The reason why “casting out nines” works with the number 9 is because it is one less than the base 10 of our numbering system.  For example, viewing 223 as written in base 10, we can rewrite it as 2 x 100 + 2 x 10 + 3, or 2 x (99 + 1) + 2 x (9 + 1) + 3, or 2 x 99 + 2 + 2 x 9 + 2 + 3, and we see that 2 x 99 and 2 x 9 are divisible by 9, but 2, 2, and 3 (the three original digits) are not divisible by 9, which means 2 + 2 + 3 is a remainder. 

223
= 2 x 100 + 2 x 10 + 3
= 2 x (99 + 1) + 2 x (9 + 1) + 3
= 2 x 99 + 2 + 2 x 9 + 2 + 3
= 2 x 99 + 2 x 9 + 2 + 2 + 3

This same algorithm for finding the remainder when divided by 9 can be used for any number (although it may be necessary to “cast out nines” a few more times).  Then in an operation like addition, we can view all three numbers as multiples of 9 plus their remainder, so 9n1 + r1, 9n2 + r2, and 9n3 + r3 (where r1 < 9, r2 < 9, and r3 < 9) in which 9n1 + r1 + 9n2 + r2 = 9(n1 + n2) + r1 + r2 = 9n3 + r3.  If r1 + r2 ≤ 9, then r1 + r2 = r3, and if r1 + r2 > 9, then r1 + r2 – 9 = r3, and we would obtain r1 + r2 = r3 if we “cast out nines” one more time.  In mathematical jargon, r1 + r2 ยบ r3 (mod 9).  A similar argument for proves “casting out nines” for subtraction, and viewing multiplication as a series of addition proves “casting out nines” for multiplication.

As you can see, “casting out nines” is a quick method to check calculations.  It was once used frequently by accountants to check their work when calculations were done by pencils and paper.  If the remainders didn’t add up properly, it was a flag for an error.  It is a pity that this fascinating mathematical method isn’t well-known any more in our age of computers, where nearly everything is calculated for us.

Wednesday, November 12, 2014

Multi-Dimensional Shapes and Pascal's Triangle

The simplest geometric object is a point.  In Geometry, we learn that a point is a single location without length, width, or height, and is usually represented by a dot.  Euclid defined the point as “that which has no part”.  Because it has neither length, width, nor height, it is a zero-dimensional object.

Point


The next simplest geometry object is the line.  A line is straight, infinitely long, and has no thickness.  Euclid said that a line has “breadthless length”.  A line segment is part of a line that begins at a point and ends at another point.  Both lines and line segments have length, but neither width nor height, and so are one-dimensional objects.

Line Segment


If a point is zero-dimensional because it has neither length, width, nor height, and a line or line segment is one-dimensional because it has length but neither width nor height, then it follows that an object with length and width but no height is two-dimensional (such as a triangle, square, rectangle, circle, etc.), and an object with length, width, and height is three-dimensional (such as a pyramid, cube, sphere, etc.)

Let’s identify the simplexes of each dimension, or the object in each dimension that is made entirely of straight line segments and the least amount of endpoints.  The simplex of zero dimensions is a point (since that is the only zero-dimensional object).  The simplex of one dimension is a line segment, which has two endpoints.  The simplex of two dimensions is a triangle, because it has the least amount of endpoints (three) of all two-dimensional shapes with straight sides.  Finally, the simplex of three dimensions is the tetrahedron (a triangular-based pyramid) because it has the least amount of endpoints (four) of all three-dimensional objects with straight sides.

2D Simplex: Triangle

3D Simplex: Tetrahedron


If we examine the number of endpoints, line segments, faces, and solids of each simplex, we will observe some familiar numbers.  The 0-D simplex (a point) is comprised of 1 endpoint (1).  The 1-D simplex (line segment) is comprised of 2 endpoints and 1 line segment (2, 1).  The 2-D simplex (triangle) is comprised of 3 endpoints, 3 line segments, and 1 face (3, 3, 1).  And the 3-D simplex (tetrahedron) is comprised of 4 endpoints, 6 line segments, 4 faces, and 1 solid (4, 6, 4, 1).  We can see that the number of endpoints, line segments, faces, and solids of each multi-dimensional simplex corresponds to a row in Pascal’s Triangle, a famous triangular array of numbers in which each number is the sum of the two numbers above itself.
                            






1











1
1









1
2
1







1
3
3
1





1
4
6
4
1



1
5
10
10
5
1

1
6
15
20
15
6
1

Pascal’s Triangle


Using Pascal’s Triangle we can extrapolate properties of higher dimensional simplexes.  A 4-D simplex (sometimes called a pentachoron or a hyper-pyramid) would have 5 endpoints, 10 line segments, 10 faces, 5 solids, and 1 four-dimensional object (5, 10, 10, 5, 1), and a 5-D simplex would have 6 endpoints, 15 line segments, 20 faces, 15 solids, 6 four-dimensional objects, and 1 five-dimensional object (6, 15, 20, 15, 6, 1), and so on.

4D Simplex: Pentachoron


It is difficult to picture an object in four-dimensions since we live in a three-dimensional space, but we can try to wrap our minds around it if we observe the progression of simplexes in each dimension.  One such progression is that placing a new endpoint in the exact center of all the other existing endpoints and attaching all the endpoints with line segments gives an aerial view of the next simplex in the next dimension.  For example, placing the midpoint on a line segment (1-D simplex) gives an aerial view of an upright triangle (2-D simplex), or placing a point in the centroid of a triangle (2-D simplex) and attaching all the endpoints with line segments gives an aerial view of a tetrahedron (3-D simplex). 

Aerial View of a Tetrahedron


In the same way, placing a point in the centroid of a tetrahedron (3-D simplex) and attaching all the endpoints with line segments should give some sort of aerial view of a pentachoron (4-D simplex).  This progression also explains why properties of simplexes correspond with the numbers in Pascal’s Triangle, because the new point in the center of the simplex in k dimensions creates the same amount of n-dimensional objects as existing (n – 1)-dimensional objects for the simplex in (k + 1) dimensions.  For example, the new point at the centroid of a triangle creates three new faces that correspond to the three existing edges, along with the existing one face, which means that the tetrahedron will have 3 + 1 = 4 faces.

Wednesday, November 5, 2014

The Function x^2 + xy + y^2 – Part 10

10)  Non-primes to the function x2 + xy + y2 (when x and y are positive integers) appear to follow a pattern, and numbers that are not solutions to x2 + xy + y2 (when x and y are integers) also appear to follow a pattern.

In multiplication, a prime number can only be expressed as a product of two positive integers in one way.  For example, 7 is a prime number because it can only be expressed as a product of two positive integers in one way: 1∙7 = 7.  If we apply this definition of primes to the function of x2 + xy + y2, then prime numbers can only be expressed as x2 + xy + y2 in one way where x and y are both positive integers.  Using this definition of prime numbers to x2 + xy + y2, most solutions to x2 + xy + y2 are prime numbers.  For example, 19 is a prime number in x2 + xy + y2 because (2, 3) = 19.  (According to the equalities in Point 7, 19 can also be expressed as (3, 2), (-2, -3), (-3, -2), (2, -5), (-5, 2), (-2, 5), (5, -2), (-5, 3), (3, -5), (5, -3) and (-3, 5), but none of these count because of either the commutative property or negative numbers.)  However, some numbers are not primes to the function x2 + xy + y2, because they can be expressed as x2 + xy + y2 by more than two different positive integers.  For example, 91 can be expressed as (1, 9) and (5, 6), and 133 can be expressed as (1, 11) and (4, 9).

1
2
3
4
5
6
7
8
9
10
1
3
7
13
21
31
43
57
73
91
111
2
7
12
19
28
39
52
67
84
103
124
3
13
19
27
37
49
63
79
97
117
139
4
21
28
37
48
61
76
93
112
133
156
5
31
39
49
61
75
91
109
129
151
175
6
43
52
63
76
91
108
127
148
171
196
7
57
67
79
93
109
127
147
169
193
219
8
73
84
97
112
129
148
169
192
217
244
9
91
103
117
133
151
171
193
217
243
271
10
111
124
139
156
175
196
219
244
271
300

In fact, if x2 + xy + y2 is a product of two other numbers in the form of x2 + xy + y2 where x ≠ y, then it appears that that number is not prime.  So 91 is not prime because 91 = 7∙13, and 7 = (1, 2) where 1 ≠ 2 and 13 = (1, 3) where 1 ≠ 3.  Similarly, 133 is not prime because 133 = 7∙19, and 7 = (1, 2) where 1 ≠ 2 and 19 = (2, 3) where 2 ≠ 3.  (Also note that 21 is prime even though 21 = 3∙7, because 3 = (1, 1) where 1 = 1.)  This can be explained using two of the formulas obtained from Point 9, that (a, b) ∙ (c, d) = (-ac + bd, ac + ad + bc) and (a, b) ∙ (c, d) = (ac + bc + bd, ad – bc), because if a ≠ b then -ac + bd and ad – bc are two unique answers.  For example, in our 91 example, (1, 2) ∙ (1, 3) = (-1∙1 + 2∙3, 1∙1 + 1∙3 + 2∙1) = (5, 6) and (1, 2) ∙ (1, 3) = (1∙1 + 2∙1 + 2∙3, 1∙3 – 2∙1) = (1, 9).  However, in our 21 example, (1, 1) ∙ (1, 2) would make a = b, which would make –ac + bd = ad – bc, therefore giving two equal answers (1, 4) and (1, 4), which makes 21 not prime.

There are also numbers that are not solutions to x2 + xy + y2 (when x and y are integers), which do not appear on the number table at all.  We shall call these numbers zero-primes of x2 + xy + y2.  Zero-primes of x2 + xy + y2 include 2, 5, 6, 8, 10, 11, 14, 15, 17, 18, 20, etc.  Any number in the form of 3n + 2, where n is any positive integer, is a zero-prime, such as 2, 5, 8, 11, 14, 17, etc.  We can show this inductively from the number table, if we change all solutions in terms of mod 3, and see that every 3 x 3 square repeats itself infinitely and there is no solution of 2, meaning there are no solutions in the form of 3n + 2.

1
2
3
4
5
6
7
8
9
10
1
0
1
1
0
1
1
0
1
1
0
2
1
0
1
1
0
1
1
0
1
1
3
1
1
0
1
1
0
1
1
0
1
4
0
1
1
0
1
1
0
1
1
0
5
1
0
1
1
0
1
1
0
1
1
6
1
1
0
1
1
0
1
1
0
1
7
0
1
1
0
1
1
0
1
1
0
8
1
0
1
1
0
1
1
0
1
1
9
1
1
0
1
1
0
1
1
0
1
10
0
1
1
0
1
1
0
1
1
0

But 6 is also a zero-prime, but not in the form of 3n + 2.  So zero-primes can also include numbers in the form of 4n + 2, which again we can also show inductively on the number table in terms of mod 4 because every 4 x 4 square repeats infinitely and there is no solution of 2.

1
2
3
4
5
6
7
8
9
10
1
3
3
1
1
3
3
1
1
3
3
2
3
0
3
0
3
0
3
0
3
0
3
1
3
3
1
1
3
3
1
1
3
4
1
0
1
0
1
0
1
0
1
0
5
3
3
1
1
3
3
1
1
3
3
6
3
0
3
0
3
0
3
0
3
0
7
1
3
3
1
1
3
3
1
1
3
8
1
0
1
0
1
0
1
0
1
0
9
3
3
1
1
3
3
1
1
3
3
10
3
0
3
0
3
0
3
0
3
0

In fact, it appears that most numbers in the form of (3m + 2)2n + k(3m + 2) when m, n, and k are integers and 0 < k < 3m + 2 are zero-prime, including 25n + 5 (m = 1, k = 1), 25n + 10 (m = 1, k = 2), 25n + 15 (m = 1, k = 3), 25n + 20 (m = 1, k = 4), 64n + 8 (m = 2, k = 1), 64n + 24 (m = 2, k = 3), 64n + 32 (m = 2, k = 4), 64n + 40 (m = 2, k = 5), 64n + 56 (m = 2, k = 7), etc.  However, some exceptions occur to this rule at 64n + 16 (m = 2, k = 2) because (0, 4) = 16 and also at 64n + 48 (m = 2, k = 6) because (4, 4) = 48.  Other exceptions may also occur with larger numbers, but the exact pattern is unknown to me.