## Tuesday, June 4, 2019

### day-knights and night-knights

In his book To Mock a Mockingbird, Raymond Smullyan provides another variation on his classic 'knights and knave' puzzles, in which he imagines the puzzle solver not visiting an island, but exploring a bizarre underground city.

Illustration from The Child of the Cavern:
Or, Strange Doings Underground (sometimes published as
The Underground City) by Jules Vern

In the strange community of Subterranea, visitors cannot tell day from night, but the residents can. The residents are of two types: day-knights or night-knights. Day-knights tell the truth during the day and lie at night, while night-knights tell the truth at night and lie during the day.

Several Subterranea puzzles are presented in To Mock a Mockingbird, but we want more. If we consider a long enough list of statements that Subterraneans might make and  the possibilities presented if we have two inhabitants speaking, we should be able to generate quite a few puzzles.

Let's use these 22 statements:

0: I am a day-knight, and it is day
1: The other person is a day-knight, and it is day
2: I am a day-knight, and the other person is a day-knight
3: I am a day-knight, and it is night
4: The other person is a day-knight, and it is night
5: I am a night-knight, and the other person is a day-knight
6: I am a night-knight, and it is day
7: The other person is a night-knight, and it is day
8: I am a day-knight, and the other person is a night-knight
9: I am a night-knight, and it is night
10: The other person is a night-knight, and it is night
11: I am a night-knight, and the other person is a night-knight
12: It is day
13: I am a day-knight
14: It is not night
15: It is night
16: I am a night-knight
17: It is not day
18: At least one of us is a night-knight
19: At least one of us is a day-knight
20: We are both night-knights
21: We are both day-knights

Some of these are simple statements about the day or the type of one of the inhabitants, others are compound 'and' statements that combine two simple statements. When a compound statement uses "and" to join two simple statements, both simple statements need to be true in order for the compound statement to be true, but only one simple statement needs to be false in order for the compound statement to be false.

truth table for A and B

If the first inhabitant make statement 1, and the second inhabitant make statement 8, we get puzzle 5 (shown below). You can try to solve it here.

It turns out (not surprisingly, as we will see below) that both inhabitants are lying, at least somewhat.  It must be that it is night, and that both inhabitants are day-knights.

Here's one way to puzzle it out:

• If the first person was telling the truth, there is one possibility: it is day, the first person is a day-knight, and the second person is a day-knight. There are 3 ways they could be lying.  If it is day, then they would have to be a night-knight, and the other person would also have to be a night-knight. If it is night, then they have to be a day-knight, and the other person could be either a day-knight or a night-knight.
• If the second person is telling the truth, there is one possibility: it is night, the first person is a night-knight, and the second person is a night-knight. As with the first person, there are 3 ways the second person could be lying. If it is night, second person must be a day-knight, and the first person could either be a day-knight or night-knight. If it is day, then the second person must be a night-knight, and the first must be a day-knight.
• The only option from both sets of possibilities is that it is night and that both inhabitants are day-knights.
In the set of 22 x 22 combinations of two statements how many lead to puzzles with unique solutions? It turns out that only 90 puzzles emerge - the graph below shows white squares for all combinations that lead to valid puzzles, black squares for those that do not.  It doesn't matter which inhabitant is making a particular statement, leading to the symmetry in the graph and duplication in the puzzles (if you don't care about statement order).

puzzles generated by the 22 statements

We can see that two statements in particular lead to almost complete horizontal and vertical lines of well-formed puzzles. These lines are puzzles that involve statements 3 and 6:

3: I am a day-knight, and it is night
6: I am a night-knight, and it is day
Each of these statements on its own narrows the field of possible solutions considerably. For example, if an islander says "I am a day-knight, and it is night," they must be lying. Moreover, we know that they cannot be a day-knight in the day, or a night-knight in the night. This leaves one possibility: that it is day and that they are a night-knight.

As expected from the symmetry of the statements, in the valid puzzles it is just as likely for it to be day as night, and it is just as likely for the inhabitants to be day-knights or night-knights.

day and night are equally likely

But not everything is balanced in Subterranea. In the example above (puzzle 5), and in puzzles generated by statements 3 and 6, we find the inhabitants of Subterranea being less than truthful. In fact, in all the puzzles generated, at least one of the inhabitants is lying - never do both tell the truth at the same time. The graph below shows puzzles where one inhabitant is lying in light blue, and where both inhabitants are lying in white.

