A quite popular exercise in linear algebra is the following (or very related exercises, see for example <https://math.stackexchange.com/questions/299651/square-matrices-satisfying-certain-relations-must-have-dimension-divisible-by-3> and <https://math.stackexchange.com/questions/3109173/ab-ba-invertible-and-a2b2-ab-then-3-divides-n>):



> 
> Let $K$ be a field of characteristic different from 3 and $X$ and $Y$ two $n\times n$-matrices with $X^2+Y^2+XY=0$ and $XY-YX$ invertible. Then 3 divides $n$.
> 
> 
> 


A (representation-theoretic) proof can be given as in the answer of Mariano Suárez-Álvarez in <https://math.stackexchange.com/questions/299651/square-matrices-satisfying-certain-relations-must-have-dimension-divisible-by-3> .



> 
> Question: Is this also true for fields of characteristic 3?
> 
> 
> 




---



> 
> edit: So it turned out that the result holds for any field. A bonus question might be to find a proof that works independent of the characteristic of the field.
> 
> 
> 



Conditions on matrices imply that 3 divides $n$
Assembling the comments, I write the entire solution.


STEP 1: *the first hypothesis in characteristics 3 is equivalent to* $(X-Y)^2 = [X,Y]$.


Indeed, note that


$$(X-Y)^2 - [X,Y] = X^2-XY-YX+Y^2- XY+YX = X^2-2XY+Y^2 = X^2+Y^2+XY$$


Why did I make this calculation? Note that $X^2+Y^2+XY$ resembles a factor of $X^3-Y^3$, which would be equal (in commutative case) to $(X-Y)^3$ in char 3. To get there we would need a $X-Y$ more, so we can guess that $(X-Y)^2$ and $X^2+Y^2+XY$ will be equal up to some commutators!


STEP 2: getting the final result.


We have that $(X-Y)^2 = [X,Y]$ is invertible by the second hypothesis. Thus in particular $X-Y$ is invertible. This allows us to substitute $X=M+Y$ with M invertible, obtaining


$$M^2 = [M+Y,Y] = [M,Y]$$


The only relevant information we have about arbitrary commutators is that the trace is zero. We hence would like to have some matrix with easy trace (like the identity) to compare witha commutator. To do this, let's multiplicate on both the left and the right for $M^{-1}$:


$$ I = M^{-1}[M,Y]M^{-1} = M^{-1}(MY-YM)M^{-1} = YM^{-1}-M^{-1}Y = [Y,M^{-1}]$$
Taking traces we get $n=0$. Being in characteristics 3, this gives $3 \mid n$.


