[proofplan]
The proof is pointwise on an overlap $U_i\cap U_j$. At a fixed point $x$, choose a $g_x$-[orthonormal basis](/page/Orthonormal%20Basis) of $T_xM$ and compute the squared norm of the two local curvature forms by summing the squared norms of their values on pairs of basis vectors. The Riemannian basis is unchanged by changing the principal-bundle trivialization, while the $\mathfrak g$-coefficients transform by the adjoint action. The $\operatorname{Ad}$-invariance of $(\cdot,\cdot)_{\mathfrak g}$ makes each coefficient pairing unchanged, so the local squared norm functions agree on overlaps and therefore define a global density.
[/proofplan]
[step:Compute the pointwise curvature norm using an orthonormal frame]
Fix a point $x\in U_i\cap U_j$. Let $n:=\dim M$, and choose a basis $e_1,\dots,e_n$ of $T_xM$ that is orthonormal with respect to the [inner product](/page/Inner%20Product) $g_x$.
For a $\mathfrak g$-valued alternating $2$-form $\alpha\in \Lambda^2T_x^*M\otimes\mathfrak g$, the pointwise squared norm induced by $g_x$ and $(\cdot,\cdot)_{\mathfrak g}$ is
\begin{align*}
|\alpha|^2:=\sum_{1\le a<b\le n}(\alpha(e_a,e_b),\alpha(e_a,e_b))_{\mathfrak g}.
\end{align*}
This formula is independent of the chosen $g_x$-orthonormal basis because it is the [tensor product](/page/Tensor%20Product) inner product on $\Lambda^2T_x^*M\otimes\mathfrak g$.
Applying this definition to the local representatives gives
\begin{align*}
|F_i(x)|^2=\sum_{1\le a<b\le n}(F_i(x)(e_a,e_b),F_i(x)(e_a,e_b))_{\mathfrak g}
\end{align*}
and
\begin{align*}
|F_j(x)|^2=\sum_{1\le a<b\le n}(F_j(x)(e_a,e_b),F_j(x)(e_a,e_b))_{\mathfrak g}.
\end{align*}
[/step]
[step:Use the adjoint transformation law on each curvature coefficient]
Define $h:=g_{ij}(x)\in G$. The transformation law $F_j=\operatorname{Ad}_{g_{ij}^{-1}}F_i$ means that for every $v,w\in T_xM$,
\begin{align*}
F_j(x)(v,w)=\operatorname{Ad}_{h^{-1}}(F_i(x)(v,w)).
\end{align*}
In particular, for every pair of indices $a,b$ with $1\le a<b\le n$,
\begin{align*}
F_j(x)(e_a,e_b)=\operatorname{Ad}_{h^{-1}}(F_i(x)(e_a,e_b)).
\end{align*}
[guided]
We now translate the gauge transformation law into a statement about the actual coefficients that enter the norm. The transition map is
\begin{align*}
g_{ij}:U_i\cap U_j\to G,
\end{align*}
so at the fixed point $x$ it gives a single group element $h:=g_{ij}(x)\in G$. The local curvature representatives are $\mathfrak g$-valued $2$-forms, so $F_i(x)$ and $F_j(x)$ are alternating bilinear maps
\begin{align*}
F_i(x):T_xM\times T_xM\to\mathfrak g
\end{align*}
and
\begin{align*}
F_j(x):T_xM\times T_xM\to\mathfrak g.
\end{align*}
The hypothesis $F_j=\operatorname{Ad}_{g_{ij}^{-1}}F_i$ on $U_i\cap U_j$ means pointwise that, after evaluating on tangent vectors $v,w\in T_xM$, the resulting Lie-algebra element is acted on by $\operatorname{Ad}_{h^{-1}}$. Thus
\begin{align*}
F_j(x)(v,w)=\operatorname{Ad}_{h^{-1}}(F_i(x)(v,w)).
\end{align*}
The norm of a $2$-form is computed by evaluating it on the orthonormal pairs $e_a,e_b$. Substituting $v=e_a$ and $w=e_b$ gives, for each $1\le a<b\le n$,
\begin{align*}
F_j(x)(e_a,e_b)=\operatorname{Ad}_{h^{-1}}(F_i(x)(e_a,e_b)).
\end{align*}
This is the exact place where the principal-bundle change of local section enters the proof: it changes only the $\mathfrak g$-coefficient of each curvature component, not the tangent vectors or the Riemannian metric on $M$.
[/guided]
[/step]
[step:Apply $\operatorname{Ad}$-invariance to preserve every coefficient pairing]
For each $1\le a<b\le n$, define
\begin{align*}
\xi_{ab}:=F_i(x)(e_a,e_b)\in\mathfrak g.
\end{align*}
Using the previous step and the $\operatorname{Ad}$-invariance of $(\cdot,\cdot)_{\mathfrak g}$ with the group element $h^{-1}\in G$, we obtain
\begin{align*}
(F_j(x)(e_a,e_b),F_j(x)(e_a,e_b))_{\mathfrak g}=(\operatorname{Ad}_{h^{-1}}\xi_{ab},\operatorname{Ad}_{h^{-1}}\xi_{ab})_{\mathfrak g}.
\end{align*}
By $\operatorname{Ad}$-invariance,
\begin{align*}
(\operatorname{Ad}_{h^{-1}}\xi_{ab},\operatorname{Ad}_{h^{-1}}\xi_{ab})_{\mathfrak g}=(\xi_{ab},\xi_{ab})_{\mathfrak g}.
\end{align*}
Therefore
\begin{align*}
(F_j(x)(e_a,e_b),F_j(x)(e_a,e_b))_{\mathfrak g}=(F_i(x)(e_a,e_b),F_i(x)(e_a,e_b))_{\mathfrak g}
\end{align*}
for every pair $a<b$.
[/step]
[step:Sum the coefficient equalities to identify the local squared norms]
Summing the equality from the previous step over all pairs $1\le a<b\le n$ gives
\begin{align*}
|F_j(x)|^2=\sum_{1\le a<b\le n}(F_j(x)(e_a,e_b),F_j(x)(e_a,e_b))_{\mathfrak g}.
\end{align*}
Using the pairwise equalities,
\begin{align*}
|F_j(x)|^2=\sum_{1\le a<b\le n}(F_i(x)(e_a,e_b),F_i(x)(e_a,e_b))_{\mathfrak g}.
\end{align*}
By the definition of the pointwise norm of $F_i(x)$,
\begin{align*}
|F_j(x)|^2=|F_i(x)|^2.
\end{align*}
Since $x\in U_i\cap U_j$ was arbitrary, the local squared norm functions agree on the full overlap $U_i\cap U_j$.
[/step]
[step:Glue the local curvature densities and conclude gauge independence of the Yang-Mills energy]
The equality $|F_i|^2=|F_j|^2$ on every overlap $U_i\cap U_j$ shows that the locally defined functions $|F_i|^2:U_i\to[0,\infty)$ agree wherever two trivializations overlap. Hence they glue to a globally defined function
\begin{align*}
|F_A|^2:M\to[0,\infty)
\end{align*}
defined by $|F_A|^2|_{U_i}:=|F_i|^2$.
The Riemannian volume density $d\operatorname{vol}_g$ depends only on the metric $g$ on $M$, not on the chosen local section of $P$. Therefore the local densities $|F_i|^2\,d\operatorname{vol}_g$ also agree on overlaps and glue to the global density $|F_A|^2\,d\operatorname{vol}_g$.
Consequently, if the Yang-Mills energy is computed in any system of local sections and trivializations by integrating the locally represented density, the value is the integral of this same global density:
\begin{align*}
\operatorname{YM}(A)=\int_M |F_A(x)|^2\,d\operatorname{vol}_g(x).
\end{align*}
Thus $\operatorname{YM}(A)$ is independent of the chosen local sections and trivializations.
[/step]