Answer: Both AB and BA are 3x3 matrices.
Step-by-step explanation
For a moment I'll go over a similar example before diving into the problem at hand.
Let's consider matrix A and B to be of sizes 2 x 5 and 5 x 7 respectively.
Imagine you had two magnets. On each magnet's left and right end we'll write the dimensions of each matrix. See the diagram below.
Magnet A will have 2 and 5 on the left and right sides.
Magnet B will have 5 and 7.
These magnets are a bit special in that they only stick to other magnets of the same number. This means that the "5"s will glue together to form a longer rectangle.
This visual helps us see that matrix product AB is defined, while BA is not defined.
AB is defined because of the matching inner '5's
BA is not defined because the 7 and 2 don't match up.
The outer values then determine the overall size of the matrix product (if such a product is defined). In the case of AB, the outer values are 2 and 7. Therefore, matrix AB is size 2x7 for this example.
------------------
Now to the actual problem at hand.
Luckily we don't have to worry about values not matching up because everything is a '3'. Both AB and BA are defined. Their sizes are 3x3 each.