Representing Matrices Using Algebraic ZX-calculus

Natural Language Processing

Elementary matrices play an important role in linear algebra applications. In this paper, we represent all the elementary matrices of size 2m × 2m using algebraic ZX-calculus. Then we show their properties on inverses and transpose using rewriting rules of ZX-calculus. As a consequence, we are able to depict any matrices of size 2m × 2n by string diagrams without resort to a diagrammatic normal form for matrices. By doing so, we pave the way towards visualising by string diagrams important matrix technologies deployed in AI especially machine learning.

Matrices are used everywhere in modern science, like machine learning or quantum computing, to name a few. Meanwhile, there is a graphical language called ZX-calculus that could also deal with matrix calculations such as matrix multiplication and tensor product.

Then there naturally arises a question: why are people bothering with using diagrams for matrix calculations given that matrix technology has been applied with great successes?

There are a few reasons for doing so. First, there is a lot of redundancy in matrix calculations which could be avoided in graphical calculus. For example, to prove the cyclic property of matrices tr(AB) = tr(BA), all the elements of the two matrices will be involved, while in graphical language like ZX-calculus, the proof of the cyclic property is almost a tautology.