Sunday, January 30, 2011

How do you say 293?

Everyone time I learned a new language, sometimes I feel like I have to learn a new number system as well. Consider the number 293. In my mother tongue, Chinese, 293 is written as 二百九十三, which literally means "two-hundred-nine-ten-three". Thus the positions of the digits 2 and 9 are denoted by the words for "hundred (百)" and "ten (十)" respectively. Then when I learned Dutch, 293 is written as "twee honderd drieënnegentig" which literally means "two-hundred-three-and-ninety". Instead of reading the number from left to right, I have to mentally insert the unit digit (3) before the decade digit (9). This took me a while to master. Then when I learned French, 293 is written as "deux cents et quatre-vingt-treize", which literally means "two-hundreds-and-four-twenty-thirteen". I mainly use English these days, which luckily write the number similar to Chinese syntactically.

Saturday, September 18, 2010

Childhood magic

The science fiction writer Arthur C. Clarke (who incidentally predicted the geostationary communication satellite in 1945) once famously said, "Any sufficiently advanced technology is indistinguishable from magic." One example I like to use in this regard is the music or video player. It would have seem incredulous to someone from the early 19th century that a spinning disk or cylinder can record music and speeches. Similarly if you tell someone from the early 20th century than you can record hours of moving pictures on a tiny disk, they would find that magical. Even today, it seems incredible to me that you can records hours of movies or 1000's of songs on a device no bigger than a postage stamp. One fascinating aspect of the multimedia player and recorder is the amount of technology involved, spanning mathematics (some of them discovered thousands of years ago), physics and engineering, but that's a discussion for another time.

I had similar experiences as a child when I learned of various puzzling phenomena in science and mathematics. The amazement only deepens when I became older and understood the reasons behind the magic. Let me delineate some examples here.

1. My first computer was a Commodore VIC-20. This is a wonderful machine with features that were quite advanced at the time for a home computer. It outputs in color and has polyphonic sound capabilities. During one of our experiments with sound, my brother and I made two of the sound generators generate tones at frequencies that are almost the same. The result was surprising and quite remarkable to us! We heard a sound whose intensity undulates, like a siren. It is magical how the superposition of two pure tones can create such a strange sound effect. Only year later did I discover that this is a phenomena known as beat frequencies. Mathematically, we can expressed the pure tones generated by the sound generator as a sinusoidal wave of the form sin(2π x frequency x t). The summation of two sinusoidal waves is an exercise in high school trigonometry:

sin(a) + sin(b) = 2sin(0.5(a+b))cos(0.5(a-b))

Given two tones of different frequencies, their superposition results in:

sin(2π f1 t) + sin(2π f2 t) = 2sin(2π 0.5(f1+f2)t)cos(2π 0.5(f1-f2)t)

Thus the result is a sinusoidal wave whose frequency is the average of f1 and f2 with the magnitude modulated by a sinusoidal wave of frequency 0.5(f1-f2). If f1 and f2 is close enough and the difference |f1-f2| is small enough that the magnitude modulation is at a frequency that we can distinguish aurally, then this is what the siren-like undulation of the amplitude is about. This is shown in the following figure where the second waveform has a frequency that is 10% higher than the first waveform and the sum of these two sinusoidal waves of slightly different frequencies is shown at the bottom of the figure:2. In a series of books to introduce young children to science and mathematics, I found an article that was truly amazing to me. It describes a simple device for measuring distances between you and a far away object. Most of the time we measured distances using a ruler or a tape measure, but that is not feasible for far away objects. There are sonar measurement devices that bounces ultrasound off an object and measure the time it took for the sound to come back, but that is too high tech. No, this device was simply a piece of paper with markings on it!

To measure the distance from you to, say a tree, you hold the paper with your outstretched arms and close your right eye. You line up the tree with the reference mark "0". Then you close your left eye and open your right eye. The position of the tree on the paper will be the distance. It is as simple as that! Pure magic! The underlying principle behind this cute little device is the parallax principle and can be described in the following bird's eye view (pardon my crude drawing skills):


