"But now we're finding that it's really, really simple," said Herbert-Read.
The researchers filmed groups of two, four or eight mosquitofish, Gambusia Holbrooki, in a square arena for five minutes, and studied the movements of individuals in each group.
The images of the swimming fish were fed into tracking software, which acts like many pairs of eyes to keep tabs on the direction and speed of each fish in the school and how it responds to other fish around it.
The researchers used a technique called artificial neural networks to look for patterns in the data.
"It turns out the amazing synchronized swimming that fish in shoals exhibit is actually caused by each fish using very simple rules to respond to its neighbors," said Herbert-Read.
"These rules include: 'accelerate towards a neighbor that is far away from you' and 'decelerate when a neighbor is right in front of you'.
"We also found that a fish only responds to a single nearest neighbor at any one time," said Herbert-Read.
"When we're driving, we use similar sorts of rules: we decelerate when someone's in front of us, and accelerate if there's someone about to bump into you from behind."