the fourth movement is an adagio in b minor in common time. of 21 bars in length, its tonal function is to mediate between the keys of the central and final movements (e minor and g major). the contrapuntal material of themes and counter-themes is shared and exchanged between all three parts; the long phrases in the main theme provide a soaring melody for the violin. the first version of the sonata also had an adagio in b minor with a similar function but, as richard jones comments, the later replacement is "more elaborate and of greater expressive weight and substance." gives a detailed analysis of the musical structure of the adagio, which alternates between two contrasting elements, the interplay between the two underlying the architecture of the movement. the first "arc-shaped" element is the fugue theme—florid, melodic, rhythmically complex and based around the tonic key. it is heard in the first bar in the harpsichord over a rising scale of quavers in the bass. an inverted version of the opening motif appears in the bass line in the third bar as the two upper voices play descending figures semiquaver couplets, which not only complete the melodic line of the fugue theme in the violin part but also provide a counter-theme. the second "rectilinear" element—more severe, chromatic and modulating—is first heard with its own counter-theme in the fifth bar. it is formed of a chain of motifs descending in crotchets, with syncopated rhythms related to those of the fugue theme. time-wise the first element accounts for the majority of the movement, but the second element governs its tonal structure. halfway through the movement in bar 11 the tonality reaches the relative major key of d major, but only fleetingly. the melody of the fugue subject and a variant of its completion return in the violin. after two bars of the chromatic syncopated material, the motifs of the fugue subject, broken up between all three voices, lead up to two cadences in f minor. the second element returns in the final two bar coda as the music modulates to the closing cadence in d major, in anticipation of the fifth movement in g major.