[proofplan]
The proof is driven by the cyclic trace identity $\operatorname{tr}(XY)=\operatorname{tr}(YX)$ for square matrices. We first prove this identity directly from matrix entries, so no external result is needed. Then we show that the trace of every commutator vanishes, which implies closure of $\mathfrak{sl}_n(F)$ under the Lie bracket and also proves the stronger ideal condition inside $\mathfrak{gl}_n(F)$.
[/proofplan]
[step:Prove the cyclic trace identity for two matrices]
Let $X=(x_{ij})_{1 \le i,j \le n}$ and $Y=(y_{ij})_{1 \le i,j \le n}$ be elements of $\mathfrak{gl}_n(F)$. By the definition of matrix multiplication and trace,
\begin{align*}
\operatorname{tr}(XY)
&= \sum_{i=1}^{n} (XY)_{ii} \\
&= \sum_{i=1}^{n} \sum_{j=1}^{n} x_{ij}y_{ji}.
\end{align*}
Since the sums are finite and multiplication in the field $F$ is commutative, we may interchange the order of summation and commute each scalar product:
\begin{align*}
\sum_{i=1}^{n} \sum_{j=1}^{n} x_{ij}y_{ji}
&= \sum_{j=1}^{n} \sum_{i=1}^{n} y_{ji}x_{ij} \\
&= \sum_{j=1}^{n} (YX)_{jj} \\
&= \operatorname{tr}(YX).
\end{align*}
Thus $\operatorname{tr}(XY)=\operatorname{tr}(YX)$.
[guided]
We need a trace identity strong enough to handle commutators. Let
$X=(x_{ij})_{1 \le i,j \le n}$ and $Y=(y_{ij})_{1 \le i,j \le n}$ be arbitrary matrices in $\mathfrak{gl}_n(F)$. The $(i,i)$ entry of $XY$ is obtained by multiplying the $i$-th row of $X$ with the $i$-th column of $Y$, so
\begin{align*}
(XY)_{ii} = \sum_{j=1}^{n} x_{ij}y_{ji}.
\end{align*}
Taking the trace means summing these diagonal entries:
\begin{align*}
\operatorname{tr}(XY)
&= \sum_{i=1}^{n} (XY)_{ii} \\
&= \sum_{i=1}^{n} \sum_{j=1}^{n} x_{ij}y_{ji}.
\end{align*}
Because the index sets are finite, changing the order of summation is only a finite rearrangement. Because $F$ is a field, scalar multiplication in $F$ is commutative, so $x_{ij}y_{ji}=y_{ji}x_{ij}$. Therefore
\begin{align*}
\sum_{i=1}^{n} \sum_{j=1}^{n} x_{ij}y_{ji}
&= \sum_{j=1}^{n} \sum_{i=1}^{n} y_{ji}x_{ij}.
\end{align*}
For each fixed $j$, the inner sum is exactly the $(j,j)$ entry of $YX$:
\begin{align*}
(YX)_{jj} = \sum_{i=1}^{n} y_{ji}x_{ij}.
\end{align*}
Hence
\begin{align*}
\operatorname{tr}(XY)
&= \sum_{j=1}^{n} (YX)_{jj} \\
&= \operatorname{tr}(YX).
\end{align*}
This proves the cyclic trace identity for two matrices.
[/guided]
[/step]
[step:Show that every commutator has trace zero]
Let $X,Y \in \mathfrak{gl}_n(F)$. The commutator bracket is
\begin{align*}
[X,Y] = XY - YX.
\end{align*}
Using linearity of the trace map $\operatorname{tr}: \mathfrak{gl}_n(F) \to F$ and the cyclic trace identity just proved,
\begin{align*}
\operatorname{tr}([X,Y])
&= \operatorname{tr}(XY-YX) \\
&= \operatorname{tr}(XY)-\operatorname{tr}(YX) \\
&= 0.
\end{align*}
Therefore $[X,Y] \in \mathfrak{sl}_n(F)$ for every $X,Y \in \mathfrak{gl}_n(F)$.
[/step]
[step:Deduce that $\mathfrak{sl}_n(F)$ is a Lie subalgebra]
First, $\mathfrak{sl}_n(F)$ is a linear subspace of $\mathfrak{gl}_n(F)$ because it is the kernel of the [linear map](/page/Linear%20Map)
\begin{align*}
\operatorname{tr}: \mathfrak{gl}_n(F) &\to F \\
X &\mapsto \operatorname{tr}(X).
\end{align*}
If $X,Y \in \mathfrak{sl}_n(F)$, then in particular $X,Y \in \mathfrak{gl}_n(F)$. By the previous step,
\begin{align*}
\operatorname{tr}([X,Y])=0,
\end{align*}
so $[X,Y] \in \mathfrak{sl}_n(F)$. Thus $\mathfrak{sl}_n(F)$ is closed under the commutator bracket and is therefore a Lie subalgebra of $\mathfrak{gl}_n(F)$.
[/step]
[step:Deduce that $\mathfrak{sl}_n(F)$ is an ideal]
Let $X \in \mathfrak{gl}_n(F)$ and let $Y \in \mathfrak{sl}_n(F)$. Since $Y \in \mathfrak{gl}_n(F)$, the previous commutator calculation applies to the pair $(X,Y)$ and gives
\begin{align*}
\operatorname{tr}([X,Y])=0.
\end{align*}
Hence $[X,Y] \in \mathfrak{sl}_n(F)$. Therefore
\begin{align*}
[\mathfrak{gl}_n(F),\mathfrak{sl}_n(F)] \subseteq \mathfrak{sl}_n(F),
\end{align*}
which is precisely the statement that $\mathfrak{sl}_n(F)$ is an ideal of $\mathfrak{gl}_n(F)$.
[/step]