Counterpoint technique in which the interval direction is changed. Any ascending interval becomes a descending interval and vice versa. An example from Bach's Invention BWV 772.
This motive:

Is transformed by inversion:

| intervals in original motive |
2nd ascending |
2nd ascending |
2nd ascending |
3rd descending |
2nd ascending |
3rd descending |
|---|---|---|---|---|---|---|
| intervals in inverted motive |
2nd descending |
2nd descending |
2nd descending |
3rd ascending |
2nd descending |
3rd ascending |
It looks like a reflection in a mirror. This is why it is sometimes called mirror inversion:

The Quarendo invenietis canon from Bach's Musical Offering is an example of a canon by inversion or contrary motion:

See: