mscroggs.co.uk
mscroggs.co.uk

subscribe

Blog

 2016-07-04 
In five blog posts (1, 2, 3, 4, 5) Gaurish Korpal present the Cross diagonal cover problem, some ideas about how to solve it and some conjectures. In this post, I will present my solution to this problem. But first, the problem itself:
Draw with an \(m\times n\) rectangle, split into unit squares. Starting in the top left corner, move at 45° across the rectangle. When you reach the side, bounce off. Continue until you reach another corner of the rectangle:
How many squares will be coloured in when the process ends?

Restating the problem

When I first saw this problem, it reminded me of Rebounds, a puzzle I posted here in 2014. To restate the problem in a similar way, we place a point in the centre of each unit square, then creating a second grid. I will call this the dual grid. The original problem is equivalent to asking, if a line bounces around the dual grid, how many corners will it pass through.
It it worth noting here that the dual grid is \(n-1\times m-1\): each side is one shorter than the original grid.
A corner cannot be travelled over more than twice: otherwise, the line would be retracing its past path; to do this requires it to have already hit a corner of the rectangle. Therefore we can calculate the number of distinct corners travelled to using:
$$\text{Distinct corners visited} = \text{Corners visited}-\text{Corners visited twice}$$

Introducing mirrors

When I solved Rebounds, I imagined the line passing through mirror images of the rectange, rather then bouncing. For our example above, it would look like this:
Looking at the puzzle in this way, it can be seen that the line will travel through \(\mathrm{lcm}(n-1,m-1)\) squares, and so hit \(\mathrm{lcm}(n-1,m-1)+1\) corners (the \(+1\) appears due to fence panels and fence posts). We have shown that:
$$\text{Corners visited}=\mathrm{lcm}(n-1,m-1)+1$$

Collisions in the mirror

To solve the problem, we need to work out how many corners are visited twice; or the number of times the line crosses itself in the rectangle.
To do this, imagine the mirror images of the red line in the mirrors. Ignoring the images parallel to the red line, and terminating the lines when they hit the red line gives the following diagram:
I have added extra rectangles to the diagram so that all the reflections that hit the red line and their starting points can be seen. The diagonal black line has been added because all lines outside that clearly cannot intersect the red line. We now need to justify two claims:
The first claim can be seen by reflecting the green lines and the parts of the red line they hit back into the top left rectangle.
The second claim can be shown in two parts:
First, each line starting from the border will meet the red line on the edge of a rectangle: this is because the green lines all start a multiple of two rectangles away, and meet at half this distance away (and half a multiple of two is a whole number).
Conversely, if a red line meets a green line at the edge of a rectangle, then the reflection of the red line in the edge (ie. the green line) must go back to a starting point on the boundary.

These two claims show that the points where the line crosses itself in the dual rectangle match up one-to-one with the interior points at which the green lines start. So if we can count these points, we can solve the problem.

Counting the interior points

The green lines will start from all points that are a multiple of two rectangles (in both directions) away from the top left. The reason for this can be seen by reflecting the first little bit of the red line in all the mirrors:
We see that the perpendicular green lines that we are interested in, plus many other irrelevant lines, start from a grid of points on the corner of every other rectangle. To count these points, we will extend them into the full square:
To make for clearer counting, I have not drawn the unit squares.
Alternatively, this square can be thought of as being made up from two copies of the triangle.
We next notice that these points can never lie on the diagonal (the diagonal drawn in the diagram): a green point lying on the diagonal would imply that the red line met a corner before it did. Taking out the lines on which the green dots never lie, we get:
We can now count the green dots. In the square above, there are \(\displaystyle\frac{\mathrm{lcm}(m-1,n-1)}{m-1}\) rectangles vertically and \(\displaystyle\frac{\mathrm{lcm}(m-1,n-1)}{n-1}\) rectangles horizontally. Therefore there are \(\displaystyle\frac{\mathrm{lcm}(m-1,n-1)}{m-1}-1\) columns of green dots and \(\displaystyle\frac{\mathrm{lcm}(m-1,n-1)}{n-1}-1\) rows of green dots. (Again, we take one due to fence posts and fence panels.)
Of these green dots, half are in the triangle of interest, so:
$$\text{Corners visited twice} = \frac12\left(\frac{\mathrm{lcm}(m-1,n-1)}{m-1}-1\right)\left(\frac{\mathrm{lcm}(m-1,n-1)}{n-1}-1\right)$$

