Puzzle #198: The Neural Network Puzzle

Thanks to my INSEAD friend Sergio Werner for pointing me to a new source of puzzles and science articles – http://www.quantamagazine.org. I am reproducing a puzzle posted there by Pradeep Mutalik.

Neural networks and deep learning are the buzzwords of the day. Here is a puzzle that shows the basic mechanics of a neural network.

We’re going to create a simple network that converts binary numbers to decimal numbers. Imagine a network with just two layers — an input layer consisting of three units and an output layer with seven units. Each unit in the first layer connects to each unit in the second, as shown in the figure below.

Figure 1: Puzzle #198

As you can see, there are 21 connections. Every unit in the input layer, at a given point in time, is either off or on, having a value of 0 or 1. Every connection from the input layer to the output layer has an associated weight that, in artificial neural networks, is a real number between 0 and 1. Just to be contrary, and to make the network a touch more similar to an actual neural network, let us allow the weight to be a real number between –1 and 1 (the negative sign signifying an inhibitory neuron). The product of the input’s value and the connection’s weight is conveyed to an output unit as shown below. The output unit adds up all the numbers it gets from its connections to obtain a single number, as shown in the figure below using arbitrary input values and connection weights for a single output unit. Based on this number, the output number decides what its state is going to be. If it is more than a certain threshold, the unit’s value becomes 1, and if not, then its value becomes 0. We can call a unit that has a value of 1 a “firing” or “activated” unit and a unit with a value of 0 a “quiescent” unit.

Figure 2: Puzzle #198

Figure 2: Puzzle #198

Our three input units from top to bottom can have the values 001, 010, 011, 100, 101, 110 or 111, which readers may recognize as the binary numbers from 1 through 7.

Now the question: Is it possible to adjust the connection weights and the thresholds of the seven output units such that every binary number input results in the firing of only one appropriate output unit, with all the others being quiescent? The position of the activated output unit should reflect the binary input value. Thus, if the original input is 001, the leftmost output unit (or bottommost when viewed on a phone, as shown in the top figure) alone should fire, whereas if the original input is 101, the output unit that is fifth from the left (or from the bottom on a phone) alone should fire, and so on.

If you think the above result is not possible, try to adjust the weights to get as close as you can. Can you think of a simple adjustment, using additional connections but not additional units, that can improve your answer?

As always, please send your answers as comments within the blog (preferred), or send an e-mail to alokgoyal_2001@yahoo.com. Please do share the puzzle with others if you like, and please also send puzzles that you have come across that you think I can share in this blog.

Happy neuron-firing over the weekend!

Posted in Puzzles | Tagged , | Leave a comment

Solution to Puzzle #196: Bugs on a Board

Apologies for not posting anything in the last few weeks, was traveling on work or vacation through this period.

This was not a very difficult puzzle, but I got correct answers only from the two people who solve every puzzle – Pratik Poddar and Suman Saraf – thank you and well done!

(a) Color the  board like a chessboard, i.e. alternate black and whites. Notice that a bug on a white square can only travel to a black and vice versa. Since there are a total of 81 squares, there will be one more white square (or one more black square). Hence when the bugs move, there will correspondingly be at least one empty white square (or black square).

(b) Bugs can change places pairwise. One can leave only the bug in the centre square or the corner, which will be the only empty square.

Hope you all enjoyed the puzzle!

 

Posted in Solution | Tagged , , , | Leave a comment

Puzzle #197: 10 Friends

This is a very common puzzle, many variants of which one would have. I still like it as the answer is very elegant, and teaches children a methodology. This one is from Mathematical Circles (Russian Experience) by Dmitri Fomin, Sergey Genkin and Ilia Itenberg.

A person has 10 friends. Over several days he invites some of them to a dinner party so that the company never repeats itself i.e. the exactly the same set of people cannot repeat itself on any of the days. He may, however, not invite anyone on one of the days. For how many days can he continue to invite people without repetition?

As always, please send your answers as comments within the blog (preferred), or send an e-mail to alokgoyal_2001@yahoo.com. Please do share the puzzle with others if you like, and please also send puzzles that you have come across that you think I can share in this blog.

Happy partying…and there will be a lot of it!

Posted in Puzzles | Tagged , | 3 Comments

Solution to Puzzle #195: 1989!

I received many correct answers. These included  Suman Saraf, Vishal Poddar and Anand Sanghi. Thank you and well done!

This puzzle can be solved using the concept of “invariants” and parity.

Note that for any numbers a and b (a > b), numbers a and b get replaced by c. If a and b are both odd or both even, then c will be even. If one of them is odd and the other is even, then c will be odd. Essentially, in all the cases, if (a+b) is odd, c will be odd; If (a+b) is even, then c will be even. Therefore, parity of a+b is an invariant.

For the final set of numbers to be zero (which is even parity), the sum of all the numbers must be even, i.e. 1, 2, 3, …., 1989 must add up to an even number, which is not the case. Hence we can never achieve zeros as the final state.

Hope you all enjoyed the puzzle!

 

Posted in Solution | Tagged , , | Leave a comment

Puzzle #196: Bugs on a Board

Yet another very fine puzzle from A Moscow Math Circle: Week by Week Problems by Sergey Dorichenko.

Each square of a 9 x 9 board has a bug sitting on it. On a signal, each bug crawls onto one of the squares which shares a side with the one the bug was on. (a) Prove that one of the squares is now empty. (b) Can the bugs move so that there would be exactly one empty square?

As always, please send your answers as comments within the blog (preferred), or send an e-mail to alokgoyal_2001@yahoo.com. Please do share the puzzle with others if you like, and please also send puzzles that you have come across that you think I can share in this blog.

Happy bugging!

Posted in Puzzles | Tagged , , | 1 Comment

Solution to Puzzle #194: Adjacent Cells on a Chessboard

I got only two correct answers for this puzzle – from Suman Saraf and Pratik Poddar – thank you both and well done!

I am taking the liberty of copying the answer from Pratik – I find it to be very succinctly articulated.

From square marked 1 to square marked 64, the maximum manhattan distance possible between the two squares is 14 and the maximum difference between any two numbers is 63. Since 63/14>4, there has to be at least one step where the jump is greater than 4. Hence proved.

Hope you all enjoyed the puzzle!

 

 

Posted in Solution | Tagged , | Leave a comment

Puzzle #195: 1989!

This is a beautiful puzzle from Mathematical Circles (Russian Experience) by Dmitri Fomin, Sergey Genkin and Ilia Itenberg.

There numbers 1, 2, 3, ….. , 1989 are written on a blackboard. It is permitted to erase any two of them and replace them with their difference. Can this operation be used to obtain a situation where all the numbers on the blackboard are zeros?

As always, please send your answers as comments within the blog (preferred), or send an e-mail to alokgoyal_2001@yahoo.com. Please do share the puzzle with others if you like, and please also send puzzles that you have come across that you think I can share in this blog.

Happy zeroing in on the solution!

Posted in Puzzles | Tagged , , , | 4 Comments