Thursday, December 13, 2007

Tricky Triangles

One of the items I find in the comics area of my newspaper, the Richmond Times-Dispatch, is an item for children called Kidspot, by Dick Rogers. I have been watching these Kidspot cartoons ever since one such item suggested nonsensical notions like that of an eyeball room (I never want to be in one of those) or an eardrum stick, which would be met with disapproval by health professionals. See my companion blog, Beyond Opinion, for details.

Today I found another questionable cartoon. It consists of this arrangement of dots:

.

The text runs:

TRICKY TRIANGLES. How many triangles can you make by connecting three dots at a time? Connected triangles can count as larger triangles.

I am not sure what Dick Rogers means by connected triangles being larger triangles. This is what he gives as the answer:

Ans: There are 24 possible triangles.

This is wrong. There are 50 possible triangles. To show this, note that there are eight dots, and that any three dots either define a straight line or define a triangle. The total number of collections of three of these dots is:

C8,3 = 8!/3! = 1*2*3*4*5*6*7*8/(1*2*3)*(1*2*3*4*5)

=(8*7*6)/(1*2*3) (since the 1*2*3*4*5's cancel)

= 56.

There are 6 ways of constructing straight lines. There are two vertical lines, and four straight lines that make one X on top of another one. Subtracting this from 56 gives 50 possible triangles.

Here are some possible triangles:





Mr. Rogers should have checked his calculations. Maybe he did not consider the magenta or green triangles.

Monday, July 09, 2007

Sodoko

One of the latest crazes to hit the world recently is Sudoku, the game of Number Place, wherein you are given a 9x9 square divided into 3x3 squares or blocks, with some of the cells filled in with numbers from 1 to 9. The object is to fill the remaining cells so that each row, column and 3x3 block has one and only one of each number from 1-9. That automatically makes a completed Sudoku puzzle a Latin Square.

Just today I received in the mail a book written by Philip Riley and Laura Taalman, entitled Color Sudoku. It is a collection of unusual Sudoku puzzles. The cells in these puzzles are colored with usually 9 colors, and the object now is to make it so that you have one and only one of each color in each row, column, and color; or in some cases, in each row, column, 3x3 block, and color. Some of these have each position in the blocks as a separate color. For example, the upper left cell of each block will be one color, the center left will be a different color, and so forth.

I call this game Sodoko, and I would like to show why I call it that and show an interesting symmetry; in particular, for each Sodoko puzzle, there is another Sodoko puzzle that looks completely different, yet is essentially the same puzzle; I call this the "dual puzzle".

In an ordinary Sudoku grid, some of the cells are filled in with numbers. For example, in row 3, column 6, there could be a 7. This can be thought of as the triple 367. However, we can break down the 9 digits into doubles of digits from 0, 1, and 2: 1 is 00, 2 is 01, 3 is 02, 4 is 10, 5 is 11, 6 is 12, 7 is 20, 8 is 21, and 9 is 22. Then our cell with the 7 in it can be expressed as 021220. This shows that each filled cell can be represented as a 6-tuple of elements from {0, 1, 2}, or alternatively, as a 6-tuple of elements from the finite field of 3 elements, Z3. A Sudoku puzzle then is a database, where there are 6 fields, and each record has an element of Z3 in it for each field.

The requirement that there be only one and only one digit of each kind in each row can be expressed by saying that if you specify only fields F1, F2, F5, and F6, then the resulting database contains no duplicates. In SQL language, that could be rendered as something like "select F3, F4, F5, F6 from sudoku". The requirement then says that this query contains no duplicates and contains each combination of digits in F3 and F4. Note that we omit F1 and F2 from the fields, so we can say that this requirement is a 12 requirement.

The requirement that there be only one and only one digit of each kind in each column can be expressed by saying that if you specify only fields F3, F4, F5, and F6, the resulting query has no duplicates and contains each combination in fields F1 and F2; hence this is a 34 requirement. Finally the requirement that each 3x3 block has one and only one digit of each kind is the same as saying that if you specify only digits F2, F4, F5, and F6, there are no duplicates. So we say that this is a 24 requirement. This is because specifying F1 and F3 specifies a 3x3 block. Note that the three requirements can be diagramed 12. 24; 43, and this diagram would have 1 and 3 at the upper corners of a square, and 2 and 4 at the lower cornerss. Connecting the diagram using 12. 24; 43 results in something that looks like a U, and I note that there are two U's in "Sudoku".

How about the requirement that each color has one and only one of each digit? That can be thought of as specifying F1, F3, F5, and F6 and requiring that this have no duplicates. This is because F2 and F4 describe the coordinates within a 3x3 square, for example, 12 is the bottom center cell of the square. All the bottom center cells is a color. So now we are including requirement 13, which connects the two top ends of the U and makes it into an O. So likewise, I replace the U's in "Sudoku" with O's and get Sodoko.

I also note that each Sodoko puzzle has a twin puzzle that looks different but is essentially the same puzzle. This is done by interchanging fields F2 and F3. A row is represented by the first two coordinates, but now this is F1 and F3, so this corresponds to a block in the original puzzle. A column now corresponds to a color. A block corresponds to a row, and a color corresponds to a column. I call this the dual puzzle of the original puzzle. Therefore the two puzzles have equal difficulty, and if you complete one, you can complete the other simply by reading the numbers off from the first puzzle.

Sodoko is in some ways more satisfying than Sudoku, as it is more symmetrical. It is a little harder, and adds a bit of pizzazz to Sudoku, so go buy "Color Sudoku" and try a few of them.

Thursday, June 14, 2007

Virginia's 74th Magisterial District Democratic Primary

On 2007 June 12, primaries were held in the state, or Commonwealth, of Virginia. Among these were the Democratic primary for the 74th Magisterial District, which includes a huge portion of Henrico County and parts of the cities of Richmond and Hopewell and Charles City County. This primary was hotly contended by five candidates. It looked like a four-candidate race until Joseph D. Morrissey, a former Commonwealth's Attorney, barged into the race. Here are the results:




Joseph Morrissey2,05538 %
Floyd Miles1,48827 %
J.M. "Jackie" Jackson 1,05319 %
David Lambert54510 %
Shirley McCall Goodall 2855 %

Morrissey won easily, leading his next challenger by 11%. Sic semper tyrannis. This character has been disbarred by the Virginia bar and cannot practice law. He has gotten into two fist fights with others in the courtroom, and has been the object of lawsuits and has served time in jail. How did he get elected, then? Part of it was that the people don't like what government is doing. That is why Morrissey, a white person, got a huge vote in a mostly black district. But that does not explain it all. 62% of the voters voted against Morrissey; they voted for someone else. So how did Morrissey win?

It is the election system that allowed him to win. The 62% that were opposed to him split among four candidates. All of Morrissey's support went to Morrissey. So Morrissey won. Is this a fair system? I wouldn't think so. 62% of the electorate did not want him in. However, 95% did not want Shirley Goodall elected. But Shirley has hit no one, that I know of, has not served jail time or otherwise been controversial. The difference is that although Morrissey was first place among 37% of the voters, I suspect most of the rest rated him last or next to last.

That is why a runoff system would be better. In that system, if a candidate wins more than 50% of the vote, he wins. Otherwise, there is a runoff election involving only the top two candidates. If that had happened, I suspect the result would have been something like:


Floyd Miles 3,07157%
Joseph Morrissey2,35543%


This is because all but 300 of the voters of the other candidates voted for Miles rather than Morrissey (these figures are hypothetical). The flaw with the existing system is that although it reflects voters' first choice among those running, it does not reflect their second or later choices.

This type of paradox has happened before, sometimes with devastating results. In Chile, Salvador Allende was elected president in a three-way race; his percentage was in the upper 30s. He was a Marxist, and that displeased some people in the administration of the United States. Some undercover figures there engineered a coup, resulting in a repressive dictatorshop under Augusto Pinochet for many years. In Minnesota in the late 1990s, the world champion wrestler Jesse Ventura won as an independent over the Democrat and Republican with a vote in the mid to upper 30s. I don't know if Jesse would have won if a runoff had occurred.

There are other voting systems around. An improvement in the runoff scheme is what I call the Olympic system, because the Olympics use it to decide sites for their Games. In this system, if a majority vote occurs, that wins the election. If it does not, the last place city is dropped from contention and another runoff occurs. If a majority occurs, that wins the election. Otherwise, the last place of those remaining is dropped and another runoff occurs. This continues until a majority occurs, which it will unless it ends in a tie between the remaining two candidates. There are flaws in these systems as well. No system will be perfect.

One system seems to stand out. In approval voting, voters are asked to pick any number of candidates, not necessarily one. Of course voting for all the candidates is equivalent to throwing your vote away, because you are not expressing a preference among them. This system (and all the others I have described here) are the same for two-candidate contests. In a three-way contest, voting for two of the candidates is effectively a vote against the third one. This allows voters to express dissatisfaction with a candidate. The Mathematical Association of America and American Mathematical Society use this system in their elections.

I suspect that if approval voting had occurred, so many votes for {Miles, Goodall, Jackson, Lambert} would have occurred that there is no way Morrissey would have won.