Here we will have an abstract look at the operation of composition. We start with a simple observation. Recall that IdA denotes the identity mapping on a set A.

Fact.
Let T be a mapping from a set A to a set B. Then T ○ IdA = T and IdB ○ T = T.

Indeed, the identity mapping leaves elements as they are (or to put it another way, it sends every element to itself), so the first statement is proved by considering an arbitrary a and calculating

(T ○ IdA)(a) = T(IdA(a)) = T(a),

The second statement is proved in a similar way.

This gets even more interesting if we consider a set A and the space M of all mappings from A to A. Since starting and target sets are the same, we can always compose any two such mappings. Thus composition is a binary operation on M. If we denote the identity map on A as I, we can write the above Fact in this way:

T ○ I = I ○ T = T.

This means that identity I acts as a unit element of the space M endowed with the operation of composition, just like number 1 acts as a unity for real numbers and multiplication. It gets even more interesting when we recall the condition for an inverse function. For mappings from A to A it reads

T ○ T −1 = T −1 ○ T = I.

Again, for multiplication we have similar equality that defines the reciprocal number, xx−1 = x−1x = 1. Similarity does not stop here. In the space of real numbers not every number has its inverse; namely, we cannot find 1/0. In the space M we have the inverse also only sometimes, namely only for mappings that are bijections.

One can also prove that composition satisfies the associative law. However, that's where the similarity stops: The composition is not commutative. If we have two mappings T and S from A to A, then in most likelihood, unless we are extremely lucky, the compositions T ○ S and S ○ T are different.