Blog

# Geek Challenge Results: Matrix Mind-Boggler

##### Geek Challenge

Congratulations to the winner of the Matrix Mind-Boggler Geek Challenge, Jordan Kuehn of the Colex Group!

Jordan wrote a program which generates random matrixes using an efficient technique. He gets extra props for including a DMC logo on his program! I added extra annotations to demonstrate how the solution works.

The key to solving the problem is noticing that each row and each column is used exactly once. Therefore, if each cell was the sum of numbers representing the row, and a number representing the column, the sum of these cells would equal the sum of the numbers representing the rows and columns.

Jordan’s program starts by generating 8 numbers which add up to the desired sum, 26.  Of these, 7 are selected randomly and the last one is 26 minus the sum of the random numbers. These 8 numbers are shown in the arrays to the left and bottom of the array. Then, the value of each cell in the array is calculated by summing the corresponding value from the array on the left and the array on the bottom. This matrix now has the property that any group of 4 cells on distinct rows and columns will add to 26.

For those versed in LabView programming, here is the program’s diagram (click to enlarge):