A Fourth of July Cipher

« previous post | next post »

Near the end of 1801, his first year as president of the United States, Thomas Jefferson got a letter from Robert Patterson, professor of mathematics at the University of Pennsylvania, containing a page encrypted according to a new method. Patterson described his cryptosystem in detail, and boasted that without the key — which he didn't provide — decryption of his message would "defy the united ingenuity of the whole human race".

After more than 200 years, the code was finally broken by Dr. Lawren Smithline, a mathematician at the Center for Communications Research in Princeton, N.J., using a technique originally developed for biological sequence comparison.

This could be the premise for a new Dan Brown novel, if Patterson's message were sufficiently bizarre and consequential.

Fortunately, his sample encryption turned out to be simply the preamble to the Declaration of Independence. You can read more about the code in an article by Rachel Emma Silverman, "Two Centuries On, a Cryptologist Cracks a Presidential Code", WSJ, 7/2/2009, which also a nice flash animation of the ciphering method. Details of the crytanalysis can be found in Lawren M. Smithline, "A Cipher to Thomas Jefferson", American Scientist, March-April 2009 (subscription required).

One interesting thing in Patterson's letter was his list of desiderata for a system of "secret writing":

1. It should be equally adapted to all languages.
2. It should be easily learned and retained in memory.
3. It should be written and read with facility & dispatch.
4. (Which is the most essential property) it should be absolutely inscrutable to all unacquainted with the particular key or secret for decyphering.

Patterson's system certainly scores well on points 1-3, but as Smithline showed, it fails on point 4.  I'm not sure how it compares in strength to some of the better alternatives available in 1801, for example Vigenère ciphers, either in principle or in the cryptanalytic practice of the time. If Patterson's method were combined with a Vigenère cipher, neither Smithline's method nor the standard methods for solving Vigenère ciphers would work, and perhaps the result would have been effectively unbreakable with the methods available in 1801, I'm not sure. In comparison, Bruce Schneier's low-tech Solitaire algorithm is said to be effectively unbreakable even with modern techniques and machinery, but it's a good deal more troublesome on points 2 and 3.

In any case, Patterson's system seems never to have been used in practice.

The exchange between Patterson and Jefferson reinforces what we already know about Jefferson's intellectual breadth. In 1801, Jefferson was president of the American Philosophical Society as well as of the United States, and Patterson was the A.P.S. vice-president.  For another window on their relationship — and on Jefferson's intellect — see his letter to Patterson of Nov. 10, 1811, on "the subject of a fixed standard of measures, weights and coins".

But reading the biographical sketch of Robert Patterson in Penn's archives reminded me of some other important characteristics of American culture:

Robert Patterson, the son of Robert Patterson and Jane Walkers, was born on May 30, 1743 on a lease-held farm near Hillsborough, County Down, Ireland. His family was respectable, though not affluent. Patterson attended school at an early age and soon became distinguished for his love of learning. He excelled in mathematics, but his family could not afford to pay for a university education. In 1759, when the French invaded Ireland, Patterson enlisted in the militia, and after serving for a year, rose to the rank of sergeant. He devoted himself to his military exercises, and soon became distinguished enough for his skill and good conduct to attract the attention of the officers of a British regiment stationed near Hillsborough, who offered him a commission in the regular army. Patterson refused this commission, choosing instead to return home to work on the family farm.

In October of 1768, determined to try his fortune in America, Patterson embarked for Philadelphia, arriving there almost penniless. After spending a week in Philadelphia, Patterson set out on foot for Bucks County in order to seek employment as a schoolmaster. He was immediately hired at a school in Buckingham.

Although Patterson had a natural talent for teaching, he decided to make more use of his mathematical talents, especially his knowledge of determining longitude through the use of lunar observations, and moved back to Philadelphia to teach navigation. […]

In 1772, with his finances vastly improved, Patterson was persuaded by a friend to invest his money in merchandise and open a country store in New Jersey. However, since he was unsuccessful as a shopkeeper, he was happy to accept a position as Principal of the Wilmington Academy in Delaware in 1774.

At the outbreak of the Revolutionary War, his duties as Principal were suspended due to the fact that many of the students at the Wilmington Academy were called home. After removing his family to a small farm near Roadstown, New Jersey, Patterson enlisted as a military instructor in the Delaware militia, then under the command of Colonel John Haslet. He later served under Colonel David Hall, first in the medical corps and then as a brigade major. He remained in the militia until the British army evacuated Philadelphia and New Jersey in 1778, when his brigade was disbanded.

In 1779, after the College and Academy were reorganized into the University [of Pennsylvania], Patterson successfully applied to Dr. Ewing, the Provost, for employment as Professor of Mathematics. He was Professor of Mathematics from 1779 to 1810, Professor of Natural Philosophy and Mathematics from 1810 to 1813 and Vice-Provost from 1810 to 1813.

I don't think that it happens anymore, in the U.S. or elsewhere, that someone becomes a university professor without ever having attended a college or university as a student.  But America is still a place where immigrants can find opportunities denied to them in their homeland. And it's also a place where people often have second and third chances to find their calling.

One other note in Patterson's bio resonated with me in a personal way:

Patterson resided at nine different locations in Philadelphia, beginning at 148 South Fourth and ending at 285 Chestnut Street. It was said that he only remembered the latter address because the second digit was the cube of the first and the third was the mean of the first two.

