0

I need to write a program, which shows the different combinations in which matrices can be multiplied.

The output should look like below :
When there are two matrices multiplied there is one combination
(XX)

When there are three matrices multiplied there are two combinations
(X(XX)) ((XX)X)

When there are four matrices multiplied there are five combinations
(X(X(XX))) ((X(XX))X) (X((XX)X)) (((XX)X)X) ((XX)(XX))

Can someone please help me with its logic?
Thank you,

3
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by jwenting
0

I need to write a program, which shows the different combinations in which matrices can be multiplied.

The output should look like below :
When there are two matrices multiplied there is one combination
(XX)

When there are three matrices multiplied there are two combinations
(X(XX)) ((XX)X)

When there are four matrices multiplied there are five combinations
(X(X(XX))) ((X(XX))X) (X((XX)X)) (((XX)X)X) ((XX)(XX))

Can someone please help me with its logic?
Thank you,

Matrix multiplication is non-commutative operation, so X*Y!=Y*X.
So in your examples-
XY -> 2 combinations XY and YX
XYZ -> respectively 8 combinations.
But maybe it can be that your assignment ignores this fact for the sake of simplicity of assignment.

0

Matrix multiplication is non-commutative operation, so X*Y!=Y*X.
So in your examples-
XY -> 2 combinations XY and YX
XYZ -> respectively 8 combinations.
But maybe it can be that your assignment ignores this fact for the sake of simplicity of assignment.

As he seems to have only one matrix X that indeed seems to be the case.

This article has been dead for over six months. Start a new discussion instead.
Take the time to help us to help you. Please be thoughtful and detailed and be sure to adhere to our posting rules.