to reconstruct the ancestral habitat , we first built the phylogeny for our sample using 14 molecular markers ( figures 1a and s1a ) .
we then assigned each species to one of four niches based on previous descriptions and our own field observations : terrestrial , marginal aquatic with preference for solid substrates , marginal aquatic with preference for water surface , and open water surface [ 5 , 11 , 12 , 13 , 14 ] .
our ancestral character state reconstruction suggests a gradual transition from the ancestral terrestrial to the derived open water habitat ( figure  1a ) , consistent with a previous reconstruction by andersen [ 5 , 11 ] . to test whether adaptation to locomotion on water has favored high speed in the gerromorpha , we first measured maximum speed in 16 species with clear differences in niche preference ( figure  1 ) .
we used body length per second ( bl / s ) as a speed unit to account for differences in body size found among species .
the terrestrial outgroups and the gerromorpha that specialize in marginal aquatic niches with preference for solid substrates [ 5 , 11 , 12 , 14 ] produce maximum speeds ranging between 6 and 9 bl / s ( figure  1 ; table s1 ) . in contrast , gerromorpha with preference for water surface ( marginal aquatic and open water ; [ 5 , 11 ] ) produce higher maximum speeds ranging between 27 and 113 bl / s ( figure  1 ; table s1 ) .
formal correlation tests , after taking phylogeny into account , revealed a strong correlation between maximum speed and niche preference such that species that occupy solid substrates are slow , whereas those that occupy the water surface are remarkably faster and their maximum speeds were invariably higher on water than on ground ( figures 1 , s1b , and s4a ; table s1 ; spearman correlation test with phylogenetic independent contrast [ pic ] rho  = 0.88 , adjusted p  = 6.5e5 ; similar results were obtained with pearson correlations ) [ 15 , 16 ] .
the increase in locomotion speed can not be explained merely by the plastic nature of animal behavior [ 2 , 17 , 18 ] , as lineages with preference for solid substrates were not able to deliver high maximum speeds when tested on water .
altogether , these findings corroborate the hypothesis that water surface lifestyle has selected in favor of increased locomotion speed .
because speed depends on leg length , we tested whether there is a correlation between leg length , speed , and niche preference in the gerromorpha .
the terrestrial outgroups and the species that prefer solid substrates [ 5 , 11 , 12 , 14 ] exhibit low values of leg length to body length ( figures 2 and s2 ; table s2 ) .
conversely , species that prefer water surface , including the basally branching mesovelia and the derived veliidae and gerridae [ 5 , 11 ] , exhibit higher values of leg length to body length ( figures 2 and s2 ; table s2 ) .
pairwise correlation tests detected a strong and significant correlation between the length of the midlegs and both speed and niche preference , but not between the forelegs or hindlegs and these two variables ( figures 2 and  s4a ; spearman correlation tests with pic ; midleg and speed : rho  = 0.82 , adjusted p  = 5.3e4 ; midleg and habitat : rho  = 0.88 , adjusted p  = 6.5e5 ) .
increased leg length is known to contribute to generating faster movement through increasing the amplitude of strokes [ 20 , 21 ] .
when we analyzed how the legs act during locomotion on fluid compared to solid substrates , we failed to detect any  difference in the amplitude of leg strokes between water and ground locomotion in species with short midlegs , preference for solid substrates , and that use the tripod gait ( hebrus ) ( figures 3a and 3b ; table s3 ) .
however , in species with elongated midlegs , with preference for water surface , and that also use the tripod gait ( microvelia and mesovelia ; movie s1 ) , we detected a significant increase in the amplitude of midleg strokes when these species moved on water compared to when they moved on solid substrates ( figures 3c , 3d , 3f , and 3 g ; table s3 ) .
finally we tested gerris , a species that employs rowing ( movie s1 ) and that generates movement through distortion of the water surface and generation and shedding of vortices [ 8 , 22 ] .
in this species , we found that the midlegs stretched in a straight shape and executed considerably large amplitudes of stroke , whereas the amplitudes of the forelegs and hindlegs were minimal if any ( figures 3e3h ; table s3 ) .
altogether , these results suggest that the preference for various water surface niches have favored increased speed through increasing the length and the amplitude of stroke of the midlegs .
leg motion pattern includes two timescales representing a stance phase ( leg pushing against substrate ) and a swing phase ( leg loses contact with substrate ; [ 23 , 24 ] ) .
we therefore compared stroke frequency ( number of steps per second ) and pattern of leg motion ( stance and swing phases separately ) between 16 extant species ( figures 4a , 4b , and s3 ) .
exclusively terrestrial species in addition to all gerromorpha that occupy solid substrates move with a highly similar stroke frequency ( ranging between 14 and 24 strokes per second [ st / s ] ) , and their pattern of motion is characterized by a longer stance phase ( figures 4a , 4b , and s3 ) .
some of these species ( hebrus and hydrometra ) employed the same pattern of leg motion on  water as the pattern they used on ground ( figures 4a , 4b , and s3 ) .
the gerromorpha that have preference for water surface habitats and that also use the tripod gait move both on water and on ground with a much higher stroke frequency ( varying between 42  and 71 st / s ; figures 4a , 4b , and s3a ) .
their motion pattern on ground resembled that of species that prefer solid substrates , except for mesovelia furcata ( figure  s3b ) .
interestingly , when they moved on water , these species were able to change their motion pattern such that the stance and the swing phases were executed with the same duration ( figure  s3c ) .
in addition , we detected a strong correlation between stroke frequency , speed , and preference for water surface in the gerromorpha that retain the ancestral tripod gait ( figures 4a and s4b ; spearman correlation tests with pic ; stroke frequency and speed : rho  = 0.92 , adjusted p  = 3.6e3 ; stroke frequency and habitat : rho  = 0.83 , adjusted p  = 0.013 ) .
these findings are surprising because there is a trade - off between leg length and stroke frequency such that stroke frequency decreases with increasing leg length .
the gerromorpha that move on water using the ancestral tripod gait show a significant increase in both leg length and stroke frequency , thus indicating that this trade - off was overcome during the transition to water surface - dwelling lifestyle . in species that employ rowing as a mode of water surface locomotion ( three gerridae and three veliidae ) ,
stroke frequency was dramatically low ( varying between 6 and 16 st / s ) ( figures 4b and s3a ; table s1 ) despite the high speed that they were able to generate ( varying between 27 and 113 bl / s ; figures 1b and 4b ; table s1 ) .
in addition , the pattern of leg motion was reversed in most rowing species compared to species that specialize in solid substrates , such that the stance phase is now shorter than the swing phase ( figure  s3c ) .
therefore , niche specialization across the gerromorpha was accompanied by changes in the mode of locomotion , leg length , patterns of leg motion , and stroke frequency .
species that use the derived rowing gait show a substantially lower stroke frequency when compared to those using the ancestral tripod gait . therefore , we tested whether the evolution of rowing could be associated with increased efficiency during water surface locomotion .
first , we inferred ( see supplemental experimental procedures ) the amount of energy spent in the two veliids stridulivelia strigosa and paravelia bullialata , which have a similar  body mass ( table s1 ) , generate comparable speeds , but differ in their mode of locomotion ( figure  1 ) .
stridulivelia strigosa stroked 9 times to generate a speed of 64 body lengths ( 28  cm ) in 1 s , whereas paravelia bullialata stroked 61 times to generate a speed of 47 body lengths ( 18  cm ) in 1  s ( figures 1b and 4d ) .
we calculated that stridulivelia strigosa spent 2.21e5 mj / mg / st ( millijoule per milligram per stroke ) , and paravelia bullialata spent 1.17e5 mj / mg / st ( figure  4c ; table s1 ) . therefore , by taking into account the number of strokes per unit of time , stridulivelia strigosa ( rowing ) spent 2.9e4 mj / mg / s ( millijoule per milligram per second ) , and paravelia bullialata ( tripod ) spent 2.35e2 mj / mg / s , which is over 80-fold higher in the latter ( figure  4d ; table s1 ) .
when we extended this analysis to the entire sample of the gerromorpha that transited to the derived water surface habitat , we found that the rowing species consistently spent less energy to generate movement than species that employ the ancestral tripod gait ( figure  4d ; table s1 ; student s t test ; p  = 4.6e4 ) .
species using the ancestral tripod gait on water spend much of the time on aquatic plants and would only execute bursts of fast movement when crossing free water patches , presumably , to minimize the risk of capture by bottom - striking predators such as fish [ 5 , 10 ] .
therefore , the maintenance of the tripod gait may have been advantageous , despite the high - energy demand , as it allows these animals to be versatile .
rowing species , however , spend much more time on the open water where they forage , mate , and interact with predators [ 5 , 10 ] .
this lifestyle may have increased demands on frequent , fast , and energy - efficient locomotion .
these results indicate that the derived mode of water surface locomotion through rowing gait , characteristic of derived species that specialize in open water , is more energy efficient when compared to the ancestral mode using the tripod gait .
another important trade - off in walking systems , including arthropods , exists between body size and stroke frequency , such that stroke frequency decreases with increasing body size [ 21 , 26 ] .
because the evolution of rowing in derived lineages is associated with a dramatic decrease in stroke frequency , we hypothesized that this decrease may have removed the constraint on body size . to test this hypothesis , we plotted body size by stroke frequency in a total of 25 species that exhibit large variation in these two traits ( figure  4e ) .
we found that species with small body size  ( < 5,000  m ) may exhibit either low or high stroke frequency ( figure  4e ) .
conversely , all species with larger body size ( > 5,000  m ) showed a significantly low stroke frequency ( figure  4e ) . in our dataset , we could not find any species with both high stroke frequency and large body size ( figure  4e ) .
litterbugs ( dipsocoromorpha ; figure  1a ; ) are characteristically small , and similarly the ancestral state of body size in the gerromorpha has been undoubtedly small to very small .
it is possible that because of their small body size , the ancestors of the gerromorpha were free from the constraint imposed on larger bugs , such that stroke frequency increased and facilitated the transition to water surface life .
subsequently , the evolution of  rowing combined with the significant increase in the length of the driving midlegs [ 10 , 30 , 31 , 32 , 33 ] , and most likely changes in the associated innervation and musculature [ 22 , 34 , 35 ] , may have contributed to reducing stroke frequency while maintaining high speeds .
these structural and behavioral changes may have contributed to the evolution of larger bodies including the largest semi - aquatic bug known , the gerrid gigantometra gigas , whose body length is over 3  cm and leg span over 25  cm .
understanding how the evolution of behavior and morphology can be associated with niche expansion and species diversification is a major challenge in evolutionary biology [ 1 , 3 , 17 , 18 ] .
we have shown that lineages that remained in the ancestral habitat , composed of solid substrates , produce low maximum speeds and that lineages that specialize in open water surface niches generate significantly higher maximum speeds .
this increase in locomotion speed is associated with the evolution of increased midleg length , changes in leg motion patterns , and increased frequency of leg strokes .
the subsequent evolution of rowing , as a novel mode of locomotion on the water , removed the requirement for high stroke frequency , reduced energy expenditure , and enabled derived lineages to specialize in open water zones .
finally , we have shown how the evolution of rowing , by removing the requirement for high stroke frequency , may have led to the evolution of larger gerromorpha . by uncovering the link between the ecology of the semi - aquatic bugs and the variety of phenotypes they exhibit
, this work draws a comprehensive picture of how a combination of behavioral and structural changes can impact the evolutionary trajectory of groups of animals and can be associated with niche expansion and lineage diversification .
all species were kept in water tanks at 25c , 50% humidity , and 14  hr of daylight and fed on live crickets .
phylogeny reconstruction was conducted using 14 molecular markers with the software geneious version 7.1.9 using plugins mrbayes version 3.2.6   ( one million generations ; 25% burnin ) and phyml version 3.0 , using gtr model with 100 bootstraps .
more details can be found in the supplemental experimental procedures . to enable reconstruction , we consolidated andersen s habitat classes [ 5 , 11 ] into the following four : terrestrial , marginal aquatic with preference for solid substrates , marginal aquatic with preference for water surface , and open water surface .
each species was assigned to one of these four classes based on previous descriptions [ 5 , 11 , 12 , 13 , 14 ] and on the environment where we caught them .
a set of adult individuals for each species were filmed at 2,000 frames per second , both on water surface and on a solid substrate with a grid paper in the background as a calibration scale . to calculate speed ,
a mean value was extracted from a defined interval plateau phase from velocity curve along each video .
stroke frequency was determined as the number of steps performed by the individuals during a given locomotion duration and converted into number of strokes per second .
reconstruction of ancestral character states was performed in rstudio version 0.99.486 using a maximum likelihood method adapted to discrete characters ( ace , package ape ; ) and represented using phytools .
details about methods of reconstruction and scripts used can be found in the supplemental experimental procedures .
kinetic energy ( ek in joules ) used during a stroke is determined using the following expression : ek 
 = 0.5mv , where m is the mass of the insect in  grams , and v is the velocity generated during one stroke in meters per second .