Subterranea: not great for tourists

Perhaps it is their preference for AND conjunctions that leads the Subterraneans to have problems with telling the truth?

The Subterraneans might remind you of the inhabitants of the Isle of Dreams - a key difference between the Subterranean puzzles and the Isle of Dreams puzzles presented on this page is that the islanders do not link their statements using AND - each statement is distinct.

Both Subterranea and the Isle of Dreams are examples of a puzzle category that also includes standard Knights and Knaves, the Lion and the Unicorn, the Unreliable Guards, Tiger or TreasurePortia's Caskets, and many others. A bunch of these puzzles are collected here.

## Thursday, May 9, 2019

### star polygon fun

Star and compound polygons are pretty mathematical objects that are fun to draw or create in code.
star and compound polygons
on 2 to 9 vertices

You might draw ten pointed polygons while exploring the multiplication table, for example. In the picture below, skip counting by 6 while drawing a line between the last digits of consecutive numbers gives us a pentagon: counting 0, 6, 12, 18, 24, 30 we draw lines connecting 0, 6, 2, 8, 4, and 0.

skip counting by 6 draws {5/2}

When drawing star and compound polygons by hand, you start with n points spaced evenly around a circle, and then from each point connect to another, always skipping over the same number of points. If you skip over 0 points, you get the regular n-gon. If you skip over k points, and k+1 is relatively prime with n, you will get a star polygon, if n and k+1 share factors, you get a compound of several regular or star polygons.

On 9 points, skipping over 0, 1, 2, and 3
vertices

It is interesting how an easy to describe algorithm like this, skipping around points on a circle, translates into a program.

The polygons on this page are drawn using some JavaScript (code here), which includes some use of trig functions to place the initial vertices (like points around a unit circle) and modular arithmetic to help traverse the list of points in a circular way. It's a nice example of how math makes its way into how we implement even simple algorithms.

When we go fully over to a mathematical way of expressing how to draw these by using desmos, we can see how mathematics can, in this case, express the algorithm in a surprisingly compact way. You can check out the graph here.

desmos sketch of {7/2},
graph here

star polygon page
star polygons in desmos
polygons in the multiplication table

## Wednesday, May 8, 2019

Like Lissajous figures, Chladni figures provide a surprising and aesthetically engaging example of wave interaction.

Named for Ernst Chladni, these figures represent nodal patterns formed by vibrating surfaces. Traditionally, these are formed placing fine particles on a surface, like a sheet of metal that is set vibrating (a violin bow against an edge of the metal plate is one popular method). The particles settle in the areas of the surface that have the least motion - the nodes. When you achieve a resonant frequency, a characteristic pattern emerges.

In past posts I've pointed to code that draws Chladni figures using R (here and here), and using JavaScript. Maybe not surprisingly, you can also play around with Chladni-like figures using Desmos, and this may be the most accessible way to explore them them and appreciate how they are generated from the sinusoidal functions.

In Desmos, you can create images similar to these using inequalities. The equations are reasonably straight forward - the graph here will draw the figure across the whole plane - best results are seen when zooming in on a small region.

graph here

Try playing around with the desmos graph here, R scripts for generating figures are found here, the JavaScript Chladni generating page is here.

Update
After posting on Twitter, the desmos sketches were improved by   and @PaulaKrieg. Here are some other graphs inspired by their changes:

two distinct inequalities

A Chladni-like pattern with three distinct
inequalities

With the added layers, the Chladni patterns are approaching an abstract William Morris appearance.

Another Update
This other graph allows you to experiment more directly with the Chladni figures, similar to the web page mentioned above.

graph for building

## Wednesday, April 17, 2019

### why horizontal transformations are tricky

Both the Common Core and Ontario curricula ask students to look at families of functions that are connected to each other through simple transformations, and to build new functions from existing functions.

In Ontario as with the Common Core, students get an understanding of function families "by playing around with the effect on the graph of simple algebraic transformations of the input and output variables." In the Ontario curriculum (MCR3U), students spend a significant amount of time graphing complicated examples from a function family by relating them to transformed graphs of a simple base function.

The base quadratic (purple) and a transformed

When working on these these ideas with students, I've had to ask myself a few questions.