In essence, your right eye and your left eye will line up the tree with the paper at different spots. How far the markings on the papers need to be is simply a matter of trigonometry.  The parameters you need will be the length of your arms L (or more accurately the distance from your eyes to the paper) and the distance between your eyes s.  In particular, the congruent triangles show that the distance to the object D is related to the distance p on the paper between the left and right eye view via the following equation p = s(D-L)/D.
Such an elegant solution to the problem of measuring distances.  One drawback of this approach is that the resolving power decreases as the distance increases.  As D → ∞, we see that p → s, i.e. all the lines on the paper are bunched up towards the end.

3. Once upon a time, I spend my summers working for a family friend's grocery store and restaurant and there was an avuncular gentleman there who proposed the following enticing offer. He said: "I'll give you Nafl. 100 (Nafl or Florin is the official currency of the Netherlands Antilles) if you can solve the following problem. There are 3 houses and 3 utilities (electricity, water and gas). Each house needs a connection to all 3 utilities. Draw me a set of lines connecting each of the 3 houses to each of the 3 utilities without any of the lines crossing each other."
This seems simple enough. So I spent the next couple of weeks trying to solve this problem, drawing maps on reams of scratch paper. Trying hard as I might, I cannot come up with a solution. It was very frustrating because many times I thought I had the solution, and only not being able to place one final connection. Now I know that the problem is impossible. In mathematical terms, the graph I am trying to draw is the complete bipartite graph K3,3 and this is impossible to draw on a piece of paper without some lines crossing each other since the graph K3,3 is not planar.  In fact the graph K3,3 is an important part of the necessary and sufficient conditions for a graph to be planar.

4. One interesting math trick I learned was how to take fifth root of large integers.  The trick goes as follows.  Ask your friend to pick a 2 digit number and input that into a calculator.  Then raise that number to the fifth power and show you the answer.  Within seconds, you can tell your friend which 2 digit number he or she picked.  The main ingredient of the trick is the fact that any integer raised to the fifth power has the same last digit as itself.   This interesting number theoretical fact is actually easily shown using basic number theory.  In mathematical terms, the result we are trying to show is
x5 ≡ x  mod 10
It is clear that the fifth power of an even number is even and the fifth power of an odd number is odd, i.e.
x5 ≡ x  mod 2
According to Fermat's (little) Theorem (not to be confused with the celebrated Fermat's Last Theorem that took more than 350 years to solve):
x5 ≡ x mod 5
Since 2 and 5 are relatively prime, this implies that x5 ≡ x  mod 10
To complete executing the trick, one needs to memorize the fifth powers of 10, 20, ..., 90.   Because raising a number to the fifth power is a monotonically increasing operation, this allows one to determine between which of the 2 decades the 2 digit number lies and thus determine the first digit of the number.  The last digit one would read off from the last digit of the fifth power. 

Monday, March 29, 2010

Screensavers

My son recently installed a screensaver on his computer and this leads me to reminisce about the screensavers I have seen over the years. In the distant past, computer screens were all built using cathode ray tube (CRT) technology, where a beam of electrons is accelerated to hit a screen of phosphor causing a release of photons lighting up the screen. One drawback of such screens is that in heavily used areas of the screen the phosphor will lose its ability to release photons after a while. If one continues to display the exact same image on the screen for an extended period of time, this would cause the image to be burned-in at the display. Common places where you see this phenomenon is in ATMs and Airport terminals.

To prevent burn-in of personal computer displays, screensavers were created, which are programs that are activated after several minutes of inactivity to constantly change the images displayed on the screen, in order to wear down the phosphor more evenly. One of the earliest screensavers for PCs is the flying toaster screensaver, where toasters are flying across the screen. Since then the screensaver has become much more sophisticated (e.g. displaying fractals and other beautiful patterns based on mathematical equations) and has been used for a myriad of tasks, including advertising, display of news (e.g. PointCast), photo slideshows (e.g. Picasa) and collaborative computing (e.g. World Community Grid) to help solve various important problems in the world today. Since most computer screens today are based on LCD technology, the problem of screen burn-in is less of a problem (but could still exist). However screensavers are still popular since they create a useful diversion to mundane computing tasks.

