I am trying to find *all* possible solutions to the following:

```
A = ( {
{a11, a12},
{a21, a22}
} );
B = ( {
{b11, b12},
{b21, b22}
} );
A.A
```

```
{{a11^2 + a12 a21, a11 a12 + a12 a22}, {a11 a21 + a21 a22, a12 a21 + a22^2}}
```

```
A.B
```

```
{{a11 b11 + a12 b21, a11 b12 + a12 b22}, {a21 b11 + a22 b21, a21 b12 + a22 b22}}
```

```
B.A
```

```
{{a11 b11 + a21 b12, a12 b11 + a22 b12}, {a11 b21 + a21 b22, a12 b21 + a22 b22}}
```

```
B.B
```

```
{{b11^2 + b12 b21, b11 b12 + b12 b22}, {b11 b21 + b21 b22, b12 b21 + b22^2}}
```

but I am unable to find all solutions, I have found few solutions using:

```
Solve[
{a11^2 + a12 a21 == a11, a11 a12 + a12 a22 == a12,
a11 a21 + a21 a22 == a21, a12 a21 + a22^2 == a22,
a11 b11 + a12 b21 == b11, a11 b12 + a12 b22 == b12,
a21 b11 + a22 b21 == b21, a21 b12 + a22 b22 == b22,
a11 b11 + a21 b12 == b11, a12 b11 + a22 b12 == b12,
a11 b21 + a21 b22 == b21, a12 b21 + a22 b22 == b22,
b11^2 + b12 b21 == a11, b11 b12 + b12 b22 == a12,
b11 b21 + b21 b22 == a21, b12 b21 + b22^2 == a22},
{a11, a12, a21, a22, b11, b12, b21, b22}]
```

but not all. Hence, I want to find all solutions.

Also I am trying to solve a similar problem in the 5×5 case. I type the following:

```
A = ( {
{a11, a12, a13, a14, a15},
{a21, a22, a23, a24, a25},
{a31, a32, a33, a34, a35},
{a41, a42, a43, a44, a45},
{a51, a52, a53, a54, a55}
} );
B = ( {
{b11, b12, b13, b14, b15},
{b21, b22, b23, b24, b25},
{b31, b32, b33, b34, b35},
{b41, b42, b43, b44, b45},
{b51, b52, b53, b54, b55}
} );
C = ( {
{c11, c12, c13, c14, c15},
{c21, c22, c23, c24, c25},
{c31, c32, c33, c34, c35},
{c41, c42, c43, c44, c45},
{c51, c52, c53, c54, c55}
} );
D = ( {
{d11, d12, d13, d14, d15},
{d21, d22, d23, d24, d25},
{d31, d32, d33, d34, d35},
{d41, d42, d43, d44, d45},
{d51, d52, d53, d54, d55}
} );
E = ( {
{e11, e12, e13, e14, e15},
{e21, e22, e23, e24, e25},
{e31, e32, e33, e34, e35},
{e41, e42, e43, e44, e45},
{e51, e52, e53, e54, e55}
} );
Solve[
{A.A == A, A.B == B, A.C == C, A.D == D, A.E == E, B.A == B, B.B == C,
B.C == D, B.D == E, B.E == A, C.A == C, C.B == D, C.C == E, C.D == A,
C.E == B, D.A == D, D.B == E, D.C == A, D.D == B, D.E == C, E.A == E,
E.B == A, E.C == B, E.D == C, E.E == D}
```

But it shows a red thing on the right hand side. What is wrong?