Solve this following
Question:

The number of all $3 \times 3$ matrices A, with enteries from the set $\{-1,0,1\}$ such that the sum of the diagonal elements of $\mathrm{AA}^{\mathrm{T}}$ is 3 , is

Solution: