Innovation and Entrepreneurship

I read Peter F. Drucker’s Innovation and Entrepreneurship this month. I was looking for a good overview of innovation in technological fields. I’ve been interested in startups and high-tech companies for a few years now, but most of what I’d read was very specific advice, and not an overview of the field and how innovation works in general.

I chose Drucker’s book because I’d heard good reviews of his management and economic advice. After finishing the book, I did a bit more research on Drucker as a person. His Wikipedia entry is pretty interesting. He seems like he was an interesting and insightful guy. It probably helps that his economic and political opinions align pretty well with my own.

The book was great, but it had a much different perspective on innovation than I expected. Drucker focuses on innovation in a variety of industries, not just high tech. He definitely support high tech innovation, but he states that it’s riskier and more difficult than innovation in other areas. I found this passage from the conclusion especially poignant.

High tech […] is only one area of innovation and entrepreneurship. The great bulk of innovations lies in other areas. But also, a high-tech policy will run into political obstacles that will defeat it in short order. In terms of job creation, high tech is the maker of tomorrow rather than the maker of today. […] High Tech in the United States created no more jobs in the period 1970-85 than “smokestack” lost: about five to six million. All the additional jobs in the American economy during that period, a total of 35 million, were created by new ventures that were not high-tech but middle-tech, low-tech, or no-tech.

The book is engaging, but reads like a bunch of lists of how to succeed as an innovative entrepreneur. Drucker lists the areas that you can innovate in, ways to achieve innovation, and ways to succeed as an innovative company. These lists are interspersed with a lot of advice and a few case studies. The advice all seems useful, and after finishing the book I was left with the opinion that this would be a good book to come back to over the next few years to re-read those parts that were especially insightful.

Freedom and freedoms

It seems like talking heads on the news, in all kinds of mass media really, use the word “Freedom” as a cudgel to bludgeon opposing arguments with. Bills are drafted that will “save our Freedom,” others are condemned for destroying Freedom. Politicians, the public, and the journalists themselves are all accused of not caring about Freedom.

The problem with this, other than the political infighting it causes, is that it treats freedom as some indivisible thing. People speak of freedom as if you either have it or you don’t. Freedom isn’t like that.

There’s no such thing as “Freedom,” there are only freedoms. I have a freedom to vote (when I’m old enough), to say what I want (as long as I avoid certain topics in certain places), and to date who I want (as long as I don’t mind being mocked or worse if I date the wrong person). These and others are freedoms that we have, and I think that losing sight of this and treating Freedom as one homogeneous thing is dangerous.

By living in the society that we do, we agree to give up certain freedoms in return for certain guarantees. Everyone gives up some “freedoms to” so that everyone can expect “freedoms from.” I don’t have the freedom to beat you up and take your hat, but I can expect to remain free from beatings and hat thievery myself. It’s important to realize that we make these trade offs so that we don’t start making the wrong trade offs, or not realizing it when a trade off is being made.

If we treat Freedom as an indivisible thing, we may go around thinking we have Freedom because we can do X, even though our freedoms to do y and z have been reduced. If we’re too focused on what Freedom means and whether we have it, we may not notice that our freedoms are being eroded until all that’s left is a little island of freedoms that exactly defines what we thought Freedom was. This is the situation that I think we’re in now. People are getting wrapped up in what Freedom is and who has it, and they aren’t noticing that many of our freedoms are being revoked or wrapped in stipulations and conditions.

Another risk is that we might start to think that we have Freedom and those other poor folks over there don’t. Maybe we should bring them our Freedom? This despite the fact that they may have freedoms we don’t have and we may have freedoms that they don’t have. There’s more than one possibility here.

Next time you hear someone (or yourself) start talking about Freedom, unpack the statement. What freedom is it that you’re talking about at the moment? What are the effects of that freedom and how might that freedom be affected by what you’re considering? How would what you’re talking about affect other freedoms? This case-by-case treatment will lead to a much more Free country.

Quorum Sensing and iGEM

As an electrical engineer, I’m used to being able to wire components together to get essentially interference free communication. In biological systems, this capability isn’t available. Cells communicate with each other mainly using proteins and other small molecules that diffuse through cell membranes. This means that all neighbors of a cell may sense whatever it’s transmitting, along the lines of wireless networks. Unlike wireless networks, cells don’t have IP addresses and their state is very stochastic. This makes effective cellular communication very difficult and inaccurate.

Quorum sensing seems to be the method most used by cells to communicate. In nature it’s just used to sense local concentrations of cells. This can be used by engineers to accomplish a variety of different tasks that require cells to work together.

Many iGEM projects this year deal with new ways of using quorum sensing. Many of the projects use quorum sensing to differentiate cells, while others use quorum sensing for environmental detection or generalized communication mechanisms.

Grenoble: Mercury Detection using E-coli

The Grenoble team created e-coli that switch from one state to another in the presence of mercury. If mercury is present, the cells become “sender cells” that produce a quorum sensing molecule. Cells where IPTG is dominant over mercury become “receiver cells”. These cells produce RFP if the concentration of the quorum sensing molecule is high enough. The layout of the cells causes only the receiver cells closest to the sender cells to turn red. This creates a visible indicator of the concentration of mercury in the sample.

USTC: Infection targeting anti-bacterials

The USTC-China team developed a genetic circuit that allows for differentiation of cells. Cells become either “sleeper” cells or “attacker” cells, and AHL quorum sensing causes a suitable percentage of the undifferentiated cells to become attackers. The attacker cells move towards a bacterial infection (of AIIS) through chemotaxis. When the concentration of the molecule produced by the AIIS infection becomes high enough, the attacker cells create pyosin, which causes them to die. Excess pyosin is released that kills the bacterial infection.

Monterey: Code interpretation through quorum sensing

The Monterey, Mexico team developed three different strains of e-coli. Each strain responds to a different wavelength of light by releasing a different quorum sensing molecule. The strains can communicate among each other through these quorum sensing molecules to determine which color light has been shone on them. By using bistable switches, it is possible to record the order of the light that was received.

Peking: Chemical wire toolbox

As part of their chemical wire toolbox, the Peking team developed a set of quorum sensing molecules that can be used to send signals between cells. Their goal was to create a number of orthogonal signal mechanisms to allow cells to communicate with each other without interfering with other routes of communications (basically creating the non-interfering wires I take for granted in EE).

Sevilla: Ubbit communication standard

The Sevilla team created a standard for information exchange among cells. Like the wire toolbox from Peking, the Sevilla Ubbit is a standardized communication mechanism among cells. The Ubbit is meant to be a synthetic quorum sensing molecule.

Interesting iGEM Projects

The UW just won the world championships for iGEM. iGEM is the international Genetically Engineered Machine foundation. They sponsor yearly competitions where university undergraduates can compete to build interesting genetic components (biobricks).

This seems like such a fun competition. I’m kicking myself for not getting involved in it when I was an undergrad. The UW team this year came up with some amazing genetic circuits to generate diesel in e. coli and grow proteases that break down gluten (not at the same time, these are two different projects).

It looks like there are a lot of other interesting iGEM projects from other schools, so I’ll list some of the ones that I like the most.

Bioremediation

Many modern manufacturing techniques result, either directly or indirectly (accidently), in the release of toxic chemicals into the environment. Several methods exist for dealing with this, such as dispersing the chemicals or attempting to collect and store them elsewhere. These methods are often ineffective or partially effective, and can take years to show results.

Bioremediation, which involves the use of special cells that interact with pollution, may offer a more effective solution. Several iGEM projects deal with this in some way. Some of the projects specifically attempt to create cells that would remove pollutants, while other projects make cells more robust to pollution. The latter property would make the cells more suited to bioremediation.

Panama

The Panamanian team worked on a biobrick that synthesizes rhamnolipids. These are surfactants that decrease the surface tension of water, allowing spilled oil to be recovered more easily. This may at some point be a more effective way to produce surfactants than the one currently used.

NYC_Wetware

The NYC_Wetware team focused on providing cells with radiation resistance. The hope is that radiation resistance could be used for bioremediation after nuclear accidents.

Lethbridge

The Lethbridge team worked to create a kit to clean up tailings ponds. Tailings ponds are storage ponds where oil refineries store toxic waste. The current methods of dealing with these tailings ponds can take years. The tailings pond cleanup kit produced by Lethbridge uses synthetically produced proteins to metabolize toxic organic compounds. Some heavy metals were induced to form nanoparticles, which can be removed with the generated biomass. They also looked at increasing the sedimentation rates in the ponds using cells expressing a specific antigen.

Queens Canada

The Queens Canada team worked on making multicellular eukaryotic organisms that could break down several pollutants. They modified the C. elegans nematode to sense and move towards specific pollutants. The worms also had genes inserted to detect and degrade naphthalene.

Removing Antibiotic Resistance

Two teams worked on using the CRISPR genes on bacterial DNA. These genes act as an immune system for the bacteria, giving them resistance to external plasmids and phages. Antibiotic resistance in some bacteria is due to the CRISPR mechanism.

Georgia Tech

The Georgia Tech team worked to add CRISPR fitness to non-antibiotic resistant strains of bacteria. Their hope was that this would allow the non-antibiotic resistant bacteria to outcompete the antibiotic resistant bacteria.

USC

Plasmids are can cause horizontal antibiotic resistance transfer among bacteria. By giving bacteria CRISPR resistance to certain plasmids, the USC team plans to create bacteria that cannot receive antibiotic resistance in this way.

Optical Signaling

University of Pennsylvania

The University of Pennsylvania team developed two different strains of Human Embryonic Kidney cells. One of the strains was engineered to produce light at 480nm, while the other strain was engineered to respond to incident blue light by producing blue light itself.

Vitamin Producing Yeast

Synthetic biology has the ability to improve the foods that we eat and make them more nutritious. Brewer’s yeast, one of the primary cell types used in the iGEM competition, is also used in the food production industry for breads, beers, and other foods. Since it makes such a good chassis for engineered pathways and is useful in food production, it’s a good vector to deliver manufactured molecules to humans.

Two teams focused on making yeast more nutritious.

Johns Hopkins

The Johns Hopkins team, for example, added genes to produce vitamin A and vitamin C to yeast. They then performed baking experiments to determine how easy their new yeast was to use in cooking.

Washington University in St. Louis

The Washington University in St. Louis also inserted genes for vitamin A into yeast. They also looked at the production of a similar molecule used in perfume manufacture.

Glucose Detection

Missouri Miners

The Missouri Miners team worked on biobricks to detect glucose in various concentrations. This has the potential to decrease the cost of blood sugar monitoring and increase the quality of life of many diabetics. In the long term, it could also be used to cause cells to produce insulin in the presence of glucose, which could lead to a more permanent cure of the disorder.

In praise of requirement shift

One of the complaints that I’ve heard most often from engineers in various industries is about the requirements shift that often happens midway through a project. It’s a common refrain: “I had almost finished the project, and then my boss told me to do everything in a totally different way. Why can’t they just make up their minds?”

I’ve only ever worked at small companies where the design decisions were fairly transparent. With only two levels between me and the CEO, it was always pretty obvious why any change was being made. In general I haven’t had to deal with this issue very much in my career, but up to now I’ve been sympathetic to those people who have. A recent project that I worked on gave me some insight into requirement shift from a manager’s perspective, and I now have a lot more respect for projects that experience a lot of shift and upheaval.

A few weeks ago I decided to build myself a frisbot. My idea was to mount some photo-sensors a two wheeled chassis (each wheel would be a frisbee, hence “frisbot”). The bot would then be able to follow a light around. I had a good idea of how I wanted to design the electronics (finally using that MSP430 launchpad I got a while ago), but I wasn’t sure how I wanted to build the chassis. I was thinking a simple plank of wood with the various components mounted to it, but I hadn’t thought much farther than that. I convinced my friend Jared, who has an irrepressible drafting habit, to help me out with the mechanical design.

The two of us sat down and I showed him some videos of other frisbots, and showed him the different electrical components that had to fit on the chassis and we talked a bit about the design. Then we split up and got to work, I wrestled with the MSP430 DAC and he started drafting out the chassis design. Since I hadn’t really done much to spec out the chassis, Jared started asking a few questions about the chassis.

Him: How do you want the motors attached? Can we just mount them on wooden plates perpendicular to the base?

Me: Sure that works. Oh, but can you make them easy to remove so that I can replace the motors later if I want? And add some space to allow bigger motors in the future?

Later

Jared: Ok, the motors plates are done. And you were going to put the dev board here? (points to his design)

Me: Ya, that’s what I was thinking. Oh, wait! I might want to use a different microcontroller later, can you make the space for it larger?

We went through a few rounds of questions like this. He would ask for clarification, and I’d suddenly realize that we could do something slightly differently and make for a better or more flexible design. Admittedly, if I’d spec’d the thing out beforehand this probably would have gone a lot more smoothly. Jared, nice guy that he is, didn’t punch me in the face even after I asked him to change things for the fourth time.

The main point of this story is that the reason for requirement shift is because you don’t know everything you need to do until you’re actually working on it. That’s when a lot of questions get answered. Even if I had written down a full specification for the chassis beforehand, some of Jared’s questions spurred me to think of things that I wouldn’t have even considered beforehand, like adding a crossbrace to the motor plate. The act of making it changed what I thought was best and informed a lot of the design decisions.

Generalizing from this one experience, it seems that requirement shift on a project means you’re doing something new. If you’ve done it before, you know how to do it and don’t have to worry about changing the design halfway through. But if you’ve done it before, then it’s boring. One of the main reasons I like to design and build things is that it’s an educational and inspiring experience. If I only ever build things that I know how to make, then I’m not learning anything or doing interesting things. Even something that was once interesting can become mundane and boring after you’ve done it enough. Having to rethink a design halfway through is actually why I do what I do.

I think one of the main reasons that people complain about requirement shift so much is that in larger companies, the engineers are often isolated from many design decisions. They’re so removed from the design process that they don’t get to experience the wonder of discovery that happens when you realize you have to do something different. It’s not a problem with requirement shift, it’s a problem with openness in the company. This may be why startups don’t have a problem with it. Everyone in the startup gets to experience the fun parts of the design, so they don’t balk when things change.

If you don’t have requirements shift, you’re doing something easy and boring.

Motivating Motivation

I have trouble motivating myself to do interesting things. If I don’t force myself not to, I’ll tend to sit on the couch eating cheese-puffs and reading web comics all day. I don’t think there’s anything wrong with eating cheese-puffs and reading web comics, but I would like to accomplish things in my life. I want to look back on my days and years and be able to point to many things that I have done to make the world a better place in small or large ways. So I need to do things.

The problem is, there are many things that I could do, and I don’t find myself too motivated to do any of them. Or I’ll work on them a little bit, but when they get a little bit hard I’ll change gears completely and work on something else. This causes me to make little overall progress on any one thing.

I need to hack my brain so that I am motivated to do interesting things. At the lowest level, I’ve known for a while that my physical state of being dramatically effects what I want to do. If well-rested, moderately full, and have been drinking water regularly, I’ll be much more willing to do interesting things. Similarly, if I’ve gotten some vigorous exercise then I’m more likely to be motivated.

These are probably the things I can do that will have the most impact on how motivated I am, and I’ve known about these thing for some time. Obviously just knowing that I should do those things is not sufficient.

Here are the actions that I will take:

  • Carry around snacks and a full water bottle, and use them before I need to.
  • Notice if I am getting hungry, and immediately make plans to go eat. If I’m doing something worthwhile, then I can put off eating. If I’m just puttering around, then I should go eat immediately.
  • Go for a morning jog. I think that even a quick mile jog for a few minutes would work well. I’ll try this tomorrow morning and see how it goes.

So that’s my plan to deal with the physical sources of ennui. What about other sources?

I’ve found that I can be a lot more motivated if I’m accomplishing something. Basically I need to set up success spirals for myself; to use other words, I need to put myself in a state of flow.

One way to do this is to break up any job that I have to do into multiple chunks. General to do lists are helpful, but I often get discouraged if the list items are large. I think I need to focus on much smaller, simply achievable goals.

Another thing that I can do is visualize success. Think about what it will feel, taste, smell like to have this thing done. Think about bragging to my friends about having made this awesome thing. Visualize having the thing done, and playing around with it. Consider all of the things that I will have learned from the project, and all of the people that I will have helped.

Lastly, I can use other people to help motivate myself. I’ve unofficially been trying to do this with my RSS feeds by subscribing to the feeds of amazing people who do interesting things. The thing is, I usually just get wrapped up in reading all of those feeds. The idea seems to be a good one, but the implementation needs work.

What I’ll do is keep a list of things that are incredibly motivating to me. Any time I find a new picture, video, or blog post that gets me excited about doing things, I’ll put it on that list. When I’m feeling un-motivated, I’ll take a look at that list of things and watch a few from it, then get back to doing my own things.

I was motivated enough to write this, now I just need to be motivated enough to put it into practice. It’ll be a success spiral of motivation.

Engineers vs Pretengineers

I’m an engineer, and I have been one since the University of Washington bestowed upon me a bachelor’s degree in electrical engineering. I wonder, though, if my graduation was the day that I can point to and say “on that day I became an engineer”. Is engineer a status that is defined by some outside body, or by one’s actions and thought patterns?

Every once in a while I’ll teach a workshop or work a shift at Metrix Create:Space. Metrix is a hackerspace where people can come and build things, and the staff there are expected to help people build things. Since Metrix is the kind of place that people like me want to hang out in, it can be hard to tell if an employee is actually working or if they’re just there to build their own stuff. To fix that problem, staff at Metrix who are on the clock wear labcoats.

These labcoats have a name and title embroidered on them. Most of the labcoats have the title of “pretengineer”. The labcoats for people like me, who are accredited by some institution, have the the title “actual engineer”. Pretengineers and Actual Engineers don’t do different jobs at Metrix, and most Pretengineers don’t know significantly less about a subject than the Actual Engineers.

Some of the Pretengineers at Metrix make more things and have a much more technological mindset than some of the Actual Engineers that I know. What it comes down to is, for a place like Metrix there’s no difference between the two. Maybe an expectation of quality, but that expectation is met by everyone who works here, not just the people who have a degree in engineering.

I don’t think that being an engineer has anything to do with what some school or other has decreed you know. It seems to be more of an attitude towards problems. If the first thing you do when you see a problem is think about how to solve it with math and technology, then you are an engineer. It doesn’t even matter how much math or technology you know about, or how much skill you have. If you are willing to try the math and solve problems with technology and experiment until you figure out how to do it, then you’ll eventually learn everything that you need to know.

All a degree in engineering is good for is showing that you have some minimum level of skill, not that you’re an engineer in the first place. This isn’t necessarily a bad thing. In projects upon which lives depend, like bridges or pacemakers, you want to be sure that the person designing it has made (and learned from) all their mistakes already. Having some kind of standards body that recognizes people who are qualified to work on safety critical projects is all well and good. People who have followed other routes to excellence may not be able to be qualified by that standards body, even if they are already quite skilled.

My concern is that having such a standards body, or even having the hoop of “college graduate”, will push people who are actually already quite accomplished engineers away from the field. And that’s a shame. There are many valid ways of solving problems, but thinking that someone (yourself or someone else) isn’t capable of using one just because of some standards organization hasn’t approved them is severely limiting.

Open source movements, software and hardware both, are doing great things to make engineering something that everyone is allowed to do. The rise of maker and hacker culture is encouraging everyone to become engineers, whether they realize it or not. We’re moving more and more towards a world where everyone uses the techniques of engineering. My hope is that people start realizing this, and claiming the title of engineer with pride.

