To find the figure of a categorical syllogism, first identify the minor and major terms in the conclusion. Next find the term shared by the two premises: the middle term.
Now note only its positions:
Predicate of minor, subject of major — first figure.
Predicate of both — second figure.
Subject of both — third figure.
Subject of minor, predicate of major — fourth figure.
These four exhaust the possibilities because the middle can occupy either of two positions in each of two premises.