I am reading the Wikipedia article on Chern-Simons theory https://en.wikipedia.org/wiki/Chern%E2%80%93Simons_theory, where it states that the action of Chern-Simons theory is
$S=\frac{k}{4\pi}\int_M \text{tr}(A \: \wedge \:dA + \frac{2}{3}A \: \wedge \:A \: \wedge \: A). $
($A$ is the potential $1$-form and $F$ is the field strength $2$-form). It then says that the classical equations of motion for the theory can be obtained in the usual way by finding the extrema of the action with respect to variations of the field $A$ (ie. considering $S$ as a functional of $A$). The classical equations of motion obtained in this way are:
$\frac{k}{2\pi}F=0$
where
$F=dA + A \: \wedge \: A$.
Obviously I know how to do this in the usual setting where the action is a functional of one or more variables, but could someone clarify how this variation is done when we are using differential forms? I do have an example in my book on gauge theories but it relies on some identities which are not necessarily obvious.
In the textbook we have the action:
$S[A]=\int \big(-\frac{1}{2}F \: \wedge \star \: F - j\: \wedge \: A \big)$
Vary $A$ by a small amount $a$ and then keep the terms linear in $a$.
$S[A+a] - S[A] = \int (-(da) \: \wedge \: \star \: dA + a \: \wedge \: j)+...$
In making this variation we had to use an identity (I have proved this identity before as an exercise).
$\int \phi \: \wedge \: \star \: \psi = \int \psi \: \wedge \: \star \: \phi$
where $\phi$ is a form of degree $1$ lower than $\psi$. We then apply a second identity which is valid if we assume a vanishing boundary term (I have also proved this as an exercise).
$\int d\phi \: \wedge \: \star \: \psi = \int \phi \: \wedge \: \star \: \delta \psi$
$S[A+a] - S[A] = \int a \: \wedge \: \star \: (-\delta dA + \:\star \: j)+...$
Assuming the action is stationary, we then get an equation of motion for $A$.
$\delta dA = \: \star \: j$.
So is it the same here, do you vary the action and then use identities to get the varied action into a form where the equation of motion falls out?
Since writing the question I think I have realized how to do it. I don't think any particular identities are needed but if someone sees a mistake I have made in the answer, please let me know in the comments so that I can correct the answer.
Start by varying the action (I will use the same notation to be consistent).
$S[A+a] - S[A]=\frac{k}{4 \pi} \int_M \text{Tr}\bigg[ (A+a) \: \wedge \: d(A+a) + \frac{2}{3}(A+a) \: \wedge \: (A+a) \: \wedge \: (A+a) - A \: \wedge dA - \frac{2}{3}A \: \wedge A \: \wedge \: A \bigg].$
Expand out all the brackets.
$S[A+a] - S[A]=\frac{k}{4 \pi} \int_M \text{Tr} \bigg[A \: \wedge \: dA + a \: \wedge \: 2dA + \frac{2}{3}A \: \wedge \: A \: \wedge \: A + \frac{2}{3}A \: \wedge \:A \: \wedge \:a + \frac{4}{3}A \: \wedge \:A \: \wedge \:a - A \: \wedge \:dA - \frac{2}{3}A \: \wedge \: A \: \wedge \: A \bigg].$
Cancel out terms.
$S[A+a] - S[A]= \frac{k}{4 \pi} \int_M \text{Tr} \bigg[a \: \wedge \: (2dA \: + 2A \: \wedge \: A) \bigg].$
The trace can be removed by writing it over matrices using gauge indices, then using the definition for the field strength form and putting the constant inside the integral and requiring the action to be stationary, it is seen that the equation of motion is:
$\frac{k}{2 \pi}F=0.$