I’m an engineer. When I set out to solve a problem, I start by quantifying it and applying my technological tools to it. What do you do?

Reading SD cards with the Arduino

About a year ago, I got my friend Ryan an Arduino for his birthday. We futzed around with it for a while trying to come up with a good project, and in the end we decided to try to read an SD card.

We didn’t really have a reason for it, it just seemed like an achievable goal for a first Arduino project. I seem to recall that we wanted to understand SPI, and Ryan wanted to implement SPI in software. After about a month of weekly meetings, we were still trying to figure out the SD card SPI standard. We’d made some progress with the initialization routine for the card, but the CRC functions had us completely stumped.

In the end, my friend moved to NYC and I completely forgot about the project.

Fast forward to a month ago and I’m looking into ways to get my Arduino to play some sound files for a robotics project. When I stumbled on the Adafruit Waveshield, I also found an answer to my SD card questions. The Waveshield comes with a library to read SD cards. It didn’t take me long to get it working with the hardware I had on hand.

I wrote up a quick script to read and display the contents of a file, then hooked up my SD card. I didn’t have an SD slot handy, so I soldered some headers together into a nice holder. It may be hard to tell from the picture, but I used three sets of headers. One on the bottom sandwiched by two on the top. The top two also clamp onto the SD card.

Three headers can sandwhich an SD card

This allowed me to connect the SD card as shown in this schematic. The resistors are there to act as voltage dividers. The SD card needs 3.3 V signaling, but the Arduino provides 5 V signaling. In the Adafruit Waveshield, they use buffers to do the level conversion. Voltage dividers are quick and dirty, but probably not the best solution.

The sketch I wrote required me to add the Adafruit library to my library folder, as shown here.

Once I had everything hooked up, it worked great. The only problem I ran into while putting this together was the formatting of the SD card. The SD library expects FAT16 formatting, which means that the naming conventions for files are pretty strict. Filenames have to be at most eight characters before the “.”, and file extensions can only be three characters.

Connected SD card

Output text from Arduino SD reader

I think I might put together a little R-2R DAC and make myself a quick and dirty music player.

Code for this is as follows:

#include <FatReader.h>

SdReader card;
FatVolume vol;
FatReader root;
FatReader file;

void setup() {
  Serial.begin(9600);
  if (!card.init()) {
   Serial.println("can't initialize card"); 
  }
  if (!vol.init(card)) {
    Serial.println("can't initialize volume"); 
  }
  if (!root.openRoot(vol)) {
    Serial.println("can't open directory"); 
  }
  
  Serial.println("Files on SD card:");
  root.ls();
}

char filename[] = "ITALO.TXT";

void loop() {
  if (!file.open(root, filename))
  {
     Serial.print("failed to open file");
     Serial.println(filename); 
  }
  char letter;
  
  Serial.print("Now reading file: ");
  Serial.println(filename);
  while (file.read(&letter, 1) == 1) {
   Serial.print(letter);
  }
  
  while (1) {}
}

Surfing the shockwave

I’m went on a road trip to San Diego a few weeks ago. When I got there I went straight to the beach for some hard core surfing. It was cloudy, but I ended up having fun anyway.

The thing about surfing is that it really makes you think about waves. Is this next wave worth catching? What about that one? But when I’m just sitting out in the water waiting for a wave, I start thinking about waves themselves.

The question that came to my mind was: why do waves crest as the get closer to the beach? When waves are far from shore, they approximate a sine wave. The amplitude of the wave is the distance away from sea level.

A wave in deep water.
The equation for this wave is D = D_0 + A\sin(\omega t-kx) . D here is depth, and D_0 is sea level. A is the maximum height of the wave, \omega is the angular frequency 2\pi f , t is the time, k is the wave number 2\pi /\lambda , and x is the distance away from shore.

As you can see in that equation, the depth varies with time and distance. The distance here doesn’t really have anything to do with the beach though. What could be causing the waves to break? So I did some research.

