# Partitioning a (1,-1)square matrix into (0,-1,1)summand matrices

Given a square matrix M with entries from {1,-1} how to find all possible sets of matrices A1,A2,A3.....(with entries from {0,-1,1}), such that M=A1+A2+A3....

edit retag close merge delete

( 2022-01-06 18:20:52 +0100 )edit

Do you require the matrices $A_j$ to be pairwise distinct?

That way there would be finitely many tuples of matrices $A_j$ summing to M.

One could also forbid having $A_j = 0$ for any $j$, and forbid having $A_j = -A_k$ for any $j$ and $k$.

( 2022-01-06 18:24:32 +0100 )edit

Homework ?

( 2022-01-06 19:17:11 +0100 )edit

Question refined at Ask Sage question 63305.

( 2022-07-20 12:10:14 +0100 )edit

Sort by » oldest newest most voted

For each nonnegative integer $k$, you could find the possible tuples of matrices $(A_1, ..., A_k)$ as follows:

• for each of -1, 0, 1, find the ways to write it as a sum of $k$ summands each in {-1, 0, 1}.

• the target matrix $M$ has $n^2$ entries $m_{i, j}$; so the $(A_1, ..., A_k)$ are obtained by combining all the possible ways to get each entry.

more

First of all apologies for replying very late as I was busy with some other things and I logged again yesterday only after so many months. I am really sorry for that. Yes, your idea of finding ways to write -1,0,1 as k summands of {-1,0,1} appears to be very good. i will try to make the code accordingly. Thanks a lot.

( 2022-07-20 12:02:47 +0100 )edit