Back to the screensaver that was installed on my son's computer. This screensaver is associated with a popular video game, and when the screensaver starts, the logo of the game is displayed at a fixed location at the center of the screen with a scrolling star field in the background. This is exactly the kind of burn-in prone images the screensaver is trying to prevent. So it seems we have reached full circle!

Saturday, September 19, 2009

Mirrors without a face

I noticed something peculiar while standing in my bathroom. When I look at the corner of the room where the wall mirror and the mirror of the medicine cabinet meet, I cannot see most of my face no matter how I turn my head. The following figure shows the mirror arrangement.


Two mirrors at a 90 degree angle form a corner reflector and it has the property that light striking it will be reflected back in the same direction parallel to the source light. This is the same principle behind bicycle reflectors. Because there is a gap between the two mirrors, there will be a minimum distance between an incoming lightbeam and the parallel outgoing lightbeam. If this distance (shown as d) is larger than the distance of one eye to the opposite side of my face, then I will not be able to see my face, now matter how I turn my head (unless I stare directly into one of the mirrors).

Monday, August 17, 2009

Tea around the world (or at least Europe)

The word for "tea" in several European languages is pronounced the same as the letter "T" in the same language. I have verified this for English (tea), Dutch (thee), Spanish (té), and French (thé), and I am sure there are others. I wonder if this is coincidence or there is some other (historical) reason behind it?

Sunday, July 26, 2009

Beyond infinity

In the Disney/Pixar film Toy Story, one of the lead characters likes to use the catchphrase "To infinity and beyond!" But what is beyond infinity? As a child, we seem to believe that there are things beyond infinity, especially when we are comparing, i.e. "my toy car is infinity times faster than your car.", "no, my car is infinity plus one times faster.", etc.

In a branch of mathematics called Set Theory, an effort is made to count beyond infinity. First numbers are associated with sets. The number 5 is associated with a set of 5 items. Then a number is larger than, equal to or smaller than another number if the corresponding sets have more items, the same number of items or have less items. One of the consequences of counting this way is that we can extend it to infinite numbers. How do we count whether two sets of objects are of equal size or not? Two sets are of the same size if we can associate each member of the first set with exactly one member of the second set and every member of the second set is associated to some member of the first set. Such a mapping is called a bijection. A map which assigns to a member of a first set exactly one member of the second set is called an injection. A famous result known as the Cantor-Bernstein theorem states that a bijection between two sets exists if and only if there is an injection from the first set to the second set and an injection from the second set to the first set.

With this definition, Cantor shows that the set of even integers is the same size as the set of all integers: just assign each integer n to the number 2n. Intuitively this is strange since the set of even integers is a strict subset of the set of integers.  What is more remarkable is that the set of rational numbers p/q where p and q are integers is also the same size as the set of integers, even though there are infinitely number of rational numbers between any two integers. This infinity is denoted as Aleph-zero. So in this context the child's argument of saying "infinity plus 1" is really not any bigger than "infinity".

So are all infinite sets of the same size? Cantor showed using a diagonalization argument that the set of real numbers is strictly larger than Aleph-zero. In fact, given any set, infinite or not, the power set, i.e. the set of all subsets, is strictly larger. Thus for any infinite set, we can create one that is strictly larger. For a finite set of size n, the power set has 2n elements. For instance, the set {1,2,3} has as its power set {{},{1},{2},{3},{1,2},{1,3},{2,3},{1,2,3}} with 8 elements. Analogously, the size of the power set of Aleph-zero is denoted as 2Aleph-zero and is the size of the set of real numbers. The Continuum Hypothesis states that the next strictly larger infinity beyond Aleph-zero is equal to 2Aleph-zero. It was shown in 1963 by Cohen that this hypothesis is not provable using the assumptions (axioms) of standard set theory.

All this talk about infinity might seem abstract, but it did find its way into the foundation of computer science. In fact, the same diagonalization argument that Cantor used to show that the real numbers is "more infinite" than the integers is used by Turing to show that there are problems that are uncomputable, i.e. there does not exists a computer algorithm that can solve this problem. A famous uncomputable problem is the halting problem: given a computer program with a given input, determine whether it will ever end executing or not.