Putting it together

We can now put the two parts together to get:
$$\text{Distinct corners visited} = \mathrm{lcm}(m-1,n-1)+1 - \frac12\left(\frac{\mathrm{lcm}(m-1,n-1)}{m-1}-1\right)\left(\frac{\mathrm{lcm}(m-1,n-1)}{n-1}-1\right)$$
And we have solved the problem.

Example

For the \(4\times6\) rectangle given, our formula gives:
$$\text{Distinct corners visited} = \mathrm{lcm}(3,5)+1 - \frac12\left(\frac{\mathrm{lcm}(3,5)}{3}-1\right)\left(\frac{\mathrm{lcm}(3,5)}{5}-1\right)$$ $$= 15+1 - \frac12(5-1)(3-1)$$ $$= 16 - 4 = 12$$
This is correct:

Disproving the conjecture

In Gaurish's most recent post, he gave the following conjecture: The highest common factor (or greatest common divisor) of \(m\) and \(n\) always divides the number of coloured squares.
After trying to prove this for a while, I found that me attempted proof required that \(\mathrm{hcf}(n-1,m-1)^2-1\) is a multiple of \(\mathrm{hcf}(n,m)\). However this is not in general true (eg. 15,5).
In fact, 15,5 provides us with a counterexample to the conjecture:
In this diagram, 26 squares are coloured. However \(\mathrm{hcf}(15,5)=5\) and 5 is not a factor of 26.
Tags: puzzles
                        
(Click on one of these icons to react to this blog post)

You might also enjoy...

Comments

Comments in green were written by me. Comments in blue were not written by me.
 Add a Comment 


I will only use your email address to reply to your comment (if a reply is needed).

Allowed HTML tags: <br> <a> <small> <b> <i> <s> <sup> <sub> <u> <spoiler> <ul> <ol> <li> <logo>
To prove you are not a spam bot, please type "elbatnuocnu" backwards in the box below (case sensitive):
 2016-06-29 
In this blog post, I will present two conditions that cause a braid to fail, with reasons why. You can read more about the method of braiding we are talking about here, in part one.
In this post, we will consider the (\(a\),\(b\)) braid with \(a\) slits, taking the \(b\)th thread each time.

Some strands are never moved

If some of the strads are never moved in the braiding process, then the braid will fail. To find out when this happens, I will draw lines to show the moves that are made. For the (8,3) braid, the first move is:
Then the second move is:
And so on until we get:
For the (8,3) braid, every strand is moved at some point in the cycle.
For the (6,2) braid, however, we get the following diagram:
Now some strands are not moved and the braid will fail.
To find out when all the slits are visited, I first label the slots: the slot which starts empty is 0, then I continue numbering anti-clockwise. This numbering puts all the multiples of \(a\) at the bottom slot.
Now let's look at which slots we visit. We start at 0, then visit \(b\), then \(2b\), then \(3b\) and so on. We visit all the multiples of \(b\).
Therefore we will reach the bottom slot again and finish our loop when we reach a common multiple of \(a\) and \(b\). The first time this happens will be at the lowest common multiple, or \(\text{lcm}(a,b)\).
On the way to this slot, I visited one slot for every \(a\) we passed, so the number of slots I have visited is:
$$\frac{\text{lcm}(a,b)}{a}$$
I will visit every slot if:
$$\frac{\text{lcm}(a,b)}{a}=b$$
Or, in other words, if \(\text{lcm}(a,b)=ab\). This is true when, \(a\) and \(b\) have no common factors, or are coprime: often written \(\text{hcf}(a,b)=1\).
Therefore, if \(a\) and \(b\) are not coprime, then the braid sill fail.