1. What is a valid 'transformation' of the graph of a function, and how are these related to more familiar transformations of the plane?
2. How are the transformations connected to the function definition?
3. Why are horizontal transformations tricky? As noted in the Common Core progression document, "students may find the effect of adding a constant to the input variable to be counterintuitive, because the effect on the graph appears to be the opposite to the transformation on the variable."

Here are some short answers to those questions.

1. The 'transformations' we want to restrict ourselves to are ones that preserve the main characteristics of the graph, these are a reduced set of the affine transformations of the plane: translation, scaling, and reflection. The transformations we want to consider do not include rotation, projection, or shearing. The simple transformations that are included are ones where the x and y coordinates do not 'interact' with each other (the original x value has no impact on the transformed y value, and the original y value has no impact on the transformed x value).
2. It turns out that the transformations of the graph we want (simple affine transformations with no rotation or shearing) are obtained by pre-composition and post-composition of the parent function with single variable linear functions.
3. Horizontal transformations are tricky because they are the result of pre-composition with the inverse of the linear function responsible for the horizontal component of the transformation. When we look at the complicated function and "read off" the transformations, it is akin to looking at linear function and reading off its inverse.

Long Answer, with matrices and diagrams!

We often represent transformations of the plane using matrices. In this case, we would represent dilations, translations, or reflections like this:

There is no interaction between the x and y coordinates - no rotation or shearing. This results in a diagonal matrix, and allows us to represent the transformation as a pair of single variable linear functions.

If a function g is thought of as the result of this transformation applied to the points of the function f, then the diagram below commutes.

But in order to write g in terms of the transformation and f, we need to invert the part of the transformation that is operating on the x values.

And we can write g as:

Spelling this out with our formulas for the components of the transformation, we can see the messiness that results from composing with the inverse of our original transformation.

What to take away

It helps me to think along these lines, but is there anything here that may help when working on transformed graphs of functions with high school students?

I find that in presenting 'transformations of graphs' to students, we generally don't relate it back to  the transformations they learned about in elementary school, where they explored translations, reflections, dilations, ans rotations. It might be good to make stronger connections with that prior learning, noting that when transforming graphs within a function family, we only use dilation, reflection, and translation.

Function composition is a unifying and clarifying concept. Maybe it makes sense to talk about sooner than is generally done. It is surprising that in grade 11 we talk about inverse functions without exploring function composition. If you are willing to use function composition, you can use arrow diagrams to explore function transformations using a method like the one described here.

Looking more at inverses of linear functions may help provide a way to explain the strange backwardness of the horizontal transformations, even if the connection is not formally demonstrated.

References

The Common Core Standards Writing Team. (2013). Progressions for the Common Core State Standards in Mathematics (draft). Retrieved from http://commoncoretools.me/wp-content/uploads/2013/07/ccss_progression_functions_2013_07_02.pdf

Ontario Ministry of Education. (2007). The Ontario Curriculum Grades 11 and 12, Mathematics, Revised. Retrieved from http://www.edu.gov.on.ca/eng/curriculum/secondary/math1112currb.pdf

Related Post: understanding transformed functions with arrows

## Monday, April 15, 2019

### LaTeX for high school math teachers

TLDR: Please check out the online workshop I am developing for high school math teachers who want to learn about LaTeX. That this community needs  something like LaTeX raises questions about teaching and learning math in online situations.
I have been using LaTeX a lot recently, but not in the way I first used it a long time ago when writing my master's thesis. (Not sure what LaTeX is? Check out the first module of the online workshop here.)

Now I am using it daily to provide feedback to students in the LMS that I teach an online course in (Brightspace), include bits of math on webpages, and avoid the Google Docs equation editor.

With the inclusion of little bits of LaTeX in various digital platforms, the availability of cloud-based authoring systems like Overleaf, and the ability to include LaTeX on any webpage with MathJaX, LaTeX seems everywhere these days (once you start looking). It's not just the Baader-Meinhof phenomenon - the ubiquity of LaTeX is real, and a response to important problem with teaching and learning mathematics on digital platforms.

With the increasing use of digital technology and online learning in secondary schools, knowing a little bit of LaTeX can  help high school math teachers communicate effectively with both students and colleagues. Most LaTeX resources are aimed at researchers and grad students, and are not focused on the use of LaTex in these new situations. So, I am working on an short online "Introduction to LaTeX" workshop  for high school math teachers that focuses on the more on the specific uses that matter to them (please take a look, any feedback is appreciated).

