PARITY by Danny Brown Contents 0. Introduction 1. Cogs 2. Odd blobs 3. Odd cups 4. Coin trick 5. Coins in a row 6. Choco choice 7. Clobber 8. Stomp! 9. Weaving 10. 2-colourable maps 11. 3-colourable maps 12. Closed loops 13. Inside/outside 14. Paths 15. Vertex game 16. Equal rectangles 17. Rolling dice 18. Chessboard parity 19. Wind stations 20. Square sort 21. Number circles 22. Magic squares 23. Seat swap 24. m-n knights 25. Error correcting codes 1 0. Introduction Parity is an important idea that helps us solve many problems and prove many results in maths. Often a very simple argument involving oddness or evenness can unlock a seemingly difficult problem. You will probably have used parity in the past without realizing it. Here is a classic proof that uses parity in a very powerful way. Suppose you can write 𝑛 √2 = 𝑚 where n and m are relatively prime (so that n and m is simplified as far as possible. Squaring both sides gives 2= 𝑛2 𝑚2 which we can rearrange to give 2𝑚2 = 𝑛2 [*] So 𝑛2 must be even, and so n must be even (as even x even = even). So we can write n = 2k for some integer k. Now we can substitute this into [*] to give 2𝑚2 = (2𝑘)2 = 4𝑘 2 Dividing both sides of this equation by 2 gives even. 𝑚2 = 2𝑘 2 But this contradicts the original assumption that √2 prime (and so not even). = 𝑛 𝑚 which means that m is also where n and m are relatively So it follows that √2 is irrational. I promise that this is it pretty much it for algebra for the rest of this section. The activities that follow all involve the use of parity, often in ingenious ways. In order to solve these problems, try and keep a track of how the parity of the situation changes as you go along. Sometimes you might notice that the parity of some part of the problem stays the same (called an invariant). Often this will give you insight into the solution to the problem. Good luck and have fun! 2 1. Cogs This section is about cogs… Look at the picture on the right. Which way will the smaller cog turn? Consider a row of cogs like the one below… Which way will each cog turn? Can you come up with a rule? What will happen if we put another cog between the first and last one to make a closed loop? Investigate for other cog loops… Now consider cogs joined by chains like this: Clearly the two cogs rotate in the same direction… What if we cross the chain over in the middle something like this? 3 Which way will each cog turn in these pictures (if at all)? How is this related to the closed loop of cogs above? Explore other systems of cogs and chains… Notes on cogs Any cog will rotate in the opposite direction to its neighbor. So in a closed loop of cogs, the ‘odd-numbered’ cogs rotate one direction (say anti-clockwise) while the even numbered cogs rotate in the other direction. So if we put a 5th cog in a loop, we have a problem. Why? Because the 5th cog and the 1st cog are neighbours in the loop so should turn in opposite directions… but they are also odd-numbered cogs so want to turn in the same direction, resulting in a jam! We can conclude that we need an even number of cogs in a loop for the system to rotate freely. In fact, the ‘crossed chains’ problems are equivalent to the cogs as neighbouring cogs rotate in opposite directions, so we need an even number of crossed chains in a loop for it to work! We can extend this systems of crossed and non-crossed chains… Will this one work? Note that it is not the number of cogs that matters here but the number of crosses… 4 5 2. Odd blobs Example: Try cancelling different pairs for this example. Do you still get the same outcome? Try some other combinations of black and white blobs. Can you find any patterns? Can you work out what the final outcome will be at the start? Hint: keep a record of the number of black blobs at each step of your investigations… what do you notice? Why do you think this is? How does this help you come up with a rule? What do white and black blobs represent? Replace the black blobs with ones and the white blobs with zeroes. Does this help you understand what is going on? Now complete this pyramid using the same rules… what does it remind you of? ? ? ? ? ? What patterns do you see in the pyramid you have created? 6 What if… you change the rules for combining blobs? 7 Notes on odd blobs This is another representation of parity. Consider black blobs as odd and white blobs as even then the rules are the rules for adding odds and evens. So we can describe the position given as odd as there is 3 odds (blacks) and 2 evens (whites) so will end up as black. As we cancel blobs the parity of each position remains odd, so the final position will be odd (black). Another way to see this is to consider the black blobs as 1 and white blobs as 0. Then this position has a sum of 3. If you keep a track of the sum it will remain odd throughout the cancelling. The sum is an example of an invariant - it is a useful idea for solving problems that we will use again. The pyramid is Pascal’s triangle in disguise. To see how, replace the odds by black blobs and even numbers by whites… You could just consider this is as Pascal’s triangle modulo 2. If you carry on the triangle you will get an interesting fractal pattern – the Sierpinski triangle. There are lots of other nice patterns in Pascal’s triangle if you consider other modular arithemetics… 8 3. Odd cups Start with 3 cups in this position: up down up Turn over 2 cups at a time… can you get them all the right way up? Now try the same thing for more cups arranged in the same up down up down pattern… ….. Can you come up with any rules for which ones are possible? Try different combinations of cups, or try turning different numbers of cups each time… can you come up with a general rule? Hint: like in odd blobs, keep a record of the number of cups facing up at each step of your investigations… what do you notice? Notes on odd cups Here is a table of results: This is all a bit confusing… you might have thought it was going to be possible for all even ones after trying 3 and 4 cups… However, a bit of further investigation of different starting positions reveals the true structure of the problem (the up down up down positions we have been looking at are in red): 9 If you follow the hint and keep a record of the number of up-facing cups at each stage you will see that each flip of 2 cups maintains the parity of up-facing cups… Example: 2 up 0 up 2 up You can only have an even number of cups facing up, so we will never have 3 facing up. A similar analysis will show which ones will be possible. Note that flipping 3 cups at a time reverses the parity, which suggests that it will be possible to flip any number of cups in any starting position… 10 4. Coin trick Here’s a good coin trick. Ask a volunteer to put some coins on the table like this: H H H T T Before performing the trick, quickly count the number of heads (here it’s 3). Version 1: ask the volunteer to turn over 2 at a time silently while you turn your back. Then before you turn back round, ask them to cover one of the coins with their hand. You should be able to tell whether the coin they have covered is heads of tails… but how? Version 2: Now ask them to cover 2 coins… can you decide whether they are the same or different? Version 3: How about if they turn over one at a time, calling out the word FLIP each time they do it? Version 4: How about if they turn over 1 then 2 then 3 coins, then 1-2-3 again, the 1-2-3 again? Can you invent any other versions of this trick? 11 Notes on the coin trick This trick is based on the same ideas as the odd cups puzzle. If you practice this trick on your own and keep track of the number of heads after each flip you will see that if the number of heads starts odd (even), it will remain odd (even). Version 1: supposing there is an odd number of heads at the start, when you turn back round there will still be an odd number of heads facing up. H A quick count of the heads showing will tell you what is hidden under their hand (here it would be a head). Version 2: If they cover two coins you can determine whether they are the same or different in the same way (although if they are the same you will not be able to tell whether they are heads or tails!). So here, the covered ones could be two heads or two tails, they are definitely the same! H H H T T H H T T but Version 3: If they call out FLIP each time then you need to count the number of times they call FLIP. If it is even, then the parity of heads will be the same. If it is odd, the parity of heads will have changed and you can perform the trick in the same way. How does version 4 work? 12 5. Coins in a row Put a row of any number of coins of different denominations on the table, for example: 5p 10p £1 10p £1 £2 1p Now, two players take it in turns to take a coin from either end of the row. The aim of the game is to get the most money. What is the best move to make? Who will win this game? Change one of the coins… does it change who wins this game? Try adding an extra coin on one of the ends… Investigate for different numbers of coins and denominations. Can you make a general rule? Notes on coins in a row This game shown should be won by player 2. The best move for player 1 is to take the 5p. Then player 2 should take the 10p. Player 1 will then take the £1, player 2 the 10p, player 1 the other £1, giving player 2 the £2 and finally player 1 takes the 1p. So player 2 wins by £2.20 to £2.06. Try changing one of the coins, for example changing the 1p on the right end to £1. It might seem like player 1 would now win this game… but again it turns out to be a player 2 win… try it! If we choose another 7 random coins and play again, player 2 usually wins, although it depends on the denominations (consider the case where all the coins are the same value). Play it a few times and see! Generally, all we can say is that the winner of the game with an odd number of coins depends on the arrangement of coins. But with an even number of coins, player 1 can at least draw in all cases! If they are all the same, it will be a draw. If at least one of the coins is different to the others, player 1 will definitely win… to see why consider a simple example such as 2 or 4 coins and generalize. 6. Choco choice 13 Version 1: Consider a game where players take it in turns to break a (large) bar of chocolate into squares as shown, making one break along the lines: The winner is the last person to make a break… and they get to eat it all. What is the best strategy to win this game with the 3 x 4 bar shown? How about any m x n bar of chocolate? Or any shaped bar? Version 2: Suppose one of the squares is poisoned. The loser of this game is the one left with the poisoned square at the end. Make a move by choosing a (non-poisoned) square and breaking off all the squares above and to the right: So player 2 might move by choosing the green square: Who should win this game and why? 14 Notes on choco choice Version 1: Let’s consider the 3x4 example. This game might seem quite complicated to analyse at first sight… But playing it a few times you start to realize it doesn’t matter what you do because player 1 always wins. To see why, consider each break – it creates one extra piece. We must eventually end up with 3x4 = 12 pieces. So there must be 11 breaks, that is 11 moves... so player 1 must always win! We can generalize this to say that if the number of squares is even (for any shape), player 1 will win and if not then player 2 will win… not much of a game at all! Version 2: The poisoned square game will always be won by player 1, assuming they play optimally of course. Why? Because any move player 2 can make, this could have been played earlier by player 1. So suppose a certain move is the winning move, then player 1 always has the opportunity to play it first! Note that this does not tell us what this winning move is. Note also that often the end of this game has a nim-like quality to it…. 15 7. Clobber The normal starting position for the game of Clobber is: Blue starts… by moving horizontally or vertically to take a red counter. If you can’t take an opposition counter you lose! So an example start of a game might be: Play the game a few times… what is a good strategy? Would you have played the same moves as in this game above? Consider this non-standard starting clobber position: Who should win this game? How? How about a similar position on any 2xn board? How is this similar to 2-pile nim? 16 Note on clobber The first move made by blue in the game shown turns out to be a bad one… red can win by playing a ‘mirroring’ strategy. So if blue plays the move shown, red can mirror it (consider the board rotated 180 degrees)… Try playing this strategy… you will see that red will win this game as it can always ‘copy’ any move blue makes. This strategy will also work for the 2x4 board, for example: …and red wins. A bit of investigation will reveal that red will win on a 2xn board set up like this for n even if you use this strategy. However, this mirroring strategy is not possible if n is odd (why not?) and it would appear that red has the advantage now. Who has the advantage on an m x n board for different values of m and n? Answers on a postcard please! Why is this similar to 2-pile nim? Well, if the 2 piles have the same number of counters then player 2 wins by playing a mirroring strategy. 17 8. Stomp! This puzzle is loosely based on the game Whack-a-Mole. Consider a square ‘garden’ made from 4 x 4 squares, any of which may contain a mole. The aim is to eradicate the moles from the garden by squashing them with your foot. But if you step on a blank square then a mole will pop up when you lift your foot up. Let’s start by considering what happens with a ‘foot’ shaped like a domino 1 by 2 squares like this: So, let’s suppose you come out one morning and there is one mole in the garden in some square and you step on it. This is what happens: Can you completely eradicate the mole(s) from this garden? If not, can you explain why not? Explore different positions and numbers of moles in this garden with this 1x2 foot. Which ones are possible and which are not? Now try different shaped feet. Can you remove a single mole from the garden with any of these shaped feet? 1x3 L-shape T-shape 2x2 Make up some puzzles like these below and solve them. 18 Puzzle A: Puzzle B: Can you make up any rules about which numbers of moles can be eradicated with different shaped feet? Why not experiment with different garden shapes... in For Using the T-shape, can you work out a sequence of moves that will ‘move’ a mole any direction? example, can you work out a sequence of moves with the T-shape that will move the mole one square like this: Can you use this to eradicate the moles from this garden? Notes on stomp After a while you will notice that puzzle is not possible with the 1x2 To see why, keep a record of the moles after any step – it is always never get to zero moles (as zero is the single mole foot. number of odd, so we can even). This is 19 the case with any foot with an even number of squares. But is the single-mole puzzle possible with the 1x3 foot? In fact, it isn’t either! To see why, consider a colouring of the garden like this: Now putting a 1x3 foot in any position on this board will cover exactly one of each colour, therefore changing the parity of the number of moles on each colour with every stomp. If we start with (say) 1 mole on a white square (and 0 on blue or red squares) then if we stomp on the ‘white’ mole with a 1x3 foot we will now have white = 0 , blue = 1 , red = 1 … and the parity of each colour has changed as expected. So if we start with differing parity on the different coloured squares then the puzzle will be impossible. (Note that this does not mean that if the parity is the same on all the coloured squares then the puzzle is definitely possible!) In fact, the single mole puzzle is only possible with the L-shaped foot. To see how, consider the following sequence of moves: So if we can cycle through different numbers of moles like this we conclude that all puzzles are solvable with an L-shaped foot. Using the T-shape, you can move moles one square horizontally (or vertically) using this sequence of moves: Moving a mole on top of another one will ‘cancel it out’… so this same sequence of moves will solve the 2-mole puzzle given. 20 Can you create a library of moves for moving moles around using a T-shape? Can you describe exactly which puzzles are solvable using a T-shape? 21 9. Weaving Consider weaving two threads this, and then return to their so they intertwine with each other like starting positions: Notice that it takes an even threads to return to their number of crossings (swaps) for the starting positions: So red starts and ends on the top row, blue starts and ends on the bottom row, and there are 4 crossings here. Clearly we will always require an even number of crossings to return to the starting positions for 2 threads… but this will always be true for 3 threads, or 4 threads, or more? Here is a set of three threads returning to their starting positions: How many crossings are there here? Is it odd or even? Will this always be the case for 3 threads? Can you explain why? Can you find a rule for any number of threads? 22 Notes on weaving We are going work out what is happening in the 3-thread example. The first change switches the position of all three threads. You could think of it as doing 2 swaps in one go (R with B then R with G), and it will always give 2 crossings. A single swap can either result in one crossing: …or sometimes three crossings. So if the number of swaps is even/odd, then so are the crossings. This table records what happened in the example given: Number of crossings Letters in the original cycle order? Order Swaps Number of swaps Start: (G,B,R) - 0 0 Y (R,G,B) (R,B) (R,G) 2 2 Y (B,G,R) (R,B) 3 5 N (B,R,G) (G,R) 4 6 Y End: (G,B,R) (B,G) (R,G) 6 8 Y The final column in the table records whether the letters are in the original ‘cyclic order’ (G,B,R) as shown on the right: A single swap changes the cyclic order (basically it reverses the direction of the arrows). Every time an even number of swaps/crossings has passed, we are back to the original cyclic order. So to return to the original starting position we must eventually go through an even number of swaps or crossings. 23 10. 2-colourable maps Consider a Venn diagram. How many circles overlap in each region? What do you notice about any two adjacent sections? Now make a weird Venn diagram however you want like this one – lets call it a map - and count overlapping shapes again… Is the same still true of adjacent regions? How does this show that this kind of map is 2colourable – ie can be coloured using only 2 colours with no two adjacent regions coloured the same? Now pick two points in separate regions. The shortest line between these two points passes through an even number of region ‘borders’. Investigate for other pairs of points. In fact, any line between these two points passes through an even number of borders… Why does this also show that the map is 2-colourable? 24 Notes on 2-colourable maps Here are two proofs that maps made from (overlapping) closed loops are 2-colourable. Firstly, adjacent regions always alternate odd and even. To see why, consider walking across a border. As you leave one region, you go to a region with either one less overlap or one more overlap, so the overlap count changes parity. Now colour the odd regions one colour and the evens another… Look at the example with 2 points shown; the paths go from an odd-numbered region to another odd region. 1 By the above argument every time we cross a border we move from an even to an odd region. Equivalently, we move from a region of one colour to a different colour. So to travel between two regions of the same parity, we must cross an even number of borders, and return to a region of the same colour. 1 Any line between these points will cross through an even number of regions for the same reason. Any line between regions of different parity will cross through an odd number of regions. So every region will either be one colour or another. 25 11. 3-colourable maps What is the minimum number of colours you need to colour this map so that no adjacent regions are the same colour? Make another map like this one, where every vertex (points where borders meet) is of degree 3 (ie has 3 edges coming out of it). Can you make a degree-3 map that can be coloured in fewer colours than this one? Can you make one that needs more colours? Here is another degree-3 map. What is the minimum number of colours needed for this one? Can you come up with any rules about degree-3 maps? 26 Notes on 3-colourable maps The first map needs a minimum of 4 colours. You can see that the middle region will need a 4th colour… This is because we need 3 colours for the outer loop. We can’t colour it in only 2 colours because there are an odd number of regions in the loop. This suggests that if there was an even number of regions in the outer loop then we would only need 3 colours, which is indeed the case. The outer loop only requires two colours, and the inside can be coloured with a third. If we analyse this a bit further, we can think of an ‘odd loop’ as being equivalent to the central region having an odd number of edges (5 in the first map above). So having regions with an odd number of edges will lead to 4 colours being needed. However, if all the regions in the degree-3 map have an even number of edges (and so are surrounded by even loops), we could conjecture that only 3 colours are needed. Is this logic sound? Test it out! By the way, you won’t be able to make a degree-3 map that requires more than 4 colours (or any other map for that matter) as it is a fact that all maps require at most 4 colours. 27 12. Closed loops Make any closed loop with a pencil (without taking your pen off the paper) then add in ‘over’ and ‘under’ bridges like this: You will notice that the bridges alternate between over and under bridges. Is it always possible to make an over-under pattern like this for any closed loop?? Why? Consider the simple loop on the right with the bridges numbered. Now tracing a route along the path, we pass the bridges in the sequence 1 2 3 1 2 3 1 … Now look a bit closer at this pattern. If a bridge is an over bridge the first time we pass it, it will be an under bridge the next time… This is a consequence of the fact that we pass an even number of bridges before we come back to between occurrences of any bridge in this sequence. Check this for your bridge pattern – is it the same? Can you work out why this happens? Here’s a related game… Ask someone to make a closed loop like these ones and label the crossings (bridges) in the same way. Then ask them to trace a path once around the loop and read out the bridge numbers in the order they pass them… but… ask them to try and trick you and tell a lie somewhere by swapping the order of just two of the bridges. Without looking at their picture, how can you work out where they lied? Notes on closed loops 28 It is always the case that there is an even number of bridges between repeats. Let’s number the bridges in the main example: Tracing a route round the path we get 12345361772645… You can see that there is always an even number of bridges between each pair. To see why, consider the path as made of two separate loops made between occurrences of bridge 1. The first (blue) loop is 1 2 3 4 5 3 6 1 and the second (red) loop is 1 7 7 2 6 4 5 1. Consider (say) the red loop. It crosses through itself at bridge 7 (so passing bridge 7 twice) and then crosses the blue loop four times. So it crosses 6 bridges before it returns to 1. This is an even number. Will this always be even? Well, there are two types of crossings. When a loop crosses itself, this will always contribute an even number (2) to the total. The other type of crossing is when we cross the other half of the loop. To see why this is also even, consider the diagram on the right. As we are passing in and out of the blue section, there will be an even number of crossings here too. So there will be an even number of crossings in total, and we will always get the over-under pattern. 29 13. Inside/outside Draw any closed loop, any shape, and put a few vertices on it like this: Is it possible to draw another closed loop that passes through each segment (between vertices) once only? It is not possible with this one. Why not? Under what conditions is it possible? Draw any line and put vertices on it in a similar way. This time, label each vertex with a zero or one however you choose. : Now calculate the value of each segment as the difference between its end points, so in this example we will have: Do this for lots of different lines and vertices… what do you notice? [Hint: consider the values of the end vertices] 30 Now do this numbering for your closed loops… what do you notice? Notes on inside/outside You will find that it is only possible to draw the second (red) closed loop if you have an even number of vertices (and hence segments). If you consider the original closed loop as having an inside and outside then if you start from the outside, you must cross the line an even number of times to return to the outside (and so create a closed loop). This is related to the Jordan Curve Theorem, which basically states that a closed loop in the plane has an inside and an outside. For the second part, you will find that the sum of the green (segment) values will be odd if the end vertices have different values (such as the line shown) and even otherwise. If you think of this as being 0 = outside and 1 = inside then getting from a 0 at one end to a 1 at the other end requires an odd number of changes from 0 to 1, and so an odd sum. This explains why the closed loop numbered in the same way will have an even sum – it is effectively a line with the same number at each ‘end’. 14. Paths 31 Is it possible to walk through this house using each door exactly once? You are allowed to start and finish in different rooms. If you were a ghost (and so pass through walls instead of doors) could you pass through every wall segment (between two vertices) exactly once? Bonus challenge: It is possible to place a set of ‘normal’ 0-6 dominoes in a complete loop… Try it! Now take out all the dominoes with a blank (zero) on. Is it possible now? Now take out all the dominoes with a 0 and/or 1 on… is it possible now? Any conjectures? Can you explain why? Note on paths 32 We can represent the house as a network with rooms as vertices and doors as edges like this: A B It is a well-known fact of graph theory that we can traverse a graph (travel along each edge exactly once) and return back to the start if there is an even number of edges coming out of each vertex. This is because if we enter a vertex by one edge, we need another edge out of the vertex to carry on our path. For our puzzle, this is equivalent to requiring an even number of doors in a room. If there are an odd number of doors in a room then eventually we will enter a room by one door and there will be no door to come out of…. Does this happen in our house? Well, yes – at rooms A and B. But if we start at (say) room A then as long as we finish at room B it will be OK. We could represent the ghost-house using a graph too, this time with wall segments as edges. If you do this you will notice that are 4 rooms with an odd number of wall segments. This time we can’t do the same ‘trick’ of starting and finishing at the ‘odd’ rooms because there are too many of them, so we can’t perform a ghost-tour of this house. Bonus challenge: We can represent a set of 0-6 dominoes by the complete graph K(7). To see how, let the vertices represent one ‘half’ of the domino, so for example the edge between 0 and 1 represents the 0-1 domino. Then finding a loop containing all the dominoes is equivalent to finding a path that traverses all edges in this network. So this will be possible for any set of dominoes with even vertices (the 0-6 set but not the 1-6 set). Dotty paths 33 Consider taking a walk across a co-ordinate grid. You must walk between integer co-ordinates (lattice points) according to the following rule: You must turn 90 degrees (left or right) each time you arrive at a new point. Consider some journeys where you return to your starting point like the one above. How far do you travel? What do you notice? Can you explain your findings? Explore even and odd moves. What direction do they go in? What can you say about the coordinate you are at after an even or odd number of moves? If you add the x and y coordinates together what do you notice? Can you explain why? Label the number of moves it takes to get to each dot for some different walks as shown. What do you notice? Can you explain why? What if… you change the rule so that you also have the option of going straight on? What if… you allow moves on a grid (up/down/left/right) to be governed at random (perhaps using a tetrahedral dice or 1-4 spinner)? Do you go on a walk forever or will you eventually return to the start? Notes on dotty paths 34 Under the initial 90-degree rule, you will have noticed that the number of moves to get back to the start will be a multiple of 4. It is reasonably obvious that this happens – but can you give a wholly convincing explanation. Perhaps you could consider each pair of moves (which must be an L-shape) as one diagonal vector. Then we are effectively moving round the grid in diagonal vectors. Now if we move a diagonal in any direction, we must do the opposite of that diagonal vector to return to the start as shown here. And as each diagonal counts as two moves, we must move a multiple of 4 to return to the start. Maybe you can think of a nicer explanation than this? Exploring even and odd moves, you will notice that even moves are always vertical and odd moves are horizontal. If you sum the x and y co-ordinates after even and odd moves you will notice that the sum has the same parity as the number of moves. Now start with a move east from (0,0) to (1,0). If we look at the number of moves to get to any point on the co-ordinate grid, and then take that number modulo 4, we get the pattern shown here: 35 If you now change the rules so that you can also go straight on, then you will an even/odd structure. Taking the number of moves to get to each point modulo 2 you get this pattern. Can you give a convincing argument why this is true? How is this related to the section on 2-colourable maps? And finally, what about the random walk investigation? Well, it has been shown that a (2dimensional) random walk governed in this way will always eventually return to the start! Try it for yourself… do you believe this to be true? Maybe before you do this, you could investigate random walks in 1-dimension (along the number line) – do you believe it to be true that you return to the start in the 1-dimensional case? So why not in 2 dimensions? How about 3-dimensions? 36 15. Vertex game This game is for 2 players. Draw any graph, like the one shown here. Each player takes it in turns to delete an even vertex (one with an even number of edges attached) and also any of the edges that are attached to it. There are three even vertices on this graph. It is not a very interesting game because player 1 can win straight away with this move: Play the game with some more interesting graphs. Can you make any conjectures? Can you prove them? [Hint: you might want to consider how many (and what type of) vertices there are after each move] 37 Notes on vertex game Let’s look at a more interesting game: Player 1 wins this game. It seems like player 1 wins all the time… is this true? In fact, it depends on how many vertices we start with. But first, some graph theory. If we count the number of odd and even-degree vertices in this game we have: Vertices 7 6 5 4 3 2 Evens 3 4 3 2 1 2 Odds 4 2 2 2 2 0 Notice how the number of odd-degree vertices is always even. This is a famous result of graph theory known as the ‘handshaking lemma’. It is a consequence of the fact that the sum of all vertex degrees is always even (as each edge has 2 vertices at the end). So if we have odddegree vertices there must be an even number of them to contribute an even amount to this total. 38 So if we have a graph with an odd number of vertices then as the number of odddegree vertices is always even, the number of even-degree vertices must be odd. Vertices 7 6 5 4 3 2 Evens 3 4 3 2 1 2 Odds 4 2 2 2 2 0 Now, suppose we start with an odd number of vertices. If we follow the number of even-degree vertices throughout the game, there must always be an odd number on player ones turn. So player 1 always has a move, and will win in this case. Of course, if there is an even number of vertices at the start then the same is true for player 2 and they will always win! 39 16. Equal rectangles Consider any size rectangle placed on a chessboard like this Convince yourself that this rectangle does not cover an equal amount of white and black. State the conditions under which a rectangle would cover an equal amount of white and black? Find some rectangles that cover equal black/white areas. Here is a dissection of a chessboard into ‘equal’ rectangles. Do all these rectangles meet your conditions? 40 41 Now… can you use these ideas to prove this surprising result? A large rectangle is split into smaller rectangles, each of which has either an integer height or an integer width (or both). Prove that the large rectangle also has this property. Notes on equal rectangles You will find that rectangles with (at least) one even side will have equal white and black area. But if neither side is even then it will not be an equal rectangle. To see why consider the following two diagrams. Clearly the first rectangle above covers an equal amount of white and black and has one even side. However, the second one has an extra bit of black in the bottom right corner. Now consider the chessboard dissection a different way. If we make each 2x2 square into one square, we get the dissection on the right. Now we could say that each of the rectangles has integer side. If we then split these ‘integers’ into halves, then each rectangle must have equal white/black area, and so the whole rectangle (chessboard) must have. So the result about integer rectangles is ‘proved’. Are you convinced? 17. Rolling dice Position a dice on a surface so that you can see three of its faces like this. 42 Count the total number of dots showing (here it is 15). Now roll the face along once face at a time (so here for example you could push it away from you so that the 5 is on the top) and count the number of dots facing you each time. What do you notice? Can you explain why? Now place the dice on a chessboard and roll it around in the same way (one face at a time). What can you say about the dot total for different squares on the chessboard? Can you explain what is happening? 43 Notes on rolling dice Rolling a dice along 1 face changes the parity of the 3 faces shown. To see why, label the faces odd and even like this: Notice that opposite faces odd/even pairs. are Consider the image shown. As you roll the odd face away from you (say), the even at the top will disappear from view, and the odd face that is opposite it will appear. So the total parity will change from odd to even. This happens no matter how we roll the dice – one even face is replaced by an odd one or vice versa, and the parity changes. On our chessboard, starting with an odd total on a white square as shown will give odd totals on all white squares. This is because white squares always take an even number of rolls to get to (this is related to the activity dotty paths). Challenge: Are all possible odd totals possible on all white squares? 44 18. Chessboard parity Challenge 1: Put 4 rooks on a 4x4 chessboard so that all squares are attacked… do this in a different way… and another… What do you notice about the squares the rooks are on? Can you explain why? Challenge 2: A knight’s tour is where a knight visits every square on a chessboard exactly once. If it is a closed tour then the knight returns to the starting square. Find an open knight’s tour on a 5x5 board. Can you find a closed knight’s tour on a 5x5 chessboard? Explore knight’s tours on larger chessboards. Challenge 3: It is possible to put 4 knights on a 4x4 chessboard so that every square is attacked (apart from the ones they are on). Find a way of doing it. What can you say about the squares the knights are on? Challenge 4: Here is a way of putting the numbers 1 to 4 on a 4x4 grid so that (a) every row and column contains one of each number and (b) it has reflection symmetry in both diagonals: Try it with the numbers 1 to 5 on a 5x5 chessboard, or 1 to 6 on a 6x6 board. If it is not possible, can you explain why? Can you at least arrange them so that there is symmetry in one of the diagonals? Challenge 5: can you cover this chessboard in 1x2 dominos? Explore other mutilated chessboards… 45 Notes on chessboard parity Challenge 1: All solutions involve rooks placed on an even number of black (white) squares. This is because all rooks attack even numbers of white and black squares (4 of one, 2 of another). So if there were an odd number of rooks placed on black squares (say) then there would be need to be an odd number of squares on the board. Challenge 2: Here is an open tour on a 5x5 board: There is no closed tour on a 5x5 board. To see why, consider starting on black. The closed tour must have 25 moves, and end back on the black starting square. But this is not possible. Every knight’s move takes you from black to white or vice versa, so 25 moves will take us to a white. We can conclude there are no closed tours on n x n boards if n is odd. Challenge 3: Here is a solution. Did you find a different one? Note that the knights must be placed on black and white squares evenly as the 2 black ones attack the remaining white ones and vice versa. K K K K Challenge 4: It is not possible to put the numbers 1 to 5 on the 5x5 chessboard so that there is reflection symmetry in both diagonals. This is because the (diagonal) lines of symmetry must contain one of each number (as there are an odd amount of each number on the board). Here is a solution with reflection symmetry on one diagonal: Challenge 5: This is a classic. It is not possible… can you see why by considering the colour of the two squares that have been removed? 46 19. Wind stations Consider 9 wind stations arranged in a 3x3 grid. They measure wind direction North, East, South, and West. Adjacent stations (square) are ones horizontally, vertically or diagonally next to each other. So here, A B and C are adjacent to each other. A C Opposite stations are diametrically opposite on the grid. This could be vertically, horizontally or diagonally opposite. So A and E are opposite and B and D are opposite. Here is one possible set of measurements: B D E Challenge: Is it possible to arrange the arrows so that: (a) (b) Adjacent stations differ by no more than 90 degrees Opposite stations are in opposite directions If it is not possible, can you explain why not? Can you solve this problem on the 4x4 grid? Suppose that we replace directions with numbers, so that N = 1, S = -1, E = 2, W = -2. Is it possible to place numbers in the grid so that adjacent stations do not sum to zero and opposite stations must sum to zero. How is this connected to the problem above? 47 Notes on wind stations It is not possible to solve either of these problems (which are equivalent) on the 3x3 grid. For the 3x3 case, note that we can’t 3 or 4 different directions in the outer loop otherwise we will not be able to put anything in the central square as it will be opposite to one of them. So how about only using 2 directions in the outer loop so they satisfy the adjacent station rule? Unfortunately this fails the opposite station rule (as does using only 1 direction). And we can’t just use opposite directions in the outer loop, as this would fail the adjacent station rule. How about the 4x4 square? Well, we can try and fill in the outer loop according to the two rules like this: You will notice that we can’t fill the red squares under the adjacent rule. Again, we can’t fill all the inner squares if there are 4 directions in the outer loop. Can we use fewer directions in the outer loop? The answer is no; in fact, we need all 4! This is because the opposite rule means that we need opposites, and the adjacent rule means that we need the other two directions in order to ‘bridge between’ opposites! So the 4x4 grid is not possible either. In fact, I would conjecture that this logic holds for all grids – and no grid meets this condition. Can you prove this? 48 20. Square sort This is a fun maths game to play in waiting rooms, airports or other places where there is a long line of bored people sitting down. Suppose there are (say) 25 people sitting in a row. Number each person 1 to 25. Now, you are going to call out each times table, one after another. So, starting with the 1 x table, call out: “1, 2, 3, … , 25”. Then call out the 2 x table: “2, 4, 6, …” and so on. The rules are this: If a person hears their number called, they must stand if they were sitting, or sit if they were standing. So everyone will stand when the 1 x table is called out. Then when the 2 x table is called out, all the even numbers will sit down (and the odd numbers remain standing). Continue in the way until all the times tables up to 25 have been called out. Who will be left standing at the end? What has this got to do with parity? [Hint: consider how many times each person changes position] Challenge: Explore the prime factors of each number. Does this give us any further insight? Can you find a pattern in the how many factors a number has? Or, even better, a formula? 49 Notes on square sort Number Factors Number of Factors 1 1 1 Factors usually come in pairs (such as 2x3 = 6) so numbers usually have an even number of factors. But a square number has one factor that does not have a pair – its square root – so will have an odd number of factors. 2 1,2 2 3 1,3 2 4 1,2,4 3 5 1,5 2 So the square numbered people will change position an odd number of times. If they began in a seated position they will be standing at the end. 6 1,2,3,6 4 7 1,7 2 8 1,2,4,8 4 Non-square numbers have an even number of factors because they come in pairs, so will return to a seated position. 9 1,3,9 3 10 1,2,5,10 4 You will find that the square numbers should be left standing… but why? Challenge: Looking at the column ‘Number of Factors’ in the above table, are there any patterns here? Well clearly, all prime numbers have 2 factors. And we have just found out that square numbers have 3 factors. What about all the other numbers? Is there a rule to find out how many factors any integer will have, without just finding them all? Well, yes there is – let’s consider the number 12. It has 6 factors (1, 2, 3, 4, 6, 12). If we look at each of these factors more closely they share something with 12 – prime factors! 12 can be written as a product of prime factors like this: 12 = 22 × 31 We can use this to generate all the factors by changing the value of the indices like this: 1 = 20 × 30 2 = 21 × 30 4 = 22 × 30 3 = 20 × 31 6 = 21 × 31 12 = 22 × 31 We have 3 choices (0, 1 or 2) for the power of 2, and 2 choices (0 or 1) for the power of 3, so there are 3 x 2 = 6 choices (factors) in all. 50 We just look at the indices of the prime factorization and this tells us the number of factors, generally for any number n: 𝑘 𝑘 𝑘 𝑛 = 𝑝1 1 × 𝑝2 2 × … × 𝑝𝑟 𝑟 Then the number of factors = (𝑘1 + 1) × (𝑘2 + 1) × … × (𝑘𝑟 + 1) If we now consider the values of k for a square number, they will always be even (why?), so the number of factors will be the product of odd numbers, so will always be odd. 51 21. Number circles Each outer circle contains the differences of the numbers in the inner circle. Investigate what happens if you continue this pattern. Explore different starting numbers. Can you find any rules? A good way to start investigating might be to just use zeroes and ones. Or perhaps investigate odds and evens? What happens if you start with 5 (or more) central numbers? 52 Notes on number circles It would appear that we always end up with four zeroes: Why? Well, we could consider all the different combinations of zeroes and ones. In fact, they are all encapsulated in this example: Each circle contains one of the possible combinations of zeroes and ones, which means that any combination of zeroes and ones will end with 4 zeroes. (Note that I am considering three zeroes and a one to be equivalent to three ones and a zero) Does this constitute a proof that all numbers will end with 4 zeroes? I don’t think so. I think we need to analyze things a bit further. How about if we analyze odds and evens? The pattern is the same as that above (consider changing all the zeroes to evens and all the ones to odds), suggesting that all circles eventually end up as 4 evens, and so will stay as 4 evens. Could we then say that, as we are taking differences of numbers, that eventually the numbers will be smaller and smaller even numbers, eventually ending with zero? If we use algebra we can show that all the numbers eventually go to zero, but it’s not much fun. Can you think of a more fun way of proving this is true? If we consider five numbers, it appears that there are no combinations that go to all zeroes (unless we start with all the same number of course). Can you prove why this is true? 53 22. Magic squares Good old magic squares. Is there anything interesting left to do with them? Here is a 3x3 magic square. What patterns can you see in the numbers? What can you say about parity in this magic square? Can you make a different 3x3 magic square to this one? Is it really different? Explore the parity of the numbers in these magic squares: 4 3 8 9 5 1 2 7 6 16 3 2 13 23 6 19 2 15 5 10 11 8 4 12 25 8 16 9 6 7 12 10 18 1 14 22 4 15 14 1 11 24 7 20 3 17 5 13 21 9 Can you make 4x4 and 5x5 magic squares with different ‘parity patterns’? What types of symmetry do they have? Play this game called 3-to-15. Two players take it in turns to take a card from a set numbered 1 to 9. The winner is the first player to hold (any) 3 cards that add to 15. What is a good strategy for this game? Why not change the rules – try picking numbers so as not to get 15… Can you make a 2x2 magic square using the first four primes? How about a 3x3 square from the first 9 primes? Or the first 9 odd primes? Or any primes? If not, can you explain why? 54 Notes on magic squares Consider the parity of the cells for these magic squares. 4 3 8 I have coloured the even numbers in red. 9 5 1 The row/column total of a 3x3 magic square is 15, which is odd, so each row and column must contain an even amount of even numbers (0 or 2). 2 7 6 This suggests that there are no other possible arrangements for a 3x3 magic square. For the 4x4 magic square, the parity pattern is on the right: This time the row/column total is 34, which is even, so there needs to be an even amount of evens in each line. Can you find another possible parity pattern for a 4x4 square? And here is the parity pattern for the 5x5 square: Notice that in fact all magic squares have an even amount of even numbers in each row/column/diagonal. The 3-to-15 game is really just a game of noughts-and-crosses played on a 3x3 magic square. To see why consider the best first move, which is 5. This is equivalent to choosing the central cell on the 3x3 magic square. Now clearly the only feasible move as player 2 is to choose an even card. This is equivalent to choosing a corner in noughts-and-crosses. From this point the game is certain to end in a draw (assuming optimal play). 55 It is not possible to make any magic square on a 2x2 grid, let alone one with the first 4 primes. Further to this, it is impossible to make any magic square with the first n prime numbers, as it includes only one even number (2) – clearly this can’t work from our earlier analysis. How about the first n odd primes? Well, this is not possible as the sum of these primes is 127, which is not divisible by 3. Here is one with a collection of 9 primes: 17 89 71 113 59 5 47 29 101 56 23. Seat swap Suppose you have a 25 people sat in a 5x5 square. Can the people move from their seat to an adjacent seat, so that they all finish one seat away (horizontally or vertically, not diagonally) from where they started? If not, can you give a convincing argument why? Can they move so that they are 2 squares away from where they started? How about if they make moves like a knight? For which m x n grids is the 1-move puzzle possible and which grids is it not? How about the 2-move puzzle? And the knight puzzle? How is this connected to challenge 5 in chessboard parity? How is this connected to equal rectangles? Notes on seat swap It is not possible to move the people so that they are all one seat away. To see why this is the case, suppose the chairs are coloured like a chessboard. Then each person moves from a black to a white square or vice versa. But there are 13 black squares and 12 white squares, so it will not be possible for everyone to move. This puzzle will only be possible on m x n boards if either m or n is even, so that the number of black and white squares are even (see equal rectangles). This is the same puzzle as placing 1x2 dominos on a chessboard. The knight’s puzzle on this board is not possible for the same reasons. The 2-move puzzle is not possible on this board either. Consider the people sat at the black squares – there is a 3x3 ‘sub-board’ inside the larger board, so will not be possible. 24. m-n knights 57 You may have got excited about knight’s tours when doing challenge 2 of chessboard parity. You may have noticed that a knight can move to every square on a large enough (8x8, infinite) chessboard. Can you prove that this is true? The standard knight moves 1 square in one direction and 2 in a perpendicular direction – for this reason we could call this a 1-2 knight. What about other 1-n knights? Can they visit every square of an infinite chessboard? First, let’s consider the 1-1 knight. Can this visit every square on a chessboard? If not, which squares can it not visit? Now consider other 1-n knights… can you make any conjectures? Can you prove them? Can you generalize to your rules to m-n knights? 58 Notes on m-n knights We can prove why the standard knight can visit every square the chessboard by working out whether it can move one square in each direction via a combination of moves (why?). In by symmetry, we only need to consider whether it can move square in any given horizontal or vertical direction. on fact, one How about the 1-1 knight? Well, it can only visit one colour only as it effectively moves in diagonals. The 1-3 knight can also visit one colour of squares on the board – try it for yourself. This leads us to conjecture that 1-odd-knights can only stay on one colour, which is true. Perhaps, then, 1-even knights can visit every square. This is indeed the case. Here’s the 1-4 knight moving one square: You can see why any 1-even knight will be able to move anywhere as they can all follow a path similar to this. As for m-n knights, any knights that remain on the same coloured squares will not be able to visit every square. Clearly m-m knights fall into this category. What other knights stay on the same squares? We have found that 1-odd knights fit into this category, but also 2-even knights, 3-odd knights… in fact, any odd-odd knight or even-even knight will stay on the same coloured squares. So only odd-even knights or even-odd knights can visit every square on a chessboard. Here is how the 2-3 knight can visit every square: Find some solutions for other odd-even or even-odd knights. 59 25. Error correcting codes You want to transmit and receive a code using binary. Suppose there are 8 words you need to encode. Then a natural choice is the first 8 digits in binary 000, 001, 010, 011, 100, 101, 110, and 111. However, the transmission is susceptible to intermittent noise (errors), which for this activity we will assume only effect one digit per word. How do you know the code you receive is ‘error free’? For example, if you receive the code word 010 (say), how do you know that this is what you were supposed to receive or instead that it has been subject to error? Before reading any further, can you devise a method for transmitting this code that allows the receiver to check whether there has been an error? Furthermore, can your error checking procedure actually tell you exactly what the error is? This is what error-correcting codes are designed to do. Here are some methods that are used: Method 1: Single parity check. An extra digit is added to each transmitted word so that the sum of the digits is even. For example: 110 would be transmitted as 1100. 100 would be transmitted as 1001. So if we receive a word with odd digit sum then we know there has been an error. It seems like we have solved the problem but does this tell you what the error is? Method 2: Additional parity checks. We can add more than one parity check for different parts of the code word. Can you design a code like this? Does it solve the problem of working out where the error is? Method 3: Hamming distance. 60 The (Hamming) distance between two words is the sum of the differences between each digit in each place. For example: 110 and 100 have a distance of 1 as they differ by the middle digit. 110 and 001 have a distance of 3 as they differ by all three digits. We can exploit this idea to create a code such that all letters have a distance of 3 or more (why 3 or more?). Then we will always know which word was supposed to have been transmitted. We can create this code by adding extra digits at the end like this: Append 001 with the digits 100 (say) to create the word 001100. Append 000 with 010 (say) to create the word 000010. Then these extended words have distance = 3. Now if we receive the word 001000 then we know (a) it contains an error and (b) which word it should have been – it must be 001100 as this word has a distance of 1, whereas 000010 has a distance of 2. Can you create a set of 8 code words in this way that all have a distance 3 or more? 61 Notes on error correcting codes Method 1: The good thing about method 1 is that we can simply detect whether an error has occurred. Unfortunately we do not know whether the error is with the original word, or with the parity check digit. Furthermore we do not know what the original word should have been. Suppose you receive 1000. Then should this have been 0000, 1100 or 1010, or even 1001? We have four possible code words it could have been. Method 2: We could add a parity check for each digit like this: 110 would become 110110. Now if we receive 110100 then we do know there is an error. But again we do not know whether the correct code word should have been 100100 or 110110. It is an improvement on method 1 albeit less efficient. We can be more cunning. We can include three parity checks: Digit 4 checks the parity of digits 1 and 2 (so digits 1 + 2 + 4 = even) Digit 5 checks the parity of digits 1 and 3. Digit 6 checks the parity of digits 2 and 3. Suppose we receive the code word 110011. We know this is OK as all the parity checks are OK. But the word 010011 is not OK as the first and second parity checks fail. So we know that the error must be in digit 1, and the word should have been 110011. If two parity checks fail we know there is a problem with the original code word (and where it is). If only one parity check fails then we know there is an error with the parity check itself! Test it out! Suppose the word 010110 comes through – what word should this have been? Method 3: Here is a set of 8 code words such that the distances are all 3 or more. 001100 110100 000010 111010 010111 101111 011001 100001 So this code will allow us to work out exactly where the error is. You can test this out too... Suppose the word 010101 comes through, what word should this have been? 62