Since
\(U\) is star-shaped with respect to the origin, the whole line segment from
\((0,0)\) to
\((x,y)\) lies in
\(U\) for every
\((x,y) \in U\text{.}\) Define
\begin{equation*}
f(x,y)
:=
\int_0^1 \left(P(tx,ty)x+Q(tx,ty)y\right)\,dt.
\end{equation*}
We claim that
\(df=\omega\text{.}\) Because
\(P\) and
\(Q\) are smooth, we may differentiate under the integral sign. First,
\begin{equation*}
f_x(x,y)
=
\int_0^1 \left(P(tx,ty)+txP_x(tx,ty)+tyQ_x(tx,ty)\right)\,dt.
\end{equation*}
Since
\(\omega\) is closed,
\(Q_x=P_y\text{.}\) Therefore
\begin{equation*}
f_x(x,y)
=
\int_0^1 \left(P(tx,ty)+txP_x(tx,ty)+tyP_y(tx,ty)\right)\,dt.
\end{equation*}
The integrand is exactly the derivative of
\(tP(tx,ty)\) with respect to
\(t\text{,}\) so
\begin{equation*}
f_x(x,y)
=
\int_0^1 \frac{d}{dt}\left(tP(tx,ty)\right)\,dt
=
P(x,y).
\end{equation*}
\begin{equation*}
f_y(x,y)
=
\int_0^1 \left(txP_y(tx,ty)+Q(tx,ty)+tyQ_y(tx,ty)\right)\,dt.
\end{equation*}
Again using
\(P_y=Q_x\text{,}\) we obtain
\begin{align*}
f_y(x,y) \amp = \int_0^1 \left(txQ_x(tx,ty)+Q(tx,ty)+tyQ_y(tx,ty)\right)\,dt\\
\amp = \int_0^1 \frac{d}{dt}\left(tQ(tx,ty)\right)\,dt\\
\amp = Q(x,y).
\end{align*}
Thus
\(df=f_x\,dx+f_y\,dy=P\,dx+Q\,dy=\omega\text{,}\) so
\(\omega\) is exact.