Let $K$ be a field of a characteristic different than 2 and 3: $char(K) \notin \{2,3\}$.
A $3 \times 3$ matrix over $K$ is a magical square if the sums of all rows, columns and diagonals are equal.
Consider the set of all magical squares $M$ as a subset of $K^9$.
Show that $M$ forms a $K$-linear subspace in $K^9$.
Find a basis of $M$.
How many magical squares are there for $\mathbb{F_5}$ and $\mathbb{F_7}$?
The first part is clear to me, however I struggle to find a basis and the cardinality of $M$ for the given $K$, but I assume it is because I do not have a basis.