# 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....

Welcome to Ask Sage! Thank you for your question.

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$.

Homework ?