details and r script used for statistical analyses are provided in the supplemental experimental procedures .
; investigation , a.j.j.c . ; formal analysis , a.j.j.c . , m.e.s . , and m.s .
 summaryacquisition of new ecological opportunities is a major driver of adaptation and species diversification [ 1 , 2 , 3 , 4 ] . 
 however , how groups of organisms expand their habitat range is often unclear [ 3 ] . 
 we study the gerromorpha , a monophyletic group of heteropteran insects that occupy a large variety of water surface - associated niches , from small puddles to  open oceans [ 5 , 6 ] . due to constraints related to fluid dynamics [ 7 , 8 , 9 ] and exposure to predation 
 [ 5 , 10 ] , we hypothesize that selection will favor high speed of locomotion in the gerromorpha that occupy water - air interface niches relative to the ancestral terrestrial life style . through biomechanical assays and phylogenetic reconstruction , 
 we show that only species that occupy water surface niches can generate high maximum speeds . 
 basally branching lineages with ancestral mode of locomotion , consisting of tripod gait , achieved increased speed on the water through increasing midleg length , stroke amplitude , and stroke frequency . 
 derived lineages evolved rowing as a novel mode of locomotion through simultaneous sculling motion almost exclusively of the midlegs . 
 we demonstrate that this change in locomotory behavior significantly reduced the requirement for high stroke frequency and energy expenditure . 
 furthermore , we show how the evolution of rowing , by reducing stroke frequency , may have eliminated the constraint on body size , which may explain the evolution of larger gerromorpha . 
 this correlation between the diversity in  locomotion behaviors and niche specialization suggests that changes in morphology and behavior may facilitate the invasion and diversification in novel environments . 
Results and Discussion
Experimental Procedures
Author Contributions