Analysis of the C Major Invention (BWV 772) by Bach
Measures 3 and 4
In these measures Bach presents a sequence based on the the first four notes of the subject:

These notes are transformed by augmentation (rhythmic values are doubled, a 16th note becomes and 8th note) and used as the bass in the sequence:

In the upper voice, the subject:

is transformed by inversion (ascending intervals become descending intervals):

Note that they look like reflection on a mirror:

With these two motives, Bach creates a sequence that will modulate to G Major (dominant):
|
Subject by inversion in yellow, by augmentation in blue |