If you're satisfied with the answer to which came first, the chicken on the egg, and want a related puzzle, consider this: did flying creatures develop feathers to assist with something they had already learned to do? Or did the feathers come first, proving very useful to creatures about to take to the skies?
The answer, it appears, is that the feathers were a display mechanism before they were used to get their owners off the ground. As evidence, an Archaeopteryx skeleton has been found to have leg feathers that would be little use for flying.
Although even earlier examples of avian ancestry have been identified, Archaeopteryx remains our go to source for information on the early evolution of birds.
Christian Foth of Ludwig Maximilians University examined an unusually well preserved Archaeopteryx. In Nature, Foth and his coauthors report “the entire body was covered in pennaceous feathers,” These were 4-4.5cm long on the upper legs but much shorter towards the foot. Meanwhile, the tail feathers were more than twice as long, which would have made them excellent for showing off to mates or rivals.
However, the authors note the tail feathers were asymmetrical, like those of modern flying birds whose feathers are shaped so they can generate lift just by tilting them. As such they may have provided “a secondary aerodynamic function,” they say.
On the other hand the leg feathers were symmetrical around the stem, making them of little use in flight. This undercuts the tetrapteryx theory, which proposes that very early birds had four wings, using both front and rear limbs to fly. This idea emerged from the observation that some birds have long feathers on their legs when first hatched. Advocates regard as a form of atavism. Whether or not hatchling feathers are a throwback to 150 million year old dinosaur ancestors, it seems the sort of feathers those early birds were sporting would have been of more use in showing off to mates than in taking to the skies.
Comparisons in the same paper with other feather-sporting dinosaurs suggest that different species found varying usages for their plumage, including insulation and camouflage, although display was probably the most common.
“An analysis of the phylogenetic distribution of pennaceous feathers on the tail, hindlimb and arms of advanced maniraptorans and basal avialans strongly indicates that these structures evolved in a functional context other than flight, most probably in relation to display,” the authors argue. Only later, were they “recruited for aerodynamic functions.”