[proofplan]
We prove the cyclic property $\mathrm{tr}(AB) = \mathrm{tr}(BA)$ by direct computation of the double sums, then deduce trace invariance under similarity as a special case. Determinant invariance follows from [Determinant Multiplicativity](/theorems/395) applied to the factorisation $P^{-1}AP$.
[/proofplan]
[step:Establish the cyclic property $\mathrm{tr}(AB) = \mathrm{tr}(BA)$ for compatible matrices]
Let $A \in \mathrm{Mat}_{m,n}(\mathbb{F})$ and $B \in \mathrm{Mat}_{n,m}(\mathbb{F})$.
The $(i,i)$-entry of $AB$ is $(AB)_{ii} = \sum_{k=1}^n A_{ik} B_{ki}$, so
\begin{align*}
\mathrm{tr}(AB) = \sum_{i=1}^m \sum_{k=1}^n A_{ik} B_{ki}.
\end{align*}
Similarly, $(BA)_{kk} = \sum_{i=1}^m B_{ki} A_{ik}$, giving
\begin{align*}
\mathrm{tr}(BA) = \sum_{k=1}^n \sum_{i=1}^m B_{ki} A_{ik}.
\end{align*}
Both expressions sum the same terms $A_{ik} B_{ki}$ over all pairs $(i,k) \in \{1,\dots,m\} \times \{1,\dots,n\}$.
Since addition in $\mathbb{F}$ is commutative, the sums are equal: $\mathrm{tr}(AB) = \mathrm{tr}(BA)$.
[guided]
Why does the cyclic property hold for rectangular matrices of compatible dimensions, not just square matrices? The key observation is that both $\mathrm{tr}(AB)$ and $\mathrm{tr}(BA)$ are well-defined: $AB \in \mathrm{Mat}_m(\mathbb{F})$ and $BA \in \mathrm{Mat}_n(\mathbb{F})$, so both have traces, even though the matrices have different sizes. The computation reduces both traces to the same double sum.
Write out the diagonal entries explicitly. The $(i,i)$-entry of $AB$ is $(AB)_{ii} = \sum_{k=1}^n A_{ik} B_{ki}$, so
\begin{align*}
\mathrm{tr}(AB) = \sum_{i=1}^m (AB)_{ii} = \sum_{i=1}^m \sum_{k=1}^n A_{ik} B_{ki}.
\end{align*}
The $(k,k)$-entry of $BA$ is $(BA)_{kk} = \sum_{i=1}^m B_{ki} A_{ik}$, so
\begin{align*}
\mathrm{tr}(BA) = \sum_{k=1}^n (BA)_{kk} = \sum_{k=1}^n \sum_{i=1}^m B_{ki} A_{ik}.
\end{align*}
Both double sums range over the same index set $\{1,\dots,m\} \times \{1,\dots,n\}$ and each term is $A_{ik} B_{ki}$ (using commutativity of multiplication in $\mathbb{F}$). Interchanging the order of summation shows the two expressions coincide: $\mathrm{tr}(AB) = \mathrm{tr}(BA)$.
[/guided]
[/step]
[step:Deduce trace invariance under similarity]
Suppose $B = P^{-1}AP$ for some invertible $P \in \mathrm{Mat}_n(\mathbb{F})$.
Write $B = (P^{-1}A) \cdot P$.
Applying the cyclic property with the two factors $P^{-1}A \in \mathrm{Mat}_n(\mathbb{F})$ and $P \in \mathrm{Mat}_n(\mathbb{F})$:
\begin{align*}
\mathrm{tr}(B) = \mathrm{tr}((P^{-1}A)P) = \mathrm{tr}(P(P^{-1}A)) = \mathrm{tr}(A).
\end{align*}
[/step]
[step:Deduce determinant invariance under similarity]
By [Determinant Multiplicativity](/theorems/395), the determinant is a group homomorphism $\det: (\mathrm{Mat}_n(\mathbb{F})^\times, \cdot) \to (\mathbb{F}^\times, \cdot)$, so
\begin{align*}
\det(P^{-1}AP) = \det(P^{-1}) \cdot \det(A) \cdot \det(P) = \frac{1}{\det P} \cdot \det A \cdot \det P = \det A.
\end{align*}
The cancellation $\det(P^{-1}) \cdot \det(P) = \det(P^{-1}P) = \det(I) = 1$ uses multiplicativity of the determinant and the fact that $P$ is invertible.
[/step]