Both are same questions.
Let's solve the question.
1. if there are two matrices A & B, there are only 1 way to multiply them as AxB
2. If there are three matrices A, B and C then there are 2 ways as (A(BC)) and ((AB)C)
3. If there are 4 matrices A,B,C and D then
(A(BCD)) = 2 ways, as three matrices B, C, & D can be multiplied 2 ways as shown above.
OR
((AB)(CD)) = 1 way
OR
((ABC)D) = 2 ways
there are total 5 ways to multiply 4 matrices.
4. If there are 5 matrices A, B, C, D and E then
(A(BCDE)) = 5 ways
((AB)(CDE)) = 2 ways
((ABC)(DE)) = 2 ways
((ABCD)E)) = 5 Ways
total = 14 ways.
5. If there are 6 matrices A,B,C,D,E and F then
(A(BCDEF)) = 14 ways
((AB)(CDEF)) = 5 ways
((ABC)(DEF)) = 2x2 = 4 ways
((ABCD)(EF)) = 5 ways
((ABCDE)F) = 14 ways
total = 14 + 5 + 4 + 5 +14 = 42 ways.
6. if there are 7 matrices, A,B,C,D,E,F, and G then
(A(BCDEFG)) = 42 ways
((AB(CDEFG)) = 14 ways
((ABC)(DEFG)) = 2x5 = 10 ways
((ABCD)(EFG)) = 5x2=10 ways
((ABCDE)(FG)) = 14 ways
((ABCDEF)G) = 42 ways
Total = 42+14+10+10+14+42 = 132 ways