Aristotelian logic NOW has 4 figures due to medevial philosophers.
Aristotle only recognized 3 figures & 14 valid figures with moods. Medevial philosophers added the 4th figure and raised the valid number of figures with moods to 19.
With the invention of Mathematical logic the idea of existential import added 5 more valid figures with mood for a total of 24 valid figures with moods.
The fourth figure was just a variation of the first figure to Aristotle. The fourth figure is formally invalid following the rules of categorical syllogisms, BUT can be transformed always to the first figure so after all the fourth figure too must be valid.
The subject - predicate rule is broken literally for the fourth figure: the subject of the conclusion must come from the minor premise not the major premise. The fourth figure has the subject of the conclusion coming from the major premise if you want to write it down with valid form. The predicate of a categorical syllogism must be from the major premise but in the fourth figure to be written down as valid the predicate must come from minor premise. The process is also known by transposing the premises into the first figure.
If you were to use the standard categorical syllogism rules you would create an invalid argument. That is if the subject comes from the minor premise & the predicate comes from the major premise that literally is invalid. You would have true premises while the conclusion could be false.
One must swap subject & predicate to make the conclusion true while the premises are also true. To convert the fourth figure to the first all one must do is change the order of the premises: make the minor premise first & the second premise the major premise to write the syllogism in the first figure.
All syllogisms in the first figure are VALID by form alone regardless of the argument content. One can have all three propositions false & the argument would still be valid.
This would not be practical in reality if you don't already know the content of the argument. In Aristotelian logic both form & content matter whereas in Mathematical logic form alone is considered. Aristotelian logic is concerned with sound arguments while Mathematical logic is concerned with just validity alone.
***I edited this to clarify what is a fourth figure syllogism. It has the schematic as follows:
Premise 1: All P are M
Premise 2: All M are S
Therefore All P are S.
Notice the M stands for the Middle term, S stands for the Subject term & P stands for the predicate term.
If one changes the order of the premises you should see the first figure. That is to say, move premise 2 above premise 1 and you should see this:
All M are S
ALL P are M
Therefore All P are S.
This last syllogism is "now magically" in the first figure with the mood AAA. [there was an attempt at humor there.] This specific syllogism was deemed "the perfect figure" because it is always valid regardless the topic or content of the premises. Aristotle knew he can just transpose the premises (switch their positions) to make the argument valid so Aristotle did not emphasize a 4th figure. He emphasized only three figures. Aristotle tried to reduce all valid arguments to the first figure AAA. That was what the following Latin mnemonic was for:
Barbara celarent darii ferio baralipton
Celantes dabitis fapesmo frisesomorum
Cesare camestres festino baroco
Darapti felapton disamis datisi bocardo ferison
This reduced syllogisms to valid forms to show validity. The vowels represent the MOOD. The constants S, P, M, C stood for the method to reduce the syllogism to show validity. All other constants were said to be space fillers. The lines of the poem were the figures. The idea was to show every valid syllogism can be made into the first figure by the method in the poem. This poem was not Aristotle by the way. Medieval logicians added to Aristotelian logic after the death of Aristotle all the way to around 1845 when Mathematical logic was invented. Aristotelian logic predates Mathematical logic by thousands of years. Mathematical logic goes by several pseudonyms: modern logic, symbolic logic, predicate logic, etc. Prior to any of that all logic was classified under a branch of Philosophy alone. To this day there are distinction between how math teaches so called "logic" compared to how philosophers taught logic. [Peter Smith makes a blog Logic Matters where he once described the distinctions he recognized.] The concepts can be contrary at times because the same terms are used but the context are different between the two fields.