Sunday, May 10, 2015

An Open-Ended Problem, Part 2

Study the numbers in this photo until a question occurs to you. Then answer your question. Repeat as desired.

Reader Questions

Reader Stacy W pursued the implications of treating the word "Due" as the visible portion of "Change Due." In that case, assuming 2.59 and 0.57 were the only charges, then her question was, "How much money did the customer give the cashier, in order that the change due would be 7.00?"

Answer: 10.16, likely in the form of a ten-dollar bill and sixteen cents in change. Good question!

Reader Marni pursued the implications of treating the word "Due" as the visible portion of "Amount Due." In that case, what was the rate of tax paid?

Answer: 0.57 on a pretax amount of (7.00 - 0.57) comes to (0.57)/(6.43) = 8.864967(...)%. Good question!

Some of the questions that occurred to me, along with my answers to them:

1. How much in total were the item(s) not shown?

I took "Due" to be the visible portion of "Amount Due." But this raises a puzzle: if 2.59 is the price of a retail item (probably a drink, because of the "oz"), while 0.57 is the amount of tax levied on the sale, then as reader Marni noted, some additional item(s) must have been purchased, because 2.59 and 0.57 don't add up to 7.00. It appears the cash register display was simply too small to show all of the items purchased. So how much in total were the item(s) not shown?

Answer:  (7.00 - 0.57) - 2.59 = 3.84.

Pursuing some more questions along these lines:

2. What was the pretax subtotal?

The pretax subtotal was 7.00 - 0.57 = 6.43.

3. Were all of the purchased items subject to tax?

Certain retail items are exempt from sales tax, so it's possible that the 0.57 amount was levied on some but not all of the purchased items. Note, however, that if any of the items purchased here were exempt, then the local sales tax rate would have to be at least 14.8% (0.57/3.84), which is higher than in any U.S. city. The transaction could conceivably be in a VAT country, where rates can be high. But as discussed further below, we are going to take the transaction to be in the U.S., in which case it follows that the full pre-tax total of 6.43 was subject to sales tax.

4. What can we say about the local sales tax rate?

While 8.864967(...)% gives the rate of tax that was actually paid, this was probably not the sales tax rate prescribed by law in the location where the photo was taken. Legislators aren't going to set the tax rate at a funky, non-terminating decimal value like that. Rather, issues of precision and/or rounding are probably involved here, which makes things tricky since rounding is a non-invertible function. But let's see what we can do.

The register in the given photo is a Micros point-of-sale system. The rounding scheme is presumably configurable in the proprietary Configurator module; however, freely available documentation doesn't seem to specify how many digits of internal precision the cash register uses for its tax computations, nor the logic by which it rounds fractions of a cent. I tried to submit a helpdesk ticket about this, but I couldn't do that because I'm not a Micros customer. I did establish that the Casio PCR-T465 cash register provides several user-configurable options: multiply and round in the usual way (based on 0.5); multiply and round up; multiply and round down; or select a state-specific tax table to compute the tax via lookup. It wouldn't surprise me if the Micros system gave managers the same options.

