Show $D^2=0$ iff $D=e^{-f}de^{f}$ for some function $f$ , where $D\omega := d\omega+\alpha \wedge \omega $ Let $\alpha$ be a $1$-form on $\mathbb{R}^n$. Define the following which takes $k$-forms to $(k+1)$-forms.
$$D\omega := d\omega+\alpha \wedge \omega $$
Show that $D^2=0$ iff $D=e^{-f}de^{f}$ for some function $f$ and express $\alpha$ in terms of $f$.
I get that
$$\begin{align} D^2 \omega=D(D(\omega) &= D(d\omega + \alpha \wedge \omega) \\
&= d(\alpha \wedge \omega)+ \alpha \wedge d\omega + \alpha \wedge \alpha \wedge \omega \\
&= d\alpha \wedge d\omega + \alpha \wedge d\omega + \alpha \wedge \alpha \wedge \omega 
\end{align}$$
but I cannot see how to proceed. I also find it strange that first term is a $(k+3)$-form.
 A: By definition of $D$, we get
$$\begin{align} D^2 \omega=D(D(\omega) &= D(d\omega + \alpha \wedge \omega) \\
&= d(\alpha \wedge \omega)+ \alpha \wedge d\omega + \alpha \wedge \alpha \wedge \omega \\
&= d\alpha \wedge \omega-\alpha \wedge d\omega + \alpha \wedge d\omega + \alpha \wedge \alpha \wedge \omega\\
&= d\alpha \wedge \omega ,
\end{align}$$
where the second last equality follows from 
$d(\gamma \wedge \beta)= (d\gamma ) \wedge \beta + (-1)^k \gamma  \wedge (d\beta)$
when $\gamma $ is a $k$-form, and the last equality follows from 
$\alpha \wedge \alpha =-\alpha \wedge \alpha =0$ since $\alpha$ is a $1$-form. 
Then $D^2=0\iff d\alpha=0$ $\iff$ $\alpha$ is closed $1$-form in $\mathbb{R}^n$
$\iff$ $\alpha$ is exact (since $H^1_{DR}(\mathbb{R}^n)=0$) $\iff$  there exists a smooth function $f:\mathbb{R}^n\to\mathbb{R}$ such that $\alpha=df$. 
Now, if $\alpha=df$, we can see that $D=e^{-f}de^f$, because 
$$e^{-f}d(e^f\omega)=e^{-f}e^fd\omega+e^{-f}d(e^f)\wedge\omega=d\omega+e^{-f}e^fdf\wedge\omega=d\omega+df\wedge\omega=d\omega+\alpha\wedge\omega=D\omega.$$