The braid results in twists

Some braids, for example (13,3), result in a groups of twisted strands rather than a whole braid.
To see when this happens, imagine the (\(a\),\(b\)) braid just after a thread has been moved. Call the currently empty slit 0. The threads at positions \(a-1\), \(a-2\), ..., \(a-b+1\) have just been jumped over. If, from these threads, the thread at \(a-1\) is moved before the others, then this group of threads will form into a twist.
This will happen when \(b\) is a factor of \(a-1\), as this leads to \(a-1\) being reached before slit 0 is passed again. Therefore is \(b\) is a factor of \(a-1\), the braid will not work.

A conjecture

In this post, I have shown that if \(a\) and \(b\) are not coprime or if \(b\) is a factor of \(a-1\), then the braid will fail. From the examples I have tried (I'm compiling them here), it seems that all other braids will work. It seems difficult, however, to explain why all other braids work. I'd love to hear your ideas on how this could be shown.

What's next?

A have a few leads to follow up on, which may lead to a proof or counterexample. Vicky Neale has found instructions for making Kumihimo braids. They are created in a very similar way to my cardboard braids, so looking into the patterns you can make with them may be helpful.
@mathforge has found a mathoverflow page where quotients of the braid group are discussed. I know from past discussions that the braiding group is not exactly what I'm looking for—for example, the multiple twists is considered a member of the braiding group. However, finding the correct way to adapt the group may solve the problem. Looks like I may have to polish up on my group theory...

Until a proof of or counterexample to the conjecture turns up, we seem to be at the end of the braiding puzzle. But do not fret, there is a related problem that we can now spend some time on.
In the braids we've done so far, we have taken the same jump every time. But more complicated rules could be used: for example, we could alternate between taking the third thread and the second thread. I'm yet to find a rule with different jumps that works, so let me know if you find one before me!
×1                        
(Click on one of these icons to react to this blog post)

You might also enjoy...

Comments

Comments in green were written by me. Comments in blue were not written by me.
 Add a Comment 


I will only use your email address to reply to your comment (if a reply is needed).

Allowed HTML tags: <br> <a> <small> <b> <i> <s> <sup> <sub> <u> <spoiler> <ul> <ol> <li> <logo>
To prove you are not a spam bot, please type "naidem" backwards in the box below (case sensitive):
 2016-06-29 
Since Electromagnetic Field 2014, I have been slowly making progress on a recreational math problem about braiding. In this blog post, I will show you the type of braid I am interested in and present the problem.

Making an (8,3) braid

To make what I will later refer to as an (8,3) braid, you will need:
First, cut an octagon from the cardboard. The easiest way to do this is to start with a rectangle, then cut its corners off.
Next, use the pencil to punch a hole in the middle of your octagon and cut a small slit in each face of the octagon.
Now, tie the ends of your wool together, and put them through the hole. pull each strand of wool into one of the slits.
Now you are ready to make a braid. Starting from the empty slit, count around to the third strand of will. Pull this out of its slit then into the empty slit. Then repeat this starting at the newly empty slit each time. After a short time, a braid should form through the hole in the cardboard.

The problem

I call the braid you have just made the (8,3) braid, as there are 8 slits and you move the 3rd strand each time. After I first made on of these braid, I began to wonder what was special about 8 and 3 to make this braid work, and for what other numbers \(a\) and \(b\) the (\(a\),\(b\)) would work.
In my next blog post, I will give two conditions on \(a\) and \(b\) that cause the braid to fail. Before you read that, I recommend having a go at the problem yourself. To help you on your way, I am compiling a list of braids that are known to work or fail at mscroggs.co.uk/braiding. Good luck!
×2      ×1      ×1      ×1      ×1
(Click on one of these icons to react to this blog post)

You might also enjoy...

Comments

Comments in green were written by me. Comments in blue were not written by me.
@no: yes, although rectangles work surprisingly well
Matthew
   ×1   ×1   ×1   ×1     Reply
Would square cardboard work better than a rectangle
no
×1   ×1   ×1   ×1   ×1     Reply
 Add a Comment 


I will only use your email address to reply to your comment (if a reply is needed).

Allowed HTML tags: <br> <a> <small> <b> <i> <s> <sup> <sub> <u> <spoiler> <ul> <ol> <li> <logo>
To prove you are not a spam bot, please type "raenil" backwards in the box below (case sensitive):
 2016-06-05 
The Game of Life is a cellular automaton invented by John Conway in 1970, and popularised by Martin Gardner.
In Life, cells on a square grid are either alive or dead. It begins at generation 0 with some cells alive and some dead. The cells' aliveness in the following generations are defined by the following rules:
Starting positions can be found which lead to all kinds of behaviour: from making gliders to generating prime numbers. The following starting position is one of my favourites:
It looks boring enough, but in the next generation, it will look like this:
If you want to confirm that I'm not lying, I recommend the free Game of Life Software Golly.

Going backwards

You may be wondering how I designed the starting pattern above. A first, it looks like a difficult task: each cell can be dead or alive, so I need to check every possible combination until I find one. The number of combinations will be \(2^\text{number of cells}\). This will be a very large number.
There are simplifications that can be made, however. Each of the letters above (ignoring the gs) is in a 3×3 block, surrounded by dead cells. Only the cells in the 5×5 block around this can affect the letter. These 5×5 blocks do no overlap, so can be calculated seperately. I doesn't take too long to try all the possibilities for these 5×5 blocks. The gs were then made by starting with an o and trying adding cells below.

Can I make my name?

Yes, you can make your name.
I continued the search and found a 5×5 block for each letter. Simply Enter your name in the box below and these will be combined to make a pattern leading to your name!
Enter your name:
×14      ×15      ×12      ×13      ×13
(Click on one of these icons to react to this blog post)

You might also enjoy...

Comments

Comments in green were written by me. Comments in blue were not written by me.
 Add a Comment 


I will only use your email address to reply to your comment (if a reply is needed).

Allowed HTML tags: <br> <a> <small> <b> <i> <s> <sup> <sub> <u> <spoiler> <ul> <ol> <li> <logo>
To prove you are not a spam bot, please type "bisect" in the box below (case sensitive):
 2016-05-04 
Back in 2014, I calculated the expected cost of filling Panini world cup sticker album. I found that you should expect to buy 4505 stickers, or 1285 if you order the last 100 from the Panini website (this includes the last 100). This would cost £413.24 or £133.99 respectively.
Euro 16 is getting close, so it's sticker time again. For the Euro 16 album there are 680 stickers to collect, 40 more than 2014's 640 stickers. Using the same calculation method as before, to fill the Euro 16 album, you should expect to buy 4828 stickers (£442.72), or 1400 (£134.32) if you order the last 100.
This, however, does not tell the whole story. Anyone who has collected stickers as a child or an adult will know that half the fun comes from swapping your doubles with friends. Getting stickers this way is not taken into account in the above numbers.

Simulating a sticker collection

Including swaps makes the situation more complicated: too complicated to easily calculate the expected cost of a full album. Instead, a different method is needed. The cost of filling an album can be estimated by simulating the collection lots of times and taking the average of the cost of filling the album in each simulation. With enough simulations, this estimate will be very close the the expected cost.
To get an accurate estimation, simulations are run, calculating the running average as they go, until the running averages after recent simulations are close together. (In the examples, I look for the four most recent running averages to be within 0.01.) The plot below shows how the running average changes as more simulations are performed.
The simulations estimate the number of stickers needed as 4500. This is very close to the 4505 I calculated last year.
Now that the simulations are set up, they can be used to see what happens if you have friends to swap with.

What should I do?

The plots below shows how the number of stickers you need to buy each changes based on how many friends you have.
Stickers needed if you and your friends order no stickers.
Stickers needed if you and your friends all order the last 100 stickers. The last 100 are not counted.
In both these cases, having friends reduces the number of stickers you need to buy significantly, with your first few friends making the most difference.
Ordering the last 100 stickers looks to be a better idea than ordering no stickers. But how many stickers should you order to minimise the cost? When you order stickers, you are guaranteed to get those that you need, but they cost more: ordered stickers cost 14p each, while stickers in 6 pack multipacks come out at just 9.2p each. The next plot shows how the cost changes based on how many you order.
The expected cost of filling an album based on number of people in group and number of stickers ordered.
Each of the coloured curves represents a group of a different size. For each group, ordering no stickers works out the most expensive—this is expected as so many stickers must be bought to find the last few stickers—and ordering all the stickers also works out as not the best option. The best number to order is somewhere in the middle, where the curve reaches its lowest point. The minimum points on each of these curves are summarised in the next plots:
How the number you should order changes with the number of people in the group.
How the cost changes with the number of people in the group.
Again, having friends to swap with dramatically reduces the cost of filling an album. In fact, it will almost definitely pay off in future swaps if you go out right now and buy starter packs for all your friends...
×1      ×1      ×1      ×1      ×1
(Click on one of these icons to react to this blog post)

You might also enjoy...

Comments

Comments in green were written by me. Comments in blue were not written by me.
 Add a Comment 


I will only use your email address to reply to your comment (if a reply is needed).

Allowed HTML tags: <br> <a> <small> <b> <i> <s> <sup> <sub> <u> <spoiler> <ul> <ol> <li> <logo>
To prove you are not a spam bot, please type "z" then "e" then "r" then "o" in the box below (case sensitive):

Archive

Show me a random blog post
 2026 

Feb 2026

Christmas (2025) is over
 2025 
▼ show ▼
 2024 
▼ show ▼
 2023 
▼ show ▼
 2022 
▼ show ▼
 2021 
▼ show ▼
 2020 
▼ show ▼
 2019 
▼ show ▼
 2018 
▼ show ▼
 2017 
▼ show ▼
 2016 
▼ show ▼
 2015 
▼ show ▼
 2014 
▼ show ▼
 2013 
▼ show ▼
 2012 
▼ show ▼

Tags

trigonometry noughts and crosses wool football statistics sport pac-man quadrilaterals data visualisation platonic solids christmas reuleaux polygons rust crochet hannah fry a gamut of games latex news wave scattering frobel royal institution books craft pi approximation day speed puzzles graphs zines error bars estimation sound anscombe's quartet matrices graph theory binary folding paper hats 24 hour maths guest posts misleading statistics mathsteroids chess nonograms edinburgh pythagoras matt parker gerry anderson world cup matrix of minors light logs pi tmip correlation signorini conditions hexapawn arithmetic crossnumber fence posts boundary element methods captain scarlet palindromes matrix multiplication martin gardner manchester science festival kenilworth live stream errors bempp mean data thirteen turtles geogebra nine men's morris advent calendar realhats rugby game of life map projections newcastle bodmas fractals databet approximation christmas card triangles reddit accuracy national lottery dragon curves numbers london underground countdown plastic ratio python oeis chalkdust magazine inline code video games cross stitch european cup radio 4 raspberry pi coventry chebyshev youtube warwick tennis bubble bobble bots harriss spiral fonts standard deviation crossnumbers golden spiral big internet math-off propositional calculus menace polynomials machine learning talking maths in public pizza cutting dates regular expressions ternary flexagons inverse matrices coins finite group asteroids the aperiodical mathsjam games computational complexity logic golden ratio simultaneous equations matrix of cofactors finite element method crosswords go exponential growth interpolation electromagnetic field curvature folding tube maps squares cambridge braiding preconditioning programming runge's phenomenon stirling numbers friendly squares partridge puzzle datasaurus dozen manchester recursion sorting weather station logo london alphabets pascal's triangle javascript weak imposition php sobolev spaces phd game show probability probability rhombicuboctahedron final fantasy dinosaurs stickers kings numerical analysis people maths geometry gaussian elimination gather town convergence royal baby dataset hyperbolic surfaces ucl mathslogicbot draughts determinants

Archive

Show me a random blog post
▼ show ▼
© Matthew Scroggs 2012–2026