# Positive integer matrices satisfying $A^3 + B^3 = C^3$

From the 3rd edition of the book "The Linear Algebra a Beginning Graduate Student Ought to Know" by Jonathan S. Golan, we find the following exercise (number 475) under chapter 9:

"Find infinitely-many triples $$(A, B, C$$) of nonzero matrices in $$M_{3×3}(\mathbb{Q})$$, the entries of which are nonnegative integers, satisfying the condition $$A^3 + B^3 = C^3.$$"

Now we if understand "non-negative integers" to include $$0$$, then easily we can take $$A$$, $$B$$ and $$C$$ to be diagonal matrices such that:

$$A = \begin{pmatrix} a & 0 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \\ \end{pmatrix} , B = \begin{pmatrix} 0 & 0 & 0 \\ 0 & b & 0 \\ 0 & 0 & 0 \\ \end{pmatrix}, C = \begin{pmatrix} a & 0 & 0 \\ 0 & b & 0 \\ 0 & 0 & 0 \\ \end{pmatrix}$$

However, if we interpret the term "non-negative" to mean "strictly positive" (s.t. a positive matrix is defined in the sense given in the entry: https://en.wikipedia.org/wiki/Nonnegative_matrix), the question becomes harder... I suspect that the equation never holds, not only in the case of $$n=3$$, but for all positive integers $$n$$. I.e. we cannot find positive matrices $$A,B,C$$ in $$M_{n×n}(\mathbb{Q})$$ such that $$A^k + B^k = C^k.$$ where $$k>2$$ is an integer." I conjecture this because a few constructions I tried for finding solutions all failed, and I imagine a way to prove that it is impossible would be by contradiction... i.e. show that any valid triplet would imply a rational/integer solution to the integer equation $$a^k + b^k = c^k$$ (where $$a,b,c \in \mathbb{Q}$$) which can't exist by Fermat's last theorem. However, I haven't found a promising trick yet and I wonder if the conjecture, if true, can be proven so easily, be it via contradiction or via other means...

• "Non-negative" usually means including zero, otherwise it would be "positive". So I guess your first solution is fine! Commented Apr 17, 2023 at 5:38
• He is asking about harder version and the question is really interesting. Commented Apr 17, 2023 at 5:40
• Your example $A, B, C$ make me want to conjecture that any solutions to $A^3+B^3=C^3$ must have at least one singular matrix. Commented Apr 17, 2023 at 5:50
• Commented Apr 17, 2023 at 6:52
• @AleksandrKalinin What makes you so sure? Commented Apr 17, 2023 at 17:22

Take $$A = B = \begin{pmatrix} 1 & 1 & 1 \\ 2 & 1 & 1 \\ 2 & 2 & 1 \\ \end{pmatrix}$$ $$C = \begin{pmatrix} 2 & 1 & 1 \\ 2 & 2 & 1 \\ 2 & 2 & 2 \\ \end{pmatrix}$$ It can then be checked that $$A^3 + B^3 = C^3 = \begin{pmatrix} 38 & 30 & 24 \\ 48 & 38 & 30 \\ 60 & 48 & 38 \\ \end{pmatrix}$$ To construct an infinite family, note that you can just take any positive number $$n\in \mathbb{N}$$, and multiplying $$A, B, C$$ by $$n$$ you obtain positive matrices which still satisfy the equation.

P.S. I found this example using a simple brute force algorithm in python.

import numpy as np
from itertools import product
cubes = []
argcubes = []
for x in product(range(1,3), repeat=9):
A = np.array(x).reshape(3,3)
argcubes.append(A)
cubes.append(A@A@A)
cubes = np.stack(cubes)
def contains(X):
return np.any(np.all(X == cubes, axis=(1,2)))
def index(X):
return np.all(X == cubes, axis=(1,2)).argmax()
found = False
for i, A in enumerate(cubes):
if found:
break
for j, B in enumerate(cubes):
if found:
break
C = A + B
if contains(C):
print(i, j, index(C))
print(argcubes[i])
print(argcubes[j])
print(argcubes[index(C)])
found = True


Let $$x$$ be a constant. Let $$Y$$ be the companion matrix for the polynomial $$y^3-x$$: $$Y=\begin{pmatrix} 0 & 1 & 0 \\ 0 & 0 & 1 \\ x & 0 & 0 \end{pmatrix}\text{.}$$

Let $$Z$$ be the adjugate of $$Y-y\,\mathrm{I}$$:

$$Z=\mathrm{adj}\,(Y - y\,\mathrm{I}) = \begin{pmatrix} y^2 & y & 1 \\ x & y^2 & y \\ xy & x & y^2 \end{pmatrix}\text{.}$$

Suppose further that $$x$$ be a sum of cubes

$$x=a^3+b^3\text{.}$$

Let $$A=aZ$$, $$B=bZ$$, $$C=yZ + \mathrm{I}\det(Y-y\,\mathrm{I})$$:

\begin{align} A&= a\begin{pmatrix} y^2 & y & 1 \\ x & y^2 & y \\ xy & x & y^2 \end{pmatrix}\\ B &= b\begin{pmatrix} y^2 & y & 1 \\ x & y^2 & y \\ xy & x & y^2 \end{pmatrix}\\ C&=\begin{pmatrix} x & y^2 & y \\ xy & x & y^2 \\ xy^2 & xy & x \end{pmatrix}\end{align}\text{.} Then $$C^3 = A^3 + B^3$$ with all matrix elements positive integers if $$a$$, $$b$$, and $$y$$ are. This last equality ultimately holds because of the Cayley-Hamilton equality $$Y^3 = x \,\mathrm{I}$$ implying $$(y\,\mathrm{adj}(Y-y\mathrm{I}) + \mathrm{I}\,\det(Y-y\mathrm{I}))^3 = x\,\mathrm{adj}(Y-y\mathrm{I})^3 \text{.}$$ It's motivated by remarks on cyclic cubic extensions in an answer to a related question, as well as numerical evidence in another answer to this question.

Let $$Y$$ be defined to be the dimension-$$n$$ companion matrix for the polynomial $$y^n-x$$, with $$Z$$ and $$C$$ are defined the same as above. Then one can show, mutatis mutandis, that $$Z$$ and $$C$$ have elements that are monic monomials in $$x$$ and $$y$$ and $$C^n=xZ^n$$, so that positive solutions of $$x=a^n + b^n$$ lift to positive $$n\times n$$-matrix solutions of $$C^n = A^n + B^n$$.