According to wikipedia, waves on a beach are shock waves. That’s right, just like the shock wave from a plane. These shock waves work slightly differently.

Here’s what happens:

The speed of a wave in water depends on the depth of the water. When a wave is in deep water far from the beach, slight changes in depth due to the wave itself have a tiny effect. When the wave nears the beach, the water is shallower and the wave itself has a larger effect.

Near the beach, the peaks of a wave travel faster than the troughs. That means that high points catch up to low points. The wave loses its sinusoidal shape and starts turning into a sawtooth wave, and sawtooth waves have discontinuities. Discontinuities manifest themselves strangely in nature. In this case, they’re manifested as the crests of the wave.

Shockwave
The shock appears as the wave travels to the right.

I modeled this by changing the wave number, k as a function of the previous amplitude. Basically, I assumed that the water got shallower as the wave moved to the right. Since I only changed the wave number and left the frequency the same, the speed of the wave changed with amplitude.

The problem with my approach is that I changed wave speed linearly, and shock waves are by nature a non-linear problem. My model worked well for small changes in the wavespeed, but large changes caused a breakdown that manifested itself as spurious peaks. I could make a better model, but right now I don’t really feel like going through all of the calculus that would require. The KZK equation is for physicists.

Model Breakdown
You can’t model a non-linear process very well with linear tools.

Find the code here.

Opening Doors

I ran into an interesting math puzzle while trawling the blag-o-sphere today.

One hundred students line up to walk by one hundred closed lockers. The first student walks by opening every locker that is closed. The second student then walks by and opens every second locker that is closed and closes every second locker that is open. The third student does the same for every third locker and the nth student does the same for every nth locker.

After all the students have walked by the lockers, how many lockers are open?

I thought about this for a while, but I was having some trouble visualizing what was happening. In the end, I decided to graph it to see what was happening. I wrote up a quick Processing sketch and looked at a smaller version of the problem. My smaller version had only ten lockers and ten people who run through them.

Timeline of ten lockers being toggled

Once you’re looking at the picture, the answer the question is obvious. I’m not very satisfied with this method of solving the problem. It seems inelegant, and is purely a brute-force approach.

Another way to approach the problem is see if there is a closed form solution for any given door. If we had that, we could solve for the state of each locker and sum them up. Unfortunately, I think this comes down to a factoring problem. If the locker number has an even number of factors, then it is closed. If it has an odd number of factors, it is open. Interestingly, since most of the lockers remain closed it seems that most numbers have an even number of unique factors. That doesn’t really help explain the problem though.

Solutions upto 16 Lockers

So if I can’t find a closed form solution to the state of each locker, what other patterns can I see? By looking at the solutions for different numbers of lockers, I see that total number of lockers needed to give a certain number of opens follows some kind of power function. Looking at the first sixteen solutions shows that if I want n open lockers, then I need 2^n total lockers.

This is more like it. Now when someones asks about 100 lockers, I can find a solution quickly. What squared is 100? It’s 10 of course, so there are 10 open lockers after this sequence of events has been applied to 100 lockers. For any number, n, of lockers, the number of open lockers after n people have run though them is ?n rounded down.

So now I have my answer. I just need a reason. Why is it the case that the open doors follow this pattern? What that really boils down to after looking at it for a bit is the question: why are the only doors left open doors that are the square of a number? Does this mean that only square numbers have an odd number of unique factors?

Square numbers are the only numbers that have an odd number of unique factors because factors can come in pairs. With a square number, one of those pairs is made up of two of the same number, and in this situation that can only count as one toggle, not two.

So take locker number 10 for example. It has factors 1, 2, 5, 10. In this case 1 goes with 10 and 5 goes with 2. They cancel each other out and the locker stays closed.

The number 9, on the other hand, has factors 1, 3, 9. Here the 1 and the 9 cancel each other out, but the 3 doesn’t have anything to cancel it out. The locker remains open.

It turns out that getting sidetracked about closed form solutions for each individual door actually did provide the hint to understanding the problem.

You can get the code I used for my images here.