Prove that $\det(A^{2019} +B^{2019} )$ and $\det(A^{2019} -B^{2019} )$ are divisible by $4$
Let $A, B \in M_2(\mathbb{Z})$ so that $$\det A=\det B=\frac{1}{4} \det(A^2+B^2)=1$$ Prove that $\det(A^{2019} +B^{2019} )$ and $\det(A^{2019} -B^{2019} )$ are divisible by $4$.
The only observation I have made is that $\det(A^{2019} +B^{2019}) +\det(A^{2019} - B^{2019} )=4$ so suffice it to prove that one of them is divisible by $4$.
EDIT : This was featured on the regional stage of the maths olympiad in Romania on Saturday, so it is an actual problem, not something I came up with. It is relevant to me because I am preparing for the next stage.
EDIT : $AB=BA$ indeed, I forgot to include it when I posted the problem and I am sorry for this.
Since there are people in the comments eager to see the official paper, here it is :
https://imgur.com/a/z8v3VZp
As you can see, this contest took place on the 24th of February(I know we have a pretty strange date format, but this is what 24.02. 2019 means) and it wasn't an online competition, so I really was honest when I said I was not cheating.
The problem statement in general is false if $A$ and $B$ do not commute. E.g. consider $$ A=\pmatrix{1&-1\\ 2&-1}, \ B=\pmatrix{0&-1\\ 1&0}. $$ Then $A^2=B^2=-I$, so that $$ \det(A)=\det(B)=1\ \text{ and } \ \frac14\det\left(A^2+B^2\right)=\frac14\det(-2I)=1. $$ Yet, as $A^{2019}=(A^2)^{1009}A=(-I)^{1009}A=-A$ and the analogous holds for $B$, we have \begin{aligned} \det\left(A^{2019}+B^{2019}\right) =\det(-A-B)=\det(A+B) =\det\pmatrix{1&-2\\ 3&-1} =5, \end{aligned} which is not divisible by $4$. One can easily verify that $AB\ne BA$ in this example.
Nonetheless, the problem statement is true if $AB=BA$. This can be proved easily be considering the eigenvalues of $A,\ B$ and $A^2+B^2$.
The other answer demonstrates that the result is false unless $AB=BA$; here's a proof in that case. Note that $A^2+B^2=\dfrac12\left((A+B)^2+(A-B)^2\right)$. Therefore, $$4=\det(A^2+B^2)=\frac14\det\left((A+B)^2+(A-B)^2\right),$$ i.e. $$\det\left((A+B)^2+(A-B)^2\right)=16.$$ But because $\det(X+Y)=2\det X+2\det Y-\det(X-Y)$ for any two $2\times 2$ matrices $X,Y$, we have $$\det\left((A+B)^2+(A-B)^2\right)=2\det(A+B)^2+2\det(A-B)^2-\det(4AB),$$ so by the condition, $$16 = \det(A+B)^2+\det(A-B)^2.$$ Now, $A+B$ and $A-B$ are both integer matrices, so their determinants squared are nonnegative perfect squares. The only two nonnegative perfect squares that sum to $16$ are $0,16$, therefore one of $\det(A+B),\det(A-B)$ is $0$ and the other is $\pm 4$. We are done because of the factorisations $$A^{2019}+B^{2019}=(A+B)(A^{2018}-A^{2017}B+\dots+B^{2018}),$$ $$A^{2019}-B^{2019}=(A-B)(A^{2018}+A^{2017}B+\dots+B^{2018}).$$