Bars three and four look to me like a modulation to the subdominant with an imperfect cadence in Eb (especially with the Ab auxiliary note in bar three). The answers, however, mark bars three and four as a plagal cadence in Bb. Am I missing something?
The Ab is a modal decoration characteristic of the period.
Even were it not, in more recent music it would be unlikely to effect a modulation by itself. Bb is firmly established by the time the fleeting Ab appears, and the music returns to it immediately.
The Ab is an early Baroque 'blue note'. What COULD be a functional dominant 7th note is used merely as decoration.
If you want to argue for the modulation, presumably you are going to take the Bb/D Eb chords in bars 2/3 as the chord progression that establishes the new key, though there have been no notes outside the original key yet. Then the Eb Bb in bars 3/4 is your imperfect cadence.
But then, what is the F major chord immediately after that cadence supposed to be? It can't be "something in the key of Eb" with an A natural in it, on the strong beat of the bar and right at the start of a new phrase.
So if you want a "simple" answer, your book is right.
However, good music (like this piece) usually isn't simple, and of course the whole bar of Eb chord followed by Bb on the weak part of the harmonic rhythm of the phrase has a suggestion of an imperfect cadence in it. There is no rule that says music only has to mean only one thing.
"Understanding how music works" and "Learning how to give the right answer to exam questions" are not always the same. IMO you ears were telling you something interesting and relevant about the music. The take home message is, don't stop thinking for yourself just because "the book says you are wrong!"
This piece could aswell be interpreted as in mixolydian mode with an altered 7 when A arises and not Ab. We don’t know the continuation.
On the other hand if it is in Bb ... the excursion to Eb had to be longer than just one single chord for speaking about a modulation.
Harmony analysis (at least Roman-letter analysis) is not black-and-white, and I dislike in general the view that there is only one correct analysis. Indeed, your answer (that bar 3 is a modulation into E-flat major) is possible, but we generally do not consider so short a span of time to be proper modulation. One factor (among others) is the tempo of the piece. If it is very slow, then bar 3 may be considered as such a modulation. If it is fast, then that view can hardly be valid. As for why A-flat is used instead of A in bar 3, that is kind of avoiding unresolved A (which is a leading tone of B-flat), and the E-flat / A tritone. See also: Musica ficta.
This seems to be a straight forward tonicization of the
Eb chord. The
Eb is preceded by a
Bb chord (
V/IV to IV). The
Ab note is not part of the
Bb chord, but coming immediately after it confirms a temporary tonic change. I would not call it a modulation - there is no cadence, no full phrase in a new tonic - so instead tonicization seems the appropriate term.
As to a "plagal" cadence, I take the point of view William Caplin gives in The Classical Cadence: Conceptions and Misconceptions - that there is no such cadence. Instead the example is just a root progression by descending fifth.