(And now I have to digress, because suddenly I remember ringing up customers at my parents' diner when I was a kid. The cash register at Rip's Drive-In was a clicking, clanging, chugging machine. An NCR model like the one in the photo, electric-powered but not electronic. We figured the tax by remembering the amount for common orders, or computing mentally, or consulting a laminated table. Computing sales tax was easy for eight-year-old me, but I always panicked inside while figuring the customer's change, because nobody had ever explained to me the method of counting up. So to figure the change for a ten-dollar bill on a forty-nine-cent tab, I stood there for what seemed like endless seconds while the customer waited behind me, my eyes staring into space as I crossed out zeros and borrowed ten on the chalkboard in my mind. Cashiering would have been easier if I'd been taught mental computation strategies in addition to the standard right-to-left subtraction algorithm. Things could have been worse, too: a friend tells of his sister's sidekick from teenaged years who worked a register in those days and never realized that there was any specific quantitative relationship holding between the change, the amount of the tab, and the amount of the dollar bills tendered. Her method of figuring change was to paw through the coin tray with brisk confidence until she had collected what seemed to her like a convincing enough collection of coins to present to the customer.)

For purposes of analysis, I will model the Micros register as follows:
(i) the register multiplies the amount of the sale (a decimal to hundredths) by a finite-decimal tax rate, working to full precision (exact multiplication);
(ii) the register then rounds the result to the nearest cent by rounding fractions less than 0.5 to 0 and rounding fractions 0.5 or greater to 1.
Given this model, the programmed sales tax rate must lie in the range from A to B, where
A = 0.565/6.43
B = 0.575/6.43.
To see this, let R be the programmed sales tax rate and let T be the internal result of the tax computation, noting that (by (i)) T = 6.43R. Now by (ii), T must satisfy 0.565 <= T < 0.575. Dividing through by 6.43, we have A <= T/6.43 < B. But T/6.43 = R, so the programmed rate lies in the range from A to B, as claimed,

Carrying out the division, we have
A = 8.78693(...)%
B = 8.94245(...)%.
According to the model, and assuming that the tax rate is programmed correctly, the local sales tax rate lies somewhere between these two percentages.

6. Where might the photo have been taken?

I downloaded the image file and examined its EXIF data to look for latitude and longitude. (If you don't know how to do this, you can upload the image to Unfortunately, it turns out there's no geotagging in the EXIF data, so we can't locate the transaction that way. An image search on the phrase "join us in the" plus the word childhood did not yield a match to the baby in the photo. (I'd been hoping to identify a corporate campaign.)

Dollar signs are used to denote currency amounts in the United States and many other places. The only language in the photo is English, which rules out some of these countries; the unit of measure "oz" probably rules out many others. In any case, let's assume the transaction took place in the United States.

This website shows minimum and maximum sales tax data for every state. Examining the data, one finds 14 states with minimum and maximum rates that are consistent with A and B:
Alabama, Arizona, Arkansas, California, Colorado, Illinois, Kansas, Louisiana, Missouri, New York, Oklahoma, South Carolina, Tennessee, Washington.
Thus, even though we don't learn the exact location of the transaction, we still rule out out a great many potential locations for the photo (dozens of states and foreign countries). One could repeat the analysis with other reasonable models of the cash register. I'm guessing the results won't change very much, but feel free to check that.

Sometimes a sleuth has to go with a hunch. I noticed from the sales tax data that there is only one state in the U.S. where the maximum sales tax rate falls in the range from A to B. That's New York, where the maximum sales tax rate is 8.875%. Digging a little further, one discovers that this statewide maximum is attained in only one city, New York City. So if I had to guess, I'd guess that the local sales tax rate was 8.875% and that the photo was taken in NYC.

Monday, May 4, 2015

An Open-Ended Problem

Study the numbers in this photo until a question occurs to you. Then answer your question. Repeat as desired.

Feel free to post your responses in the comments! I'll write up mine in a future post.

Thursday, April 16, 2015

Favorite Genre Fiction

My colleagues and I travel for work, so we trade genre authors the way gamblers trade betting tips. "Did you see there's a new Arnaldur IndriĆ°ason out?" we'll say. Or, "Don't bother with the new Clancy unless you're desperate." As a public service, here's my genre fiction hall of fame.

Top Drawer

James M. Cain, Mildred Pierce

Raymond Chandler, The Lady in the Lake and The Long Goodbye

Umberto Eco, The Name of the Rose

James Ellroy, The Cold Six Thousand

Alan Furst, Kingdom of Shadows and Dark Voyage

Joe Gores, Cases

P.D. James, The Lighthouse

Philip Kerr, Berlin Noir

Imre Kertesz, Detective Story

Elmore Leonard, When the Ladies Come Out to Dance (short stories) and Tishomingo Blues (short stories). (Not sure which of his novels to start with.)

Michael Malone, Uncivil Seasons, Time's Witness, and First Lady

Hilary Mantel, Wolf Hall (haven't read the second novel yet)

George Simenon, the Maigret mysteries; try A Maigret Trio for a start.

Robert Louis Stevenson, Treasure Island

J.R.R. Tolkein, The Hobbit and The Lord of the Rings


James Lee Burke, certain of the Dave Robichaux novels; try The Tin Roof Blowdown for a start.

Michael Connelly, certain of the Harry Bosch novels; here are the first three.

Jonathan Lethem, Gun, With Occasional Music

John Mortimer, The Best of Rumpole

Joyce Carol Oates, Mysteries of Winterthurn

Robert Parker, certain of the Spenser novels

Louise Penny, certain of the Inspector Gamache novels 

Derek Raymond, How the Dead Live

Jacqueline Winspear, Maisie Dobbs

Next time you're on a plane, any of these books will give you a couple of hours' escape. Many are so good that you might find yourself rereading them at home. A few would qualify as literature. Note, some are pretty hard-boiled and not all are appropriate for the faint of heart.

One other general note: A good way to identify candidate novels is to look at prestigious awards such as the Edgar. Previous winners of the Edgar award are listed here on Wikipedia.

There's a lot more out there; for example, I still want to read Patricia Highsmith, and many others. Feel free to add other greats in the comments. If you do, be very selective—home runs only! Your travel-weary friends will appreciate it.

Wednesday, April 15, 2015

Why are you allowed to solve pairs of linear equations by adding the equations?

If you ever take an introductory physics course, there will almost certainly come a time when you find yourself analyzing an Atwood machine using Newton's Laws. The analysis yields simultaneous equations for the tension in the rope, T, and the acceleration of the system, a:

T  mg = ma 

Mg  T = Ma.

If all you want is the acceleration of the system, then a quick way to eliminate the tension variable would be to add the two equations. That works nicely in the present case, because the coefficients of T in the respective equations are equal and opposite.

The tactic works, here—but why is it allowed in the first place? Have you ever wondered why you are allowed to add equations? After all, equations aren't numbers, they are more like sentences...why can you add them, then? And if you can add equations, then come to think of it could you also multiply two equations? Would that be allowed? Would it ever be helpful?

In case you have ever wondered about this, here are some observations about what is going on.

Theorem ("adding equations"). If

A = B 


C = D, 

then we must also have

A + C = B + D.

Proof. Clearly, A + C = A + C. And since A = B and C = D, on the right-hand side of this equation we may replace A with B and C with D.

This shows that "you can add simultaneous equations" and the result will be an equation that also holds, provided the original two equations do. The sum of two things viewed one way must be equal to the sum of those things when each is viewed in an equivalent way.

In the theorem above, the quantities A, B, C, and D don't have to be two-variable expressions. The quantities could be matrices, squares of partial derivatives, indefinite integrals, really any sorts of objects that can be added together.

In particular, it is possible to add one-variable equations, although we don't find ourselves doing that very often. For example, suppose that a number x is known to satisfy both of the following equations:

2x + 5 = 8 + 5x

2x6 = 8 + 4x.

Of course, either of these equations would be pretty easy to solve in itself. But an even faster way to find x is to add the two equations. The answer emerges immediately, as you can check for yourself.

Here is another one-variable example: Find all real numbers x satisfying both of the following equations:

In this case, solving either of the equations directly would be a little daunting. But you might be able to get somewhere if you add the two equations and look carefully at the resulting equation.

Multipying equations

You can also multiply simultaneous equations. Here's why: if A = B and C = D, then from the fact that AC = AC we must also have AC = BD. The product of two things viewed one way must be equal to the product of those things when each is viewed in an equivalent way.

Multipying equations doesn't come up nearly as often as adding. But here is an example in which the technique proves useful. Find all pairs of real numbers (x, y) satisfying both of the following equations:

Try it by multiplying the two equations. You should find the value of one of the variables immediately.

Here is another example: Show, by multiplying the equations, that any solution (x, y) of the system

x + 1 = 5  y 

1 + x = 5 + y

must be located a distance of 5 units away from the point (1, 0). 

You don't have to graph anything to solve this problem, but here is what a graph of the situation looks like. Curves are shown for each of the two given linear equations, as well as the nonlinear equation that results from multiplying them together:

Another way to look at it

Let the symbols p, q, s, and t stand for any sort of objects—they could be indefinite integrals, Medicare billing codes, filenames, or letters in an encrypted message. And suppose F is just about any function of these quantities taking two arguments. Then, after all, it's pretty easy to see that

p = q and s = t together imply F(p, s) = F(q, t).

In the algebraic problems we considered above, F was either the sum function F(j, k) = j + k or the product function F(j, k) = j × k. But as this formulation shows, the reasoning we were using was much more general than any particular notions of adding, multiplying, or even algebra.

Concluding note

Some colleagues of mine have been kind enough to discuss these topics with me over the past few days, and our discussion has included some useful perspectives and takeaways, so I thought I'd touch on a couple of those here at the end.

First, the language of "adding equations," or subtracting them, or taking linear combinations of them, etc., is universal in classrooms, and it serves a function in the discourse so I'm not recommending that teachers or students avoid this language. Rather, if there is a point for practitioners here, it is that when students are being taught to add equations, they should also be taught why the technique works.

Second, while adding equations and multiplying equations can both be justified using the same logic (and I showed examples of both in order to throw that logic into relief), I should not give the impression that adding equations and multiplying equations are equally important in the curriculum. Adding equations is much more important than multiplying them. Linear systems are ubiquitous; they are more central to the curriculum than nonlinear systems, and moreover adding and subtracting equations is a special case of adding linear combinations of equations, which is an early phase in the study of linear algebra. Here, for example, is a page from Gilbert Strang's Introduction to Linear Algebra:

Finally, as this image shows, there is a graphical side of the story that plays out in tandem with the syllogistic reasoning that I have related. It is interesting, and useful, for students to follow how the lines described by the equations transform as the equations are combined, always maintaining the same intersection point.

Sunday, April 12, 2015

Some survey data on the public's abortion views

In my earlier post on this subject, I posed the question
For each n = 1, 2, 3, ..., what percentage of Americans would outlaw abortion-on-demand in week n if they could do so? Is there any research on this?
In January, Vox's Sarah Kliff pointed to some partial survey data about this question. Here is the graphic she showed:

This is by trimester, not by week, but the trend is still pretty clear: the later the pregnancy, the more agreement there is that an abortion should be illegal; the earlier the pregnancy, the more agreement there is that an abortion should be legal.

The above data comes from a Gallup Poll that I had missed until now. Here are the raw numbers:

People do love their bar graphs, don't they? Instead, let's look at the data on a scatterplot, since it's really a time-series:

The green circles are the "should be legal" data points, the blue triangles are the "should be illegal" data points, and the black squares show the sum of the two percentages. (To make the graph, I assigned each Gallup data point to the last month in each given trimester.)

There is a lot of blank territory in the region from 0–2 months. One way to estimate those percentages is to fit the data with a logistic curve:

The logistic fit to the data is pretty good, including the "accelerating consensus" effect shown by the u-shaped black curve. (This was to be expected, because the closer you get to the extremes, the less you expect people to dodge the question.)

Here are the extrapolated percentages based on the fit, shown with open circles, open triangles, and open squares:

Based on this exercise, I'd say it's a pretty good estimate that upwards of 80% of Americans want abortion to be legal during the first month of pregnancy. I wonder, then, if abortion rights advocates over the past decade or two have made a mistake by not introducing the time variable more clearly into the abortion debate. In recent years, hundreds of laws have been passed all around the country that make it harder for women to get abortions—regardless of how early they are. It seems to me that this has been a major tactical victory for the 10–15% at the lower left of the diagram.

Wednesday, April 1, 2015

Sorting Out Homophones, Homonyms, and Homographs

My kids and I have been playing word games about homophones, words that sound the same even though they are different. The word homophone is an apt name for these words, because homophone comes from Greek words meaning "same sound."

Homophones can be divided into two classes, those that have the same spelling and those that don't:

  • CAN you hand me the oil CAN?
  • OUR trip lasted an HOUR.

Meanwhile, words that are spelled the same even though they are different are called homographs. The word homograph is also apt, because it comes from Greek words meaning "same writing." Homographs can also be divided into two classes—those that have the same pronunciation and those that don't:

  • CAN you hand me the oil CAN?
  • His BOW stilled at last, the violinist took a BOW.

Words with the same spelling and the same pronunciation are called homonyms. This word is apt because it comes from Greek words meaning "same name," and if it ever happens that two persons have the same name, then their names are the same whether written or spoken.

So far, all of this makes great sense. Unfortunately, the usage of these terms gets more complicated. Some people apparently use homonym as a synonym of homophone, while others use homonym as a synonym of homograph.The result is that as things stand, homonym is a pretty meaningless term. I plan to continue using it anyway, according to its strict sense of words like CAN/CAN that are spelled the same and pronounced the same even though they are different. In short,

Homonym = Homophone + Homograph.

More difficulties arise because while we have the homo- words available to describe these properties, we seem to lack a coherent set of hetero- words to describe their absence. Disastrously for the logic of the situation, the word heteronym is standardly used to describe words like BOW/BOW that are spelled the same but pronounced differently. Logically however, BOW/BOW ought to have been called a heterophone, to indicate that the two words sound different.

Surprisingly, the word heterophone does not appear in either of my reference dictionaries, the American Heritage Fourth Edition or the Random House Unabridged. So if necessary let's coin it here:

Heterophone: a word that is pronounced differently from another.

Let's also coin another word that appears in neither of my dictionaries:

Heterograph: a word that is spelled differently from another.

(Beware that if you search the Web for "heterophone," you will find a definition on I don't consider wiktionary to be a real reference, but in any case the definition given there for heterophone is madness. They say that a heterophone is a word that is spelled and pronounced differently from another. But how can you use a -phone word to refer to a property of spelling?? Shut down the browser and stick to books for this kind of thing.)

To summarize so far, here is how I would carve up this area of the world:

  • CAN and CAN are homophones and homographs (and, thus, homonyms).
  • OUR and HOUR are homophones and heterographs.
  • BOW and BOW are heterophones and homographs.
  • CAT and DOG are heterophones and heterographs.

Logical, right? What the system lacks, though, is a single term for cases like OUR/HOUR, or a single term for cases like BOW/BOW. This is tricky, because you have to find a single term that captures two dimensions at once (sound and spelling). And ideally you want homo[x] and hetero[x] to designate mutually exclusive, jointly exhaustive categories.

As a first step, I will offer another new word:

Quasinym: a word that is a homophone or a homograph, but not a homonym.

So OUR/HOUR and BOW/BOW are quasinyms, and this is apt since quasi- means "to some degree," and thus quasinym refers to words that are "almost but not quite homonyms."

But what about cases like OUR/HOUR specifically? Or BOW/BOW specifically? I think we can appeal to context to save us. Heterographs, after all, come in two varieties, those like OUR/HOUR that are interesting and those like CAT/DOG that are not. How often will we mean the latter variety when using this discourse? Pretty much never. Likewise, in actual use, heterophone will always refer to cases like BOW/BOW rather than cases like CAT/DOG.

And there is no strong need to coin a term for CAT/DOG, because again the actual discourse mostly sets these cases aside from the outset. That said, a possible choice for this category could be

Antinym: a word that is a heterophone and a heterograph.

This makes for a nice progression of "specialness," antinymquasinymhomonym.

Our final system is as follows:

  • CAN and CAN are homophones and homographs (and, thus, homonyms).
  • OUR and HOUR are homophones and heterographs (and, thus, quasinyms).
  • BOW and BOW are heterophones and homographs (and, thus, quasinyms).
  • CAT and DOG are heterophones and heterographs (and, thus, antinyms).

Within the discourse of wordplay, where antinyms aren't really "live," the word heterograph serves to identify cases like OUR/HOUR, and the word heterophone serves to identify cases like BOW/BOW.

UPDATE 4/1/15: Some Web searching suggests that linguists do observe these terms, classifying OUR/HOUR as heterographic homophones (or homophonic heterographs) and classifying BOW/BOW as heterophonic homographs (or homographic heterophones). This is more precise than just leaving it up to context. One could designate CAT/DOG similarly as heterophonic heterographs (or heterographic heterophones).

Friday, January 30, 2015

Bad Johnny, Cont'd

When last we saw Bad Johnny, he had written out all of the number words from ONE to ONE MILLION. Reader jeff correctly analyzed the situation in his comment. In Johnny's work there were 999,000 instances of the letter A. Moreover, the G's, X's, and W's were equinumerous, in view of the fact that EIGHT/EIGHTEEN/EIGHTY, SIX/SIXTEEN/SIXTY, and TWO/TWELVE/TWENTY are the only number-naming words that use these respective letters (one occurrence of the given letter in each case), and since the rules for assembling number names treat all three cases symmetrically.

That's a hand-waving argument, of course. A proof might go something like this:
  1. Start by showing that for a number N with number word [N], the number of w's in [N] equals the number of 2's in N.
  2. Hence, the total number of w's in the sequence ONE to ONE MILLION equals the total number of 2's in the sequence 1 to 1,000,000.
In like fashion,
  1. Show that for a number N with number word [N], the number of x's in [N] equals the number of 6's in N.
  2. Hence, the total number of x's in the sequence ONE to ONE MILLION equals the total number of 6's in the sequence 1 to 1,000,000.
  1. Show that the total number of 2's in the sequence 1 to 1,000,000 equals the total number of 6's in the sequence from 1 to 1,000,000.
  2. Hence, the number of w's in the sequence ONE to ONE MILLION equals the number of x's in the sequence ONE to ONE MILLION.
Some notes:

Step 1 can be approached in cases. First show that the proposition holds for the numbers 0–9. Proceed next to consider numbers 10–19. Next, 20–29. Next, 30–99. Then (using the foregoing results) 100–999. From that point, the extension to higher numbers is fairly easy, since the numbering system for long numbers proceeds by (1) naming the three-digit chunks as if they were amounts of hundreds, and (2) replacing commas with "period words" (..., BILLION, MILLION, THOUSAND—none of which will affect the w count).

(The only wrinkle here arises when the last three digits of the number are all 0. In a case like this, we don't say "ONE MILLION ZERO," for example. But since the absence or presence of ZERO doesn't affect the number of w's, this feature of the naming system doesn't affect the conclusion.)

Step 5 can be proved in lots of ways. For example, picture an old-fashioned car odometer that starts at 000000, goes all the way up to 999999, and then rolls over to 000000. All in all, the leftmost wheel turns once, the next wheel turns ten times, and so on down to the rightmost wheel, which turns a hundred thousand times. The point is, each wheel turns an integral number of times. On any one of these turns, on any one of these wheels, 2 faces outward once and 6 faces outward once; hence, 2 and 6 face outward the same number of times altogether.