LaTeX is great, but finding ways to get equations into documents do not address the essential challenges that these digital platforms raise for teaching and learning. High school teachers once used hand-written overheads, drew on blackboards, and scribbled in notebooks - now we share discussion posts, emails, and send documents back and forth in our LMSs. In these new digital forums, how do we show messy "live" examples of doing mathematics, rather than presenting an overly polished finished product?

## Thursday, February 14, 2019

### of words and frogs

Inspired by Lillian Ho's article on using origami with adult ESL learners (see references below), I decided to build a lesson for high school ESL students around the hopping frog model.

The basic activity went like this:
1. Students were shown how to fold the model without being given any verbal instructions.
2. Students were given a version of the instructions with all written instructions removed.
3. In groups of 3 or 4, students were asked to provide written instructions on chart paper to go along with the diagrams.
4. The written instructions were shared by placing the chart papers up around the class, and students were asked to identify the important words that were used in the instructions.
5. As a whole class, we folded the frog again, noting the mathematical ways we could describe each step.

If you try an activity along these lines, I expect that should be split over two or three sessions. We did step 1 at the end of another lesson, steps 2 and 3 on a second day, and steps 4 and 5 on a third day.

In thinking about the sort of descriptions that the students should be guided towards, it's helpful to note some of the observations provided in an article by Koichi Tateishi (see references): (1) the written words are not a replacement for the diagrams, but should be thought of as complementary, and (2) we should avoid technical origami terms (mountain fold, squash fold, etc.).

When one group of students uncovered a useful word, it would get written up on the board for all groups to share, so as we went we developed a list of helpful words. With reference to the steps on the instruction page, some words that the students used included or discussed at each step were:

step 1: paper, card, square, rectangle, fold, half, long, short, side, middle, open, line;
step 2: diagonal, top, side, edge;
step 3: do again, repeat, other side;
step 4: turn over, flip, corners, intersection, lines crossing;
step 5: push, pinch, squash, together, peak;
step 6: tip, up;
step 7: center, in, inwards;
step 8: flaps, outside, inside, arms;
step 9: bottom, nose, legs;
step 10: down, knees;

These words were used in the context of providing instructions and directions - a very important type of speech act that students are routinely confronted with.

In the appendix to her article on the benefits of origami lessons for middle school students, Norma Boakes (see references below) provides a great sample mathematical dialog for the jumping frog model (step 5 of our lesson plan). Like Boakes suggests, in our mathematical discussion we talked about rectangles, squares, quadrilaterals, right angles, bisectors, 45 degree angles, triangles, pentagons, right-triangles, parallel and perpendicular lines. Each (now very familiar) step of the frog construction providing a concrete model for the concept we were talking about.

Through this lesson, we learned and reviewed a lot of everyday language around the giving and receiving of instructions that involve everyday spacial terms, and were also able to then apply a mathematical lens to deepen our understanding of what we were doing.

References

Boakes, N.J. (2009). "The Impact of Origami-Mathematics Lessons on Achievement and Spacial Ability of Middle-School Students." In Lang, R.J. (Ed) Origami 4: Fourth International Meeting of Origami Science, Mathematics and Education. Natick, MA: A K Peters Ltd.

Ho, L.Y. (2002).  "Origami and the Adult ESL Learner." In Hull, T. (Ed.) Origami 3: Third International Meeting of Origami Science, Mathematics and Education. Natick, MA: A K Peters Ltd.

Tateishi, K. (2009). "Redundancy of Verbal Instructions in Origami Diagrams." In Lang, R.J. (Ed) Origami 4: Fourth International Meeting of Origami Science, Mathematics and Education. Natick, MA: A K Peters Ltd.

## Tuesday, February 12, 2019

### card puzzles

In these puzzles, each suit is given a value. The value of the card is the face value of the card multiplied by its suit value. Aces may be low (face value 1) or high (face value 11).  Face cards (Jack, Queen, King) have face value 10. Other cards have face value equal to their number.

Puzzle 1 (warm up)
In this puzzle, black cards (spades and clubs) have suit value 2 and red cards (diamonds and hearts) have suit value 3. What is the card value of each card shown?