Friday, July 17, 2009

Palindromic merchants

When I first moved to New York, I was driving down the road and saw the car in front of me with the label: "ADZAM". I thought to myself: "That's odd. ADZAM is MAZDA spelled backwards, and the car in front of me was a Mazda. Perhaps the owner of the car feels the need to display the make of his/her car as you pass by on the opposite lane and view the back of the car in your mirrors (much the same way the word AMBULANCE is spelled in mirror image on the front of an ambulance). Only later did I figure out that Adzam Mazda is the name of a car dealership with an palindromic name, it is spelled the same forwards and backwards. This reminds me of an article on palindromes by Martin Gardner (one of my favorite authors) that I read as a youngster (the article is most recently reprinted here). He mentioned the existence of a bakery in Yreka, CA called Yreka Bakery, which is a palindrome. He also noted that this store is not longer in business, but was replaced by Yrella Gallery, also a palindrome.

Friday, July 10, 2009

The big and the small

Scientists have long studied extremes. Astronomers have long studied objects that are very large, such as galaxies and universes, whereas chemists and biologists have studied things that are very small, including atoms, molecules and microscopic organisms. The book "powers of ten" by Philip and Phylis Morrison gives an excellent visual demonstration of things at various scales.
It is no wonder that when marketers need superlatives to describe their products, they look toward scientific jargon. Apple has an mp3 player called the Nano, my son has a robot called Megatron, and there is a lottery in the USA called Mega Millions, even though as far as I know the prize money is much less than a trillion (or a billion for those of you in long scale countries).

Nano and Mega are part of a class of prefixes that are used to modify units in powers of ten. For instance a kilo-meter is 1000 meters, and a centimeter is 1/100th of a meter. According to the international systems of units (SI), the following prefixes are defined:

yocto, zepto, atto, femto, pico, nano, micro, milli, centi, deci, deca, hecto, kilo, mega, giga, tera, peta, exa, zetta and yotta.

It is interesting to note that as technology evolves, more and more of these prefixes become commonplace. Most of us are familiar with kilo as used in kilogram. Radio waves provides us familiarity with mega as the FM stations operate in the megahertz range. As computer processors increase in speed, we have for the last decade or so been working on computers with gigahertz processors. Memory density has also increased dramatically with personal computer memory, both volatile and nonvolatile, routinely in the gigabytes range today. The world's fastest computers have recently broken the petaflop (1015 flops) barrier and business and scientific computers routinely deal with terabytes and petabytes of data and will need to access exabytes in the not too distant futures. Sometimes the prefix is omitted; for instance the calorie unit we see on food packaging should more accurately be called a kilocalorie since it is the energy needed to raise the temperature of 1 kilogram of water by 1 degree Celsius.

One interesting note about measuring computer memory using the SI prefixes. Modern computer memory locations are indexed using a binary address, i.e. a series of binary digits (or bit). For instance, 1 bit can denote two locations, since it can have the value 0 or 1. On the other hand, 2 bits can denote four locations, i.e 00, 01, 10 and 11. In particular, n bits can denote 2n locations. This is why computer memory is generally arranged in chunks whose size is a power of 2. Ten bits can address 210 = 1024 locations. If each location contains one byte of memory, then 1024 bytes is referred to a kilobyte. 16 bits can address 216 = 64* 210 = 64 kilobytes even though 216 is really 65,536. This deviation from the SI usage of the prefixes can cause confusion and thus in 1998 prefixes were introduced which are powers of 2:

kibi, mebi, gibi, tebi, pebi, exbi, zebi, yobi.

For example, 1024 bytes is referred to as a kilobinarybytes or a kibibyte whereas 280 = 1208925819614629174706176
bytes is called a yobibyte. As of this writing, these binary prefixes are still not commonly used in the scientific literature (although I did use it here). I wonder when we will start seeing products named after these prefixes?

A related note on the subject of very small and the very big, the word quantum in common usage means a significant or sudden amount as in "a quantum leap". On the other hand, its usage in physics is almost the opposite; a quantum is the smallest indivisible unit of a physical property.