I've always had a terrible memory for numbers, and this is exactly the sort of mnemonic that I've always resorted to. For example, after all these years, I still remember the standard Philadelphia telephone area code, 215, by keeping in mind that the second digit is half the first, and the third is the sum of the second and the square of the first.  It seems illogical that this sort of thing should help, but it does!

[By the way, I note that determining longitude by lunars was apparently only described as a practical method in 1767 (at least, that was the date when the Theoria lunae juxta systema Newtonianum was published). So for Patterson to start teaching it in 1769 or so was fast work.

I wonder whether he learned about it from Charles Mason, of Mason-Dixon fame, who seems to have spent parts of 1767-68 in the Philadelphia area.]


  1. Blake Stacey said,

    July 3, 2009 @ 11:44 am

    My area code is nice: it's a straight-up power of two.

  2. Emily said,

    July 3, 2009 @ 12:06 pm

    My area code is memorable in that all three numbers can be found in the same column of the keypad– and I just now noticed that the third digit is the mean of the first two. Cool! (My ATM machine PIN number has similar properties.)

  3. E. T.-B. said,

    July 3, 2009 @ 12:21 pm

    I remember letters more easily than numbers, so I use the standard positional code (2=B, etc.) but with 0=O, 1=A or 1=I, and 9=N. The street number of my first apartment, 1802, was thus AHOB, a reverse-engineerable acronym: American Heritage On Board. (It was an old building.)

  4. Karen said,

    July 3, 2009 @ 12:22 pm

    East Tennessee's area code is 865, which spells VOL … I have no idea how they pulled that off!

  5. John Cowan said,

    July 3, 2009 @ 12:23 pm

    Since I live in NYC, which receives a lot of telephone calls, my area code is 212, which required only five pulses on a rotary-dial telephone. (To be sure, 212 is now restricted to Manhattan only, and shares even that area with 646 and with 917, the pager/cell phone area code for New York City.) L.A. and Chicago are 213 and 312 for the same reason.

  6. Janice Huth Byer said,

    July 3, 2009 @ 1:26 pm

    Impressed that Robert Patterson, in an era when middle age was old, was still in academia at age 70, I Googled to see how long he lived. Wiki says he worked as Director of the US Mint until his death at 81 – whew.

    His name on his gravestone is followed by LLD – an honorary degree. I would say, in his case, he earned it.


  7. Brandon said,

    July 3, 2009 @ 2:14 pm

    This is where synesthesia comes in handy for me (for numbers anyway) seeing as it's easier for me to remember a pattern of colors than a string of digits. My area code being green white red.

    On a somewhat more related note, this post is a interesting story, to be sure, I always like reading about modern discoveries about history, and the solving of centuries old puzzles. Throwing Jefferson into the mix is just gravy.

  8. m said,

    July 5, 2009 @ 6:31 pm

    @Emily: ATM machine PIN number…nice one

  9. Pekka K. said,

    July 6, 2009 @ 1:29 am

    I'd like to add a brief note for cryptography aficionados.

    A similar transposition method as proposed by Patterson was later used in the WWI German ADFGVX cipher, though the two methods differ in other details. An account of its cryptanalysis can be read in the book The Codebreakers by David Kahn. A short description is also available here.

  10. Andrej said,

    July 6, 2009 @ 2:46 am

    Hm, I've always had an exceptionally easy time remembering numbers. I'd assume I had some kind of photographic memory (since I do picture the actual strings of digits in my head) if it weren't for the utter impossibility of doing the same with words. For the life of me, I can't memorize lines of a poem, or a quote. To do that I have to practise reading them aloud, storing them in my muscle memory.

  11. Eyebrows McGee said,

    July 6, 2009 @ 3:15 pm

    "East Tennessee's area code is 865, which spells VOL … I have no idea how they pulled that off!"

    They ask! (And sometimes nowadays when area codes are so thick on the ground, they back-form … when 312 was initially split and the suburbs became 708 and then the northern suburbs got 847, they advertised 847 to us as "VIP.")

    Exchanges, too … University of Notre Dame's 2 exchanges are 631 (ND #1) and 634 (NDI) so that the call in for the voicemail is 634-7474 — ND IRISH.

    Area code and exchange assigners can be surprisingly accommodating for vanity dialing. :)

  12. Terry Collmann said,

    July 8, 2009 @ 9:27 am

    British telephone numbers still, in many cases, reflect the letter codes first used when the old GPO set up a national dialling system in the 1920s, for example the 22 in the middle of the dialling code for Cambridge (01223) represents "CA", and the 60 in the middle of the code for Norwich (01603) represents "NO". In London's telephone numbers there are even more such survivors from the days of "three letter" exchanges, so that many subscribers in, say, Clerkenwell still have numbers that begin 020 7253, where the 253 represents CLE, and many numbers in Mayfair still start 020 7629 for 7MAY. Not all the codes were geographically derived: in Harrow the code 297 (no longer used, alas) stood for BYRon, because the poet went to school there; around Heathrow 8759 remembers SKYport; and in Southwark the 7407 code recalls when the area was the centre of the HOP trade.

  13. Aaron Davies said,

    July 14, 2009 @ 3:38 am

    The University of Louisville, where I went to grad school, has 852 as its main exchange–85 is "UL". (Columbia, where I did my undergrad, has 1754, the founding date of the university, as their information number, but of course that's an internal decision.)

RSS feed for comments on this post