Puzzle 2 (introducing sets)
When cards are put next to each other, we add their values. In this puzzle, spades have suit value 1, clubs have suit value 2, diamonds have suit value 3, and hearts a have suit value 4. Aces are high. What is the total value of each set?

Puzzle 3
In this puzzle, spades are worth 2. Each set is worth 20. What are the values of the other suits?

Puzzle 4
In this puzzle, Aces are low. The value of each set is shown below it. What is the value of each suit?

Puzzle 5
In this puzzle, Aces are high. The value of each set is shown below it. What is the value of each suit?

Puzzle 6
In this puzzle, Aces are low. The value of each set is shown below it. What is the value of each suit?

Solutions
These puzzles can be solved by modeling the cards algebraically and then solving by substituting in known values.

The first two puzzles require you to evaluate by substituting in the known value of the suits. The five of diamonds is represented by 5d. We know that d = 3, so our card is worth 5(3)=15. Puzzle 3 tells you the value of spades (s), and requires you to find the other values by substituting in known values and solving for unknown values. The remaining puzzles require you to find the value of one of the suits by solving a one-step equation, then find the others by repeated substitution and solving.

puzzle 1: 15, 30, 20, 30.
puzzle 2: 45, 64, 36.
puzzle 3: = 1, = 3, = 1.
puzzle 4: s = 1,  h = 5, c = 7, d = 4.
puzzle 5: s = 2,  h = 6, c = 10, d = 5.
puzzle 6: s = 11,  h = 7, c = 5, d = 2.

## Thursday, January 31, 2019

### Farey Sequences and Ford Circles in JavaScript

Like the phyllotaxis spiral, a nice mathematical figure to draw in code is the sequence of Ford Circles.

A while back I tried generating these using Fathom and Processing - now for fun I've tried them in JavaScript. A page to play with them is here, and the source code is in a Github repo.

On the page, you can control the level of the Farey sequence used to generate the circles - you start off with just 0 and 1:

Using the buttons provided, you can increase the number of terms in the sequence and the corresponding number of circles.

After a certain point, the page does not list the entire sequence associated with the circles.

Update - Ford Circles in Desmos

It's also a nice exercise to create Ford circles using Desmos - here is an example of a graph that does this.

Some Ford Circles in Desmos

Just as with implementing the JavaScript, getting this to work in Desmos first involves creating some fractions, then finding which fractions to include in the Farey sequence, and then drawing circles using the elements of that sequence. The steps that this graph follows are basically:

1. create an mxm set N of numbers (n,d), where n and d are integers 1...m.
2. shift and reduce this set of ordered pairs so that in any given row, 0 <= n < d+1.
3. reduce this set further eliminating any ordered pairs where gcd(n,d) > 1.

These ordered pairs can be treated as fractions (n/d), and we will only have fractions between 0 and 1 that are in reduced form - if we then order these fractions along the number line, we have a 'Farey sequence' of fractions. In this, we didn't use the recursive approach used in the JavaScript example that uses the mediant. Drawing the circles uses the same formula used in the JavaScript example (and the Processing and Fathom examples mentioned above).

Here s is a scale factor, f_q is the quotient and f_d is the denominator of the fractions derived from the sequence N described above.

## Wednesday, January 30, 2019

### an origami surprise

For a recent origami-based math activity, I gave students printed instructions for two origami models: a pinwheel, and an open-top masu box (both from Origami USA).

They were to learn how to fold the models and answer some questions about the results:
Assuming that the paper has length of one unit, without measuring can you determine the perimeter and area of the pinwheel, and the volume and surface area of the box?
I could honestly tell them: I did not know the answers, so they would have to explain to me how they found the results.

Opening up the finished models to reveal the pattern of folds provided a good strategy for getting to the answers. Considering how the folds divided the paper (into sixteen squares) and using the Pythagorean Theorem to calculate the lengths of diagonal folds allows you to get all the lengths you need.

The multiform pinwheel has a crease pattern like this:

And the masu box has the following crease pattern:

When it came time for the answers to the math problems I had posed, I had a mild surprise: two of the quantities that I had asked for came out to the same value - the area of the pinwheel and the outside surface area of the box were identical (3/8 units - interestingly just under half of the paper is exposed, the rest is folded in).

Taking another look at the crease patterns, you can see how the image of the box can be transformed into the pinwheel, demonstrating without calculations